Suppose the 100,000-sat funding UTXO also carries 25 loyalty points. CashTokens can store those points alongside the BCH. The locking script still controls who can spend the UTXO. The new transaction specifies which outputs receive the points.
What tokens represent
- Fungible tokens are interchangeable units within a category. The 25 loyalty points are fungible because each point counts the same.
- A non-fungible token (NFT) can carry its own data, such as a ticket number. That data is its commitment.
A token category identifies which kind of points or NFTs a UTXO holds. An output can carry a fungible amount, one NFT, or both from the same category. When building a spend, assign tokens explicitly to the recipient or change so a BCH-only payment does not burn them. CashTokens specification
Read a token-bearing UTXO
Compare this token-bearing UTXO with the original P2PKH UTXO. The value is still 100,000 sats and the locking bytecode is the same. The field that held only the script now starts with a token prefix for the 25 points.
a086010000000000 3c
ef efcdab8967452301efcdab8967452301efcdab8967452301efcdab8967452301 10 19
76a914b2557abfebaf263824b75ec473fd7b3db74957ea88ac
| Wire field | Decoded value |
|---|---|
a086010000000000 | valueSatoshis: 100_000n |
3c | CompactSize byte length, 60 bytes for prefix plus script |
ef, then 32 bytes | Token marker and token.category, whose display hex is 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef |
10 19 | Bitfield for fungible amount present and no NFT, followed by token.amount: 25n in CompactSize |
76a914…88ac | lockingBytecode, the same 25-byte P2PKH script as the example |
An NFT changes the flags and may add a length-prefixed commitment before the optional amount. Libauth decodes those fields into the optional output.token object. When authorizing a spend, supply the UTXO data with its tokens intact. Plain output bytes and fields · Token prefix format
Create a token category
To create the loyalty point category, spend output 0 of an earlier transaction as a genesis input. The transaction ID of that earlier transaction becomes the category ID. Follow the CashTokens genesis rules to issue the initial amount or NFTs.
Track NFT capabilities
An NFT’s capability controls what the next spend can do. An immutable NFT preserves its commitment, such as a ticket number. A mutable NFT can update it, such as the expiry date of a membership. A minting NFT can authorize new NFTs in its category. Store the capability and commitment with the category and outpoint. CashTokens consensus rules
Resolve metadata with BCMR
Bitcoin Cash Metadata Registries describe tokens using names, tickers, icons, and other off-chain information. Look up metadata by category and verify its authenticity against a registry or identity chain you trust. Treat the on-chain amount and category as the spending record even when metadata is missing. BCMR specification
The smallest unit of BCH, equal to 0.00000001 BCH.The basic unit of spendable value on Bitcoin Cash, holding satoshis and any attached tokens under the spending rules defined by its locking bytecode.Bitcoin Cash’s native fungible token and NFT format, carried in transaction outputs and enforced by consensus.The currency unit of Bitcoin Cash, equal to 100,000,000 satoshis.The program in an output that specifies the conditions required to spend it.A Bitcoin Cash record that defines new outputs and, for a payment, identifies the UTXOs being spent.An interchangeable unit within a token category that an output can carry alongside BCH and an NFT.A token with its own commitment and capability that CashTokens stores in a transaction output.A 32-byte CashTokens identifier that groups related tokens and defines which fungible units are interchangeable.A spending condition that checks a public key against a saved hash and verifies a signature made with the corresponding private key.A transaction record that identifies a UTXO to spend and supplies its unlocking bytecode and sequence number.A transaction’s double-SHA-256 hash, displayed in reverse byte order and used to identify it in an outpoint.A transaction ID and zero-based output index that together identify the UTXO an input spends.A standard for publishing and authenticating off-chain information about tokens and identities, such as names, symbols, and icons.Descriptive information such as a derived key’s depth and index or a token’s name and icon.