Merkle tree
A tree of hashes where each parent hashes its children, so one root hash vouches for a whole dataset and any item can be proven with a few hashes.
A Merkle tree hashes every item (a leaf), then hashes pairs of hashes level by level until one hash is left: the root. Change one byte anywhere and the root changes. It is named after Ralph Merkle, who described it in a 1987 paper on digital signatures, and it is built from a cryptographic hash function.
The useful trick is the inclusion proof. To show that one item is in the set, you hand over the item and the sibling hashes along its path to the root; anyone can recompute the root and compare it with the published one. The proof grows with the logarithm of the set size, so a million items need about 20 hashes, and it reveals nothing about the other items beyond their hashes.
You meet Merkle trees in more places than blockchains. Git identifies files, folders and commits by hashes of their content (Git internals), Certificate Transparency logs use them to prove a TLS certificate was logged (RFC 9162), and exchanges use them for the liabilities side of proof of reserves. Databases and sync tools compare Merkle roots to find which parts of two copies differ without sending everything.
Sources
- Springer (CRYPTO ’87): Merkle, A Digital Signature Based on a Conventional Encryption Function doi.org
- Pro Git: Git Internals, Git Objects git-scm.com
- RFC Editor: RFC 9162, Certificate Transparency Version 2.0 rfc-editor.org
Related terms
- Cryptographic hash function (SHA-256): A function that turns any data into a short fixed-size fingerprint that is practically impossible to reverse or to match with different data.
- Proof of reserves: Evidence that an exchange or issuer actually holds the assets it owes its customers, often with on-chain proofs and an auditor’s check.
- DAG (directed acyclic graph): A graph of steps with one-way arrows and no loops, so the steps can always be put in an order that respects every dependency.
- Big O notation: Shorthand for how the work an algorithm does grows as its input grows, such as O(1), O(log n), O(n) or O(n²).
- SBOM (software bill of materials): A machine-readable list of every component and version inside a piece of software, like an ingredients label.
