LearnAdvanced

Merkle Trees in Blockchain: Structure, Proofs & Ethereum State

Merkle trees are the cryptographic backbone of blockchain. Master hash trees, Merkle proofs for SPV verification, Patricia Merkle Tries (Ethereum state root), Merkle airdrops, Merkle Mountain Ranges, and Verkle trees roadmap for stateless clients.

Updated: April 10, 2026Reading time: 19 min
D
DegenSensei·Content Lead
·
Apr 10, 2026
·
Updated Apr 12, 2026
·
19 min read

What is a Merkle Tree?

A Merkle tree is a binary tree of hash values where each leaf node contains the hash of a data block (e.g., transaction), and each parent node contains the hash of its two children. The Merkle root (top node) is a single hash that depends on every leaf below it. Change one bit in any leaf, and the entire root changes. This elegantly provides proof of data integrity.

💡Why This Matters

This is one of those topics where surface-level understanding is dangerous. We've seen traders lose significant capital from misconceptions covered in this guide.

Merkle trees were invented by Ralph Merkle in 1979 and became foundational to cryptography. Bitcoin uses Merkle trees to efficiently summarize all transactions in a block. Ethereum uses a variant (Patricia Merkle Trie) to store the entire state of accounts and balances.

Merkle Tree Structure & Building

Building a Simple Merkle Tree

Suppose you have 4 transactions: TxA, TxB, TxC, TxD. Step 1: Hash each: H(TxA), H(TxB), H(TxC), H(TxD). Step 2: Pair and hash: H(H(TxA) + H(TxB)) = HAB, H(H(TxC) + H(TxD)) = HCD. Step 3: Hash the hashes: H(HAB + HCD) = Merkle Root. The root is 32 bytes; it represents all 4 transactions.

Key Properties

Deterministic: same data always produces the same root. Efficient: 4 transactions → 1 hash. Avalanche effect: changing 1 bit in TxA completely changes H(TxA) → changes HAB → changes Merkle root. Asymmetry: proving what's in the tree is easy (Merkle proof); finding collision is hard (preimage resistance).

Example Tree (4 Transactions):
  • Root: 0x3f9d...
  • / \
  • 0xab... 0xcd...
  • / \ / \
  • 0x01 0x02 0x03 0x04
  • | | | |
  • TxA TxB TxC TxD

Merkle Proofs Explained

What is a Merkle Proof?

A Merkle proof is a minimal set of hashes proving that a specific transaction is part of the tree. Instead of downloading all transactions, you provide log(n) hashes. For a tree with 1024 transactions (10 levels), a Merkle proof is just 10 hashes (320 bytes), not 1024 transactions (~32 KB).

How Merkle Proof Works

To prove TxA is in tree: provide H(TxB), H(CD), H(TxA). Verifier: Recalculate H(H(TxA) + H(TxB)) = 0xab, then H(0xab + 0xcd) = Root. If calculated root matches known root, TxA is proven in tree. No need to know TxC or TxD.

Proof Size Efficiency

1,000 txs: ~10 hashes (320 bytes). 1 million txs: ~20 hashes (640 bytes). 1 billion txs: ~30 hashes (960 bytes). Proof size grows logarithmically, enabling light clients to verify transactions without downloading full blocks.

Merkle Root in Block Headers

Bitcoin Block Header

Every Bitcoin block header (80 bytes) contains a Merkle root field. The root is the hash of all transactions in the block. When a node receives a block, it verifies: Merkle(all transactions) == declared Merkle root in header. If someone tries to modify a transaction, the proof fails.

Ethereum Block Header

Ethereum block headers don't have a "Merkle root" field for transactions (unlike Bitcoin). Instead, Ethereum uses transaction list hash (keccak256 of RLP-encoded txs). The state root is the root of the Patricia Merkle Trie (see next section). Block header contains state root, which proves all account balances, nonces, code.

