BeCuriouzLearn something new every day
How a blockchain proves one transaction without downloading the whole chain
💡 A Merkle tree collapses thousands of transactions into one root hash, letting anyone prove a single transaction is included with just a short path of sibling hashes instead of the whole block.
Every block on a blockchain can hold thousands of transactions, yet a lightweight wallet on your phone can verify that your payment is inside a block without downloading all of them. The trick is a data structure called a Merkle tree (or hash tree), named after cryptographer Ralph Merkle.
It works by hashing in layers. Each transaction is run through a cryptographic hash function to produce a fixed-size fingerprint. Those fingerprints are then paired up and hashed together, and the results are paired and hashed again, layer by layer, until a single hash remains at the top: the Merkle root. That one root — stored in the block header — commits to every transaction below it. Change a single byte in any transaction and its hash changes, cascading upward and altering the root.
The payoff is a Merkle proof. To prove transaction A is in the block, you don't need all the data — just A plus the handful of "sibling" hashes along the path to the root (here, Hash B and Hash CD). Recompute up the tree, and if you land on the same root, A is genuinely included. For a block with a million transactions, that's roughly 20 hashes instead of a million — the logarithmic magic that makes lightweight verification, used by Bitcoin's SPV clients, possible.