A Bitcoin block may contain thousands of transactions, but its header is only 80 bytes long. The Merkle tree is what makes it possible to “lock in” every transaction in the block using just this small amount of data.

Coin mentioned in the article: $BTC quoted at 77,358.01 (24h -0.61%).

【What Kind of Tree?】

A Merkle tree is a tree-shaped structure that hashes large amounts of data in pairs and combines them layer by layer. The bottom layer contains the hash of each transaction. Each pair of adjacent hashes is concatenated and hashed again to produce the next layer. This process continues until only one hash remains, called the Merkle root.

This structure is named after cryptographer Ralph Merkle. It was proposed in the late 1970s, long before blockchains.

【Why changes can’t go unnoticed】

Bitcoin’s block header contains the Merkle root. If any transaction in a block is changed, its hash changes. That change propagates up to the Merkle root, which changes the block hash, making all subsequent blocks invalid.

So keeping an eye on this one hash in the block header is equivalent to keeping an eye on every transaction in the block.

【How lightweight wallets verify transactions】

To prove that a transaction is in a particular block, you don’t need the whole block—just a small number of hashes along the path from the transaction to the Merkle root. If the number of transactions doubles, you need only one additional hash. For a block with thousands of transactions, a dozen or so hashes are enough.

Simplified Payment Verification (SPV), described in Section 8 of the Bitcoin white paper, works this way: a lightweight client stores only block headers, then requests a Merkle path from a node to confirm that a transaction has been included in a block.

【Use in proof of reserves】

Exchanges also use Merkle trees for proof of reserves: the platform organizes all users’ balances into a Merkle tree and publishes the root hash. Each user receives their own path and can verify for themselves that their balance has been included, without anyone else’s details being made public.

【In a nutshell】

The idea behind a Merkle tree is simple: use a short root hash to represent a large amount of data. This design is what makes applications like mobile wallets and proof of reserves possible. Market conditions are always uncertain, so think ahead about what you’ll do if you’re wrong.

If you found this useful, save it so you can revisit it later.