Bitcoin Header Content (80 bytes):
  • Version: 4 bytes
  • Previous block hash: 32 bytes
  • Merkle root: 32 bytes
  • Timestamp: 4 bytes
  • Difficulty: 4 bytes
  • Nonce: 4 bytes

SPV (Simplified Payment Verification)

How SPV Works

SPV allows light clients (mobile phones) to verify transactions without downloading entire blockchain. Strategy: (1) Download only block headers (~80 bytes each). (2) When you receive a payment, get Merkle proof from a node. (3) Verify proof against Merkle root in header. (4) Trust proof of work—if chain is long and accumulates work, proof is secure.

Security Model

SPV security relies on proof of work. An attacker would need to recompute all blocks since your transaction (thousands of blocks, quadrillions of hashes). Economically infeasible. If attacker tries double-spend in recent block, proof of work hasn't accumulated—you wait for block confirmations (6+ blocks = ~1 hour for Bitcoin).

Limitations

SPV doesn't verify the rules (e.g., is 100 BTC creation valid?). Only miners do. SPV trusts that the longest chain is the valid one. Privacy risk: SPV client queries which transactions belong to you. Bloom filters help but aren't perfect.

Patricia Merkle Tries (Ethereum State)

Why Patricia Tries?

Ethereum must store state: account balances, nonces, code hashes. A simple Merkle tree would require rehashing entire state after every transaction (slow). Patricia Merkle Tries (PMT) are prefix trees where only affected branches change. Update one account balance? Only hash the branch to that account. Much more efficient.

How PMT Works

Ethereum account address is a path through the trie. Example: address 0x123abc... becomes path 1→2→3→a→b→c... in the trie. Leaf is account data (balance, nonce, code hash). Parent nodes are hashes. The root of the trie is the state root. Every block has new state root (proves execution happened).

State Root and Consensus

All Ethereum nodes execute the same transactions in the same order and must arrive at the same state root. If state root differs, consensus is broken. Miners/validators that disagree are slashed or orphaned. State root is the ultimate proof that a chain is valid.

PMT Efficiency:
  • Ethereum state: ~15 million accounts
  • Simple Merkle tree: rehash all 15M after each tx (slow)
  • Patricia Merkle Trie: update 1 branch (~16 nodes) per account change (fast)
  • Current state DB: ~600 GB (archive node)

Merkle Airdrops & Token Claims

Merkle Airdrop Mechanism

Traditional airdrop: store allowlist of 100,000 addresses on-chain (huge gas, verification slow). Merkle airdrop: compute Merkle tree of all addresses, store only Merkle root on-chain (256 bits). Claimants provide their leaf and Merkle proof. Smart contract verifies proof and transfers tokens. Gas: constant regardless of list size.

Example Airdrop

Protocol airdrop: 1 million users eligible, 1 USDC each. Compute Merkle tree (1M leaves). Store root: 0x4a2b... on contract. User calls claim(amount, proof=[0xh1, 0xh2, 0xh3...]). Contract hashes user's leaf, verifies proof against root. If valid, transfer 1 USDC. Gas cost: ~40k gas per claim (constant), not ~1M x storage (would be O(n)).

Popular Projects

Uniswap UNI airdrop used Merkle trees. Optimism OP airdrop used Merkle trees. Most ERC-20 airdrops post-2021 use Merkle trees. Standard practice for efficient distribution.

Tree Type Comparison Table

Tree TypeUsed InProof SizeUpdate CostPurpose
Merkle TreeBitcoin txsO(log n)O(log n)Verify tx inclusion
Patricia Merkle TrieEthereum stateO(log n)O(log n)Store account state
Merkle Mountain RangeAppend-only logsO(log² n)O(1)Efficient appends
Sparse Merkle TreeZero-knowledge proofsO(log n)O(log n)Membership in sparse set
Verkle TreeEth roadmapO(1) (~1-2KB)O(log n)Stateless clients

Merkle Mountain Ranges

What is an MMR?

Merkle Mountain Ranges (MMR) are a data structure for append-only logs (blockchains, transaction history). Unlike Merkle trees which require rebalancing on insert, MMRs append in O(1) time. Verification still O(log n).

