Merkle Tree
Build a hash tree from data blocks, generate inclusion proofs, and detect tampering.
How Merkle trees work
A Merkle tree is a binary tree of hashes. Each leaf node holds the hash of a data block, and each internal node holds the hash of its two children concatenated together. The root hash at the top is a fingerprint of all the data — change a single byte in any block and the root hash changes.
Hash cascade
When you edit a data block above, the leaf hash changes. That change cascades up through each parent to the root, because every parent depends on its children's hashes. Try editing a block and watch the orange highlights ripple upward — that's the cascade in action.
Merkle proofs
Here's the clever part. To prove that a specific block is included in the tree, you don't need all the data — just the sibling hashes along the path from that leaf to the root. For 8 blocks (depth 3), that's only 3 hashes. For a million blocks, it's about 20 hashes. That's the power of logarithmic scaling.
Click "Generate Proof," then click a leaf to see exactly which sibling hashes are needed. "Verify Proof" walks through the computation step by step.
Tamper detection
Click "Tamper" to randomly change a block. The cascade turns red and the root hash no longer matches what you'd expect. Anyone who knows the original root can detect that something changed, without needing to download all the data.
Where you'll find them
Merkle trees are everywhere in systems that need to verify data integrity efficiently. Git uses them for its object store — each commit references a tree hash. Bitcoin and Ethereum use them so light clients can verify a transaction was included in a block without downloading every transaction. Certificate Transparency logs use them, IPFS uses them for content-addressed storage, and distributed databases use them to detect replica divergence.