- Series
- Blockchain explained
- Lesson
- 04 of 06
- Edition
- November 2026
- References
- 3
Merkle trees: one hash for many transactions
Abstract
A Merkle tree hashes transactions in pairs, then pairs of pairs, up to a single root. A handful of hashes is enough to prove that one transaction is in a block.
Key points
- The leaves are the hashes of the transactions, each parent is the hash of its two children, and the top is the root.
- The block header stores only the root, yet the root changes if any transaction changes.
- A proof of inclusion needs one hash per level, about log₂(n): 12 hashes for 4,000 transactions.
- When a level has an odd number of nodes, Bitcoin pairs the last node with a copy of itself.
LimitsWhere this toy model differs from the real system: Limits
Hashing in pairs
Start from the transactions of a block and hash each one: these are the leaves. Join the leaves two by two and hash each pair, then do the same with the results, until a single hash is left: the Merkle root. Bitcoin uses double SHA-256 at every step.
The block header contains only the root, not the transactions. Because every hash depends on the ones below it, changing a single transaction changes its leaf, its parent and every hash up to the root, and the header no longer matches.
Figure 1Try it: Merkle tree
Pick a transaction to see its proof
3 hashes prove that 1 of 6 transactions is in the blockThe proof rebuilds the root
Root a4850c0cc8e65fa08872ab01d9dc8b6105705f9e9b37f369f21261473ef0b292
This widget needs JavaScript. The text of the lesson explains the same idea without it.
Pick a transaction: the filled nodes are its path to the root, and the amber ones are the proof, the sibling hashes needed to rebuild the root. Edit a transaction and its whole path changes.
Proving one transaction without the others
To show that a transaction is in a block you do not need all the other transactions: the sibling hashes along its path are enough. Whoever checks hashes the transaction with the first sibling, the result with the next one, and so on. If the last hash equals the root in the block header, the transaction is in the block.
The proof grows with the number of levels, not with the number of transactions. The Bitcoin whitepaper calls this simplified payment verification: a light wallet keeps only the block headers and asks the network for proofs.
Limits
Sources
Primary sources this lesson is based on.