A Commitment-suitable UTXO set "Balances" file data structure



Summary:

The proposed Commitment-suitable UTXO set "Balances" file data structure allows pruned nodes to satisfy SPV nodes and trustlessly start synchronizing at a Balances file's block height instead of the genesis block. All nodes in the network can verify their UTXO set's data integrity through this structure. For this to work, Bitcoin would need a new policy where a UTXO commitment is made every "Balances/UTXO Commitment Period" (BCP) blocks. The UTXO commitment is made on the state of the UTXO at BCP blocks ago, and the file/commitment is made in a background thread, starting at least BCP/2 blocks after the last block containing a utxo commitment.The Balances file summary consists of a header, balances, balance index, and merkle tree hashes. Balances are listed by txid while a piece is like bittorrent's piece. A "piece size" of 32*1024 bytes is proposed. Transaction index is an array of elements that include the first N bytes of a txid and piece offset. Merkle tree hashes consist of leaf hashes, node hashes, or copying up if only one child.Data structure design notes suggest that the piece size should be small enough that not much effort is wasted when invalid pieces are received. Piece size should also be small in the case that this data structure is used instead of block history for SPV proof. The child count = 2 merkle tree structure is only necessary if this data structure is to be used to satisfy SPV clients. If not used for such a purpose, then technically the root hash could have the leaf hashes as its direct children. The balance index only serves to support SPV clients.Other notes suggest making BCP 5000 blocks, which would allow more frequent checks on UTXO set integrity and permit new pruning nodes to start syncing closer to the tip. The suggested design change to the chainstate "CCoinsViewDB" utxo database proposes changing the "CCoins" data structure so that it can keep track of spends that shouldn't be included in the commitment. Vtipspends could hold {vout_ix, blockhash } instead of just vout_ix.


Updated on: 2023-05-20T01:02:16.784906+00:00