Native apps are small state machines stored and executed by BitKeelmark validators. A signed deployment defines integer state and named actions. A signed call runs one action against the state produced by earlier transactions in canonical block order.
Try an inventory tracker
Save the following JSON as .local/inventory.json after setting up the devnet. The owner can set available inventory. A holder of any wallet can record a claim while inventory is available. Each successful claim decreases stock and increases claims by one.
{
"initial": {"stock": 2, "claims": 0},
"actions": {
"restock": {
"access": "owner",
"guards": [],
"updates": [{"key": "stock", "op": "set", "value": "arg"}]
},
"claim": {
"access": "public",
"guards": [{"key": "stock", "op": "ge", "value": 1}],
"updates": [
{"key": "stock", "op": "add", "value": -1},
{"key": "claims", "op": "add", "value": 1}
]
}
}
}
Set $miner to the setup miner address. This PowerShell example signs the deployment with the miner wallet and signs a public action with the recipient wallet.
$db = '.local/devnet/chain.sqlite'
$record = python -m chain --db $db app-deploy .local/devnet/miner .local/inventory.json .local/app-deploy.json | ConvertFrom-Json
$app = $record.app_id
python -m chain --db $db mine $miner --transaction .local/app-deploy.json
python -m chain --db $db app-call .local/devnet/recipient $app claim 0 .local/app-call.json
python -m chain --db $db mine $miner --transaction .local/app-call.json
python -m chain --db $db app-info $app
python -m chain --db $db app-list
python -m chain --db $db verify
The claim action uses fixed operands and ignores its signed argument. Use --nonce on deploy or call to prepare ordered transactions before confirmation. App records, transfers, and token records share each wallet's nonce.
Rules
- Each program has one to eight state keys and one to eight named actions. Names start with a lowercase ASCII letter and can contain lowercase letters, digits, or underscores. Maximum length is 24 characters. State values and call arguments are integers in the inclusive range
-(2^53 - 1)to2^53 - 1. - An action has
access,guards, andupdates. Access isownerorpublic. Both require a valid hybrid signature. The deployer is the fixed owner. Apps have zero to eight guards and one to eight updates per action. Each step names an existing state key and uses an integer literal or"arg"for its operand. Guard operations areeq,ne,lt,le,gt, andge. Update operations aresetandadd. Each action can update a key once. - All guards and update inputs read the state that existed before the call. A failed guard, unauthorized caller, invalid signature, or out-of-bounds result rejects the transaction and its block. Writes, account nonces, and indexed history commit together. Reorganizations and replay apply the same interpreter.
- The app ID is the lowercase hex SHA-256 of the ASCII domain
BKMK appfollowed by a zero byte, the raw 32-byte genesis hash, the owner's ASCII address, the eight-byte big-endian deployment nonce, and the compact sorted ASCII JSON program. The ID commits to the original program and remains stable as calls update state.app-infoincludes the original program, live state, owner, and revision. Revision starts at zero and increments on each accepted call. - Opening an existing database in write mode adds an app table and keeps the same genesis and block history. Upgrade participating nodes before mining app transactions so that each node can validate them.
The interpreter has no loops, filesystem, network, clock, native-coin operations, or token operations. stock and claims are application counters. Public actions are available to each valid signer, with repeated calls allowed while guards pass. Ethereum applications continue to use the separate execution prototype described in the network guide.
Deterministic transition semantics were reviewed against the Ethereum Yellow Paper Shanghai revision efc5f9a. Bounded interpretation was reviewed against Bitcoin Core v31.1, licensed under MIT. The native app implementation uses its own data format and interpreter. Ethereum Yellow Paper ยท Bitcoin Core interpreter