Merkle Root
1 min read
The Merkle root is the final node in a Merkle tree. It is a hash which includes all other hashes in the tree. If a single hash is altered within a tree, this change will ripple upwards, changing the Merkle root completely.
Merkle roots are used in Bitcoin as efficient commitments to large data sets. The Merkle root of all transaction IDs (txids) in a block is included in the block header, so that if the Merkle root changes, the Proof-of-Work is rendered invalid. This setup ensures that once a block is published, no transaction within the block can be altered. The Merkle root of all SegWit txids (wtxids) is included in an output of the coinbase transaction in order to ensure the same level of immutability for SegWit transactions. Merkle roots are also used by MAST scripts to send bitcoin to several different scripts.