Issuing Taproot Assets
When issuing a Taproot Asset the minter (person that creates the asset) creates a Sparse Merkle Sum Tree. In this tree the minter assigns assets to different addresses by adding a value to each leaf that represents a holder address.
The root of this tree is then stored in a leaf of the asset tree.
Each Asset has an asset ID, a 32 bytes identifier. The id is calculated by hashing the genesis outpoint, the asset tag and asset meta data. It points to the leaf in the asset tree. The root of the Asset tree is added to a Taproot script by inserting it into the script path.
From this script, the Assed ID, the internal key, the human readable prefix (hrp) and the amount, the Taproot asset address is calculated by hashing these values.
The root hash of the upper tree (asset tree) is included in the Taproot MAST and thus part of the script path of the Taproot outputs. Thanks to the asset tree, it is possible to create many assets within a single Bitcoin transaction.
A Taproot asset is created through an on-chain transaction by committing to a Merkle Sum Sparse Merkle Tree that holds the asset information (public key and amount).
To transfer a Taproot asset, the owner initiates the transfer by creating a new Merkle Sum Sparse Merkle Tree that reflects the new balances. The sender reduces their balance by the amount sent and increases the receiver’s balance by the same amount.
The leaves are identified by the public keys of the sender and receiver. Since the amount of assets must remain constant, the sum at the root of the sparse Merkle sum tree does not change.
The new tree is then published via an on-chain transaction.
Assets are stored in asset trees, also known as TAP trees (TAP = Taproot Asset Protocol). These are Merkle Sum Sparse Merkle Trees. Their leaves contain the Asset ID. For each asset ID, a new tree can be created containing the owners and values of that particular asset.
The leaves of the lower tree contain the amount of that particular asset held by a user (defined by their public key).