A Merkle tree is a binary tree of cryptographic hashes in which every leaf holds the hash of a data item and every internal node holds the hash of its two children, so that a single Merkle root at the top commits to the entire data set. In blockchain fundamentals it is the structure that binds all transactions of a block to the block header, which allows any participant to verify that one transaction is included without downloading the whole block.
The idea dates back to Ralph Merkle’s work on digital signatures in the late 1970s, long before Crypto & blockchain systems existed. Bitcoin adopted it to keep block headers small, and nearly every later public blockchain uses a Merkle tree or one of its variants to commit to transactions, receipts or account state.
How a Merkle tree is built
A Merkle tree is built bottom-up by repeated pairwise hashing. Each transaction is first hashed to produce a leaf. Adjacent leaves are then concatenated and hashed again to form their parent, and the process repeats level by level until only one hash remains, the Merkle root.
In Bitcoin the hash function is double SHA-256, and when a level has an odd number of nodes the last node is duplicated so that it can be paired. Because each parent depends on both children, changing even one bit in any transaction changes its leaf, every ancestor above it and finally the root. The root therefore acts as a compact fingerprint of the full transaction list and its order.
The table describes the elements of the structure and their role.
| Element | Content | Role |
|---|---|---|
| Leaf node | Hash of one transaction | Represents a single data item |
| Internal node | Hash of two child hashes | Links lower levels together |
| Merkle root | Single top-level hash | Commits to the whole set in the header |
| Sibling hash | Neighbor at each level | Needed to recompute a path upward |
| Merkle path | Ordered list of sibling hashes | Forms the inclusion proof |
Merkle proofs and light node verification
A Merkle proof, also called an inclusion proof, shows that a specific transaction belongs to a block by supplying only the sibling hashes along its path to the root. The verifier hashes the transaction, combines it step by step with the provided siblings and checks whether the result equals the Merkle root stored in the block header.
The efficiency is the point. For a block of n transactions, a proof contains only about log2(n) hashes. A block with roughly 4,000 transactions needs about 12 sibling hashes, which is under 400 bytes with 32-byte hashes, compared with the full block of one to several megabytes. This is what makes Simplified Payment Verification (SPV), described in the Bitcoin white paper, practical for wallets and light nodes.
The following table shows how proof size grows with the number of transactions.
| Transactions in block | Tree depth | Proof size |
|---|---|---|
| 16 | 4 levels | 128 bytes |
| 1,024 | 10 levels | 320 bytes |
| 4,096 | 12 levels | 384 bytes |
| 1,048,576 | 20 levels | 640 bytes |
A light node still has to trust that the header belongs to the valid chain with the most work, so it downloads and checks all block headers. The Merkle proof only answers inclusion; it does not prove that the transaction is valid or that the block will not be reorganized away.
Variants used by different blockchains
Different blockchains adapt the basic structure to what they need to commit to. Bitcoin commits only to an ordered transaction list, whereas account-based chains also need to commit to a large and constantly changing global state, which requires a tree that supports efficient updates and key lookups.
| Variant | Typical use | Key property |
|---|---|---|
| Binary Merkle tree | Bitcoin transaction commitment | Simple, compact inclusion proofs |
| Merkle Patricia trie | Ethereum state, transactions, receipts | Key-value lookups with path compression |
| Sparse Merkle tree | State commitments and non-membership | Fixed positions for every possible key |
| Merkle mountain range | Append-only histories | Cheap appends without rebuilding |
| Verkle tree | Proposed Ethereum state upgrade | Much smaller proofs via vector commitments |
Bitcoin’s SegWit upgrade added a second Merkle commitment for witness data, placed inside the coinbase transaction, so that signatures are committed without changing how the original transaction identifiers are computed.
How it fits with related blockchain concepts
A Merkle tree is one layer in a chain of commitments. Each block header contains the Merkle root of its transactions and the hash of the previous header, so the header chain secures the roots, and the roots secure every transaction. The comparison below separates the Merkle tree from neighboring ideas that are often confused with it.
| Concept | What it secures | Relationship |
|---|---|---|
| Merkle tree | Set of items inside one block | Produces the root stored in the header |
| Hash chain of blocks | Order and history of blocks | Links headers, each holding a root |
| Block header | Metadata and commitments | Carries the Merkle root and previous hash |
| UTXO set | Currently spendable outputs | Not committed by a Merkle root in Bitcoin |
| Full node validation | Correctness of every rule | Goes beyond inclusion proofs |
The distinction between inclusion and validity is the most important practical lesson: a light node relying on Merkle proofs inherits weaker security guarantees than a full node that executes every transaction.
Limitations and known pitfalls
Merkle trees are robust, but their security depends on careful implementation details. Several historical bugs came not from the hash function but from how trees were constructed or interpreted.
- Duplicate-leaf ambiguity: Bitcoin’s rule of duplicating the last odd node allows two different transaction lists to share one root, which was assigned the identifier CVE-2012-2459 and is mitigated by extra validation checks.
- Leaf and node confusion: without domain separation (different prefixes for leaves and internal nodes), an internal node can sometimes be presented as a leaf; Certificate Transparency in RFC 6962 adds such prefixes for this reason.
- No non-membership proof in a plain binary tree: proving that a transaction is absent requires sorted or sparse variants.
- Data availability: a root proves commitment, not that the underlying data was published, which is a central concern for rollups and scaling designs.
Hash collisions are not a practical risk with SHA-256 or Keccak-256 today, so most real failures come from protocol design and parsing errors rather than broken cryptography.
In everyday language
Imagine summarizing a thick binder of receipts with one short code. Pairs of receipts are summarized together, then pairs of summaries, until a single code stands for the whole binder. If anyone changes a single receipt, that final code changes too.
This lets someone check one receipt without reading the entire binder. They only need the few summaries along the way up, which is why phones and small wallets can confirm a payment quickly without storing the entire blockchain.
Seen in the real world
A mobile Bitcoin wallet receives a payment from a customer at a small online shop. The wallet does not store the full blockchain, which exceeds several hundred gigabytes; it keeps only the chain of 80-byte block headers, which takes well under 100 megabytes.
When the transaction is mined into a block containing about 3,000 transactions, the wallet asks a connected server for a Merkle proof. The server returns 12 sibling hashes, under 400 bytes of data. The wallet hashes the transaction, combines it with the siblings in order and obtains a value matching the Merkle root in the header it already holds.
The shop owner sees the payment as confirmed within seconds of the block arriving, and after several further blocks are added on top, treats it as settled, all without running a full node.