How MMR Works

Instead of a binary tree, MMR has multiple complete binary trees (mountains). When you add a leaf, it becomes a new mountain. When two mountains of same height exist, they merge (combine hashes). Efficient: append is just stack operation, no rebalancing.

Use Cases

Blockchain light clients: verify blocks with minimal state. Append-only logs: transaction history, audit trails. Grin blockchain uses MMRs extensively.

Verkle Trees & Ethereum Roadmap

What are Verkle Trees?

Verkle (Vector commitment) trees are the successor to Patricia Merkle Tries. Instead of storing hashes in a tree, Verkle uses vector commitments (cryptographic accumulators). Proof size shrinks from ~1-2 KB (Merkle proof) to 1-2 KB (Verkle proof, but worse compression currently). Future: Verkle proofs with better cryptography will be <200 bytes.

Why Verkle?

Current Ethereum state is ~600 GB (archive node). Verkle enables stateless clients: nodes that don't store state, only verify proofs. Reduces disk requirements from GB to MB. Proof size is constant regardless of state size. Ethereum roadmap: introduce Verkle trees post-Dencun (2024-2025 target).

Implementation Status

Still experimental. KZG commitments (used for EIP-4844 blob data) are foundation. Verkle tree implementation in progress. Expected to reduce state bloat and enable <1GB full nodes by 2026.

Ethereum State Roadmap:
  • Current: Patricia Merkle Trie, ~600 GB state
  • 2024-2025: Verkle trees proposed
  • 2025+: Stateless clients possible
  • Long-term: <1 GB full nodes, massive scalability gains

FAQ

What is a Merkle tree?

A Merkle tree is a binary tree of hashes where leaf nodes are data (transactions), and each parent node is the hash of its children. The root hash (Merkle root) depends on all descendants. Single bit change in any leaf changes the entire root. This enables efficient data integrity verification.

What is a Merkle proof?

A Merkle proof is a minimal set of hashes needed to prove that a specific leaf is part of the tree. Instead of downloading entire tree, you provide log(n) hashes (for n leaves). Example: 4-level tree with 4096 leaves requires only 12 hashes (proof) to verify one leaf.

What is SPV?

SPV (Simplified Payment Verification) is light client verification using only block headers. Download headers, verify transaction Merkle proof against Merkle root in header. Proof of work provides security without downloading full blocks. Bitcoin SPV is foundation of mobile wallets.

What are Patricia Merkle Tries?

Patricia Merkle Tries (PMT) are prefix trees where Ethereum stores account state (balances, nonces, code). Each account address is a path; leaf is account data. Ethereum state root is the PMT root. Every tx changes the state root (proving execution happened). Update cost: O(log n) instead of O(n).

What are Merkle airdrops?

Merkle airdrop uses a whitelist stored as Merkle tree root on-chain. Claimants provide leaf proof to claim. Smart contract verifies proof once; no need to store entire list. Gas-efficient: O(1) cost to verify vs O(n) for array. Uniswap and Optimism used Merkle airdrops.

What are Verkle trees?

Verkle (Vector commitment) trees are the next evolution. Replace Merkle proofs with vector commitment proofs (1-2 KB vs 50+ KB). Ethereum Verkle Trees roadmap aims to reduce state bloat and enable stateless clients (nodes that don't store 600 GB state, only verify proofs).

Disclaimer: This content is for informational purposes only and does not constitute technical specification or implementation guidance. Merkle tree cryptography is well-established, but implementations vary across projects. Always verify implementation details before using in production. Verkle trees are still experimental; do not rely on production systems until standardized. Consult official specifications and academic papers for authoritative sources.

Educational disclaimer: This guide is for informational purposes only and does not constitute financial advice. Crypto involves significant risk — do your own research before making any decisions. Learn more about our team.

Educational disclaimer: This guide is for informational purposes only and does not constitute financial advice. Crypto involves significant risk — do your own research before making any decisions. Learn more about our team.