4. Token
Based on the NOTE protocol, the token, named n20, has its Payload defined by the following rules:
- Data is stored in plaintext using msgpack encoding.
- A token contains data structures for operations such as deployment (deploy), distribution (mint), and transfer (transfer).
- All operations revolve around accounts and balances.
- Each operation must be validated off-chain by the smart contract deployed at the time, and only after validation is the account balance modified.
- The data format can be freely extended, and all extended parameters are passed to the smart contract.
UTXO Binding
Tokens are categorized into two states: UTXO-bound and non-bound. On specific blockchains, such as the BTC chain, the quantity of tokens is bound to a UTXO. During operations such as transfer and destruction, the quantity of tokens is transferred from the transaction input to a new UTXO in the transaction output. If cross-chain transfer of tokens is required, the UTXO bound to the token will be spent and unbound, and re-bound on the new chain to a new UTXO on that chain.
Token UTXO Binding
Bitcoin's basic transaction unit is the UTXO, and each bound UTXO is assigned a type and quantity of tokens via the protocol. Unlike colored coins, the quantity of Satoshi in a UTXO is independent of the quantity of NOTE protocol tokens and is not limited by the quantity of Satoshi. Binding tokens with UTXO helps avoid various complexities caused by Bitcoin's block reorganization and RBF (Replace By Fee).
Token UTXO Unbinding
Tokens in an unbound state cannot be directly transferred; they need to be bound on a specific blockchain.