Guides

Native fungible tokens

Any BitKeelmark wallet can create a fungible token on the private devnet. Creation sets an immutable name, symbol, decimal precision, issuer, and supply cap. The supply starts at zero. The issuer can mint units to any valid address until the cap is reached, and each holder can transfer their own units.

Create, issue, and transfer

Run the commands from the project root after initializing the devnet. In PowerShell, set $miner to the setup miner address and $recipient to the setup recipient address. This example creates a mint with two decimals and a cap of 1,000 tickets, issues 250 tickets to the miner wallet, then transfers 12.50 tickets.

PowerShell
$db = '.local/devnet/chain.sqlite'
$wallet = '.local/devnet/miner'
$mint = python -m chain --db $db token-create $wallet 'Private Tickets' TIX 2 100000 .local/tix-create.json | ConvertFrom-Json
$token = $mint.token_id
python -m chain --db $db mine $miner --transaction .local/tix-create.json
python -m chain --db $db token-mint $wallet $token $miner 25000 .local/tix-issue.json
python -m chain --db $db mine $miner --transaction .local/tix-issue.json
python -m chain --db $db token-transfer $wallet $token $recipient 1250 .local/tix-transfer.json
python -m chain --db $db mine $miner --transaction .local/tix-transfer.json
python -m chain --db $db token-info $token
python -m chain --db $db token-balance $token $recipient
python -m chain --db $db token-list
python -m chain --db $db verify

Signing writes a new transaction file. The mint or balance changes when a block includes it. Use fresh output paths for subsequent runs. token-list orders by mint ID and accepts --limit and --after for pagination.

Token commands share the wallet nonce with ordinary BKMK transfers. The default nonce reads the latest confirmed account state. Use --nonce when preparing several transactions before they confirm, and include them in nonce order. A recipient needs a hybrid wallet to spend its received units. The devnet charges zero transaction fees.

Consensus

Each transaction carries its kind, the signer’s canonical hybrid public keys, a hybrid signature, and the next account nonce. Both secp256k1 and ML-DSA-44 signatures cover the full transaction payload under the existing genesis-bound signing domain. Fields specific to each kind are listed below.

Record kind Additional fields Authorized signer
token_create name, symbol, decimals, cap Creating wallet, which becomes the issuer
token_mint token_id, to, amount Issuer
token_transfer token_id, to, amount Holder spending its own balance

The mint ID is the lowercase hex SHA-256 of the concatenated BKMK token mint ASCII prefix and zero byte, 32 raw genesis hash bytes, the issuer’s lowercase ASCII address, the eight-byte unsigned big-endian creation nonce, and the compact ASCII JSON array [name,symbol,decimals,cap]. It commits to the mint definition independently of the signature bytes. A competing fork can reuse the same issuer nonce for a different definition and gets a different mint ID.

Names use 1–64 printable ASCII characters without leading or trailing spaces. Symbols use 1–10 uppercase ASCII letters or digits, beginning with a letter. BKMK is reserved. Other symbols can repeat, so applications identify tokens by mint ID. Decimals range from 0 to 18 and affect display only. Amounts and caps are positive integers from 1 through 2^63 - 1 in the token’s smallest unit. Issuance arithmetic checks the cap before writing to SQLite. A valid transfer preserves issued supply, including a transfer to the sender’s own address.

Token state follows canonical blocks. Block validation, mint state, balances, account nonces, and explorer indexes commit in one SQLite transaction. Replay reconstructs token state from genesis. A heavier fork removes token records and balances from the displaced branch, then applies the winning branch. Token units are tracked outside BKMK circulation and reserve balances.

Upgrade and scope

Opening an existing devnet database creates the token tables while retaining the same genesis and block history. Update all participating nodes and relays before mining a token transaction. Older binaries reject the new transaction kinds.

The protocol covers mint creation, issuer-authorized issuance, and holder-authorized transfer. Mint authorities and metadata are fixed. The records are native BitKeelmark formats. Solana wallets and ERC-20 contracts use their own transaction interfaces.

References