4

If the transaction history's Merkle tree were pruned to remove all transactions that have been completely spent, what would be the size of the transaction history in comparison to its current size? (In percent of total size.)

2

Note that transaction history is not stored in a tree nor is there a Merkle tree for all of the transactions in the blockchain. Merkle trees are only used for constructing the merkle root in blocks and constructing transaction inclusion proofs for SPV nodes.

If you reduce the blockchain to only the data absolutely needed for a node to verify new transactions, you end up with a node that just has the UTXO set. The state of the blockchain boils down to simply the set of all Unspent Transaction Outputs. This is because in addition to spent transactions, it is unnecessary for nodes to store transaction inputs (they are only needed for validation, so after validation, they can be discarded), other outputs in a transaction that have been spent, and transaction overhead data (such as version number and locktime).

As of block 688004, my node has a UTXO set size of approximately 4.5 GB. Note that there may be optimizations in the way this is serialized so that it is more compressed that it would be if you extracted them directly from transactions, but these optimizations should not cause a significant reduction.

Storing the UTXO set and using that for validation is actually an optimization that Bitcoin Core and some other node software do today. This enables faster validation and a more efficient way to prune the blockchain. By having the UTXO set separate from the blockchain, a pruned node can just delete the majority of previous blocks and still be able validate new transactions through the UTXO set.

Of course it is not safe to only have a node store just the UTXO set and discard all blocks after validation. If there is a blockchain reorganization, the node will need to be able to rollback the UTXO set changes made by the block being removed from the main chain. As such, it is necessary for pruned nodes to store some blocks so that it can perform this undo operation when necessary. Because blockchain reorgs tend to be short (there have not been reorgs of 2 or more blocks in a very long time) and rare, Bitcoin Core's default is to store 1 days worth of blocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.