Merkle Proof
A short path of hashes proving an item is in a block without the whole block.
Basically
A Merkle proof shows that a transaction belongs to a Bitcoin block. You check a few hashes instead of downloading the whole block.
Key Takeaways
- A Merkle proof is the minimal set of sibling hashes needed to verify that a piece of data belongs to a Merkle tree. For a block with N transactions, the proof requires only log2(N) hashes, roughly 10 hashes for 1,000 transactions.
- SPV clients use Merkle proofs to confirm transactions without downloading full blocks. This reduces storage from gigabytes to megabytes while preserving cryptographic assurance.
- Merkle proofs do more than verify transactions. They also underpin Taproot script-path spending, the Utreexo accumulator, and cross-chain bridge verification.
What Is a Merkle Proof?
A Merkle proof, also called a Merkle path or authentication path, is a compact cryptographic proof that a specific piece of data belongs to a larger dataset organised as a Merkle tree. You need only the target data, a short list of sibling hashes, and a trusted root hash instead of downloading and checking every item.
Ralph Merkle originated the concept and filed a patent in 1979 describing tree-based hash structures. Satoshi Nakamoto applied Merkle proofs to Bitcoin in Section 8 of the whitepaper, titled "Simplified Payment Verification", so lightweight clients could verify transactions without running a full node.
Bitcoin block headers each contain a 32-byte Merkle root that commits to every transaction in the block. A Merkle proof links one transaction to that root, so anyone with the block header can verify its inclusion.
How It Works
Bitcoin builds a Merkle tree from all transactions in a block using SHA-256d, or double SHA-256. Each transaction is hashed into a 32-byte txid, these txids form the leaf layer, and adjacent leaves are paired and concatenated into 64 bytes before being double-hashed into a parent node. The process repeats upward until one 32-byte Merkle root remains.
Transaction T can be proved to exist in a block by supplying the sibling hashes at each level along its path to the root. You hash T with each sibling in turn and follow the path upwards.
The transaction is provably included when the computed root matches the block header's Merkle root. Any tampering with a transaction or a hash along the path produces a different root.
Proof Size and Efficiency
Merkle trees have a logarithmic structure that keeps proofs remarkably compact. For a block with N transactions, the proof requires exactly log2(N) sibling hashes, each 32 bytes long.
A typical Bitcoin block contains 1,500 to 2,000 transactions and weighs roughly 1 MB. A Merkle proof for any single transaction in that block is approximately 352 bytes, a compression ratio of roughly 3,000 to 1.
Verification Example
A block with four transactions, T0 through T3, has a small Merkle tree. The tree pairs their hashes and continues upwards to the root.
Only two hashes are needed because log2(4) = 2. The number stays the same regardless of how many other transactions the block contains.
Handling Odd Transaction Counts
Bitcoin duplicates the last hash when a tree level has an odd number of hashes, forming an even pair before hashing upward. This duplication can occur at every level, not just the leaf layer. The tree stays balanced, but the method introduces a subtle attack surface discussed in the risks section below.
Simplified Payment Verification (SPV)
SPV is the primary use case for Merkle proofs in Bitcoin. As described in the whitepaper, a lightweight client stores only block headers of 80 bytes each, approximately 4.2 MB per year, instead of the entire blockchain, then requests a Merkle proof from a full node and checks it against the block header when it needs to verify a transaction.
Mobile wallets and resource-constrained devices can verify payments with cryptographic confidence through this approach. For a deeper look at SPV security tradeoffs and modern alternatives like compact block filters, see the Bitcoin light clients and SPV explained research article.
Taproot Script-Path Spending
Taproot, defined in BIP 341, uses Merkle proofs in its Merklized Alternative Script Trees, or MAST. A Taproot output commits to a tree of spending scripts, and a spender using the script path reveals only the executed script leaf and a Merkle proof called the control block that links it to the committed root, leaving other script branches hidden to improve privacy and efficiency.
The control block contains the internal public key of 33 bytes plus the Merkle path at 32 bytes per level, up to 128 levels deep. Tagged hashes provide domain separation and prevent the leaf-node confusion vulnerability present in the original Bitcoin Merkle tree.
Utreexo: UTXO Set Compression
Utreexo, proposed by Tadge Dryja, replaces Bitcoin's in-memory UTXO set of approximately 4 GB containing over 60 million UTXOs with a Merkle forest accumulator whose state fits in less than 1 KB. A spender includes a Merkle inclusion proof when a transaction spends a UTXO, demonstrating that the UTXO exists in the accumulator.
A Utreexo node stores only the tree roots and verifies proofs on the fly instead of storing the entire UTXO set, dramatically reducing the resources needed to run a full node. The tradeoff is approximately 20-25% additional bandwidth overhead for transmitting proofs during initial block download, dropping to roughly 12% with caching.
Cross-Chain Bridge Verification
Merkle proofs enable trustless verification across blockchains. A bridge contract on a destination chain can verify that a transaction occurred on the source chain by checking a Merkle proof against a relayed block header. This pattern removes the need for trusted multisignature committees or oracle sets, which have historically been the source of major bridge exploits.
SegWit Witness Commitment
SegWit, defined in BIP 141, introduced a second Merkle tree alongside the original transaction tree. This witness Merkle tree is computed from witness txids, or wtxids, and its root is embedded in the coinbase transaction as an OP_RETURN output. The design maintains backward compatibility while committing to witness data within the existing block structure.
Why It Matters
Merkle proofs are foundational to Bitcoin's scalability and accessibility. Without them, every participant would need to download and store the entire blockchain to verify any transaction, while Merkle proofs let lightweight clients on mobile devices achieve meaningful security guarantees with minimal resources.
Merkle proofs become even more critical as Bitcoin's block history grows and the UTXO set expands. Technologies like Utreexo and compact block filters build on Merkle proof primitives to keep node requirements manageable, and Layer-2 solutions including Spark benefit from the same principle: compact cryptographic proofs can verify state without requiring every participant to process every piece of data.
Merkle Tree Mutation (CVE-2012-2459)
Bitcoin's duplication of the final hash at a tree level with an odd number of elements means an attacker could construct an invalid block containing a duplicated final transaction that produces the same Merkle root as the valid block. A node that cached the rejection of the invalid block would also reject the valid one, potentially causing network partitions. Bitcoin Core 0.6.1 fixed this vulnerability before any known exploitation.
Leaf-Node Confusion (CVE-2017-12842)
Bitcoin's Merkle tree uses the same hashing function for leaf nodes and internal nodes, with no domain separation. A specially crafted 64-byte transaction could be misinterpreted as an internal node made of two concatenated 32-byte hashes, enabling fabricated Merkle proofs that appear valid to SPV clients. Full nodes are immune because they validate the complete tree.
The proposed mitigation is banning 64-byte transactions, discussed as part of the Great Consensus Cleanup soft fork proposal. Modern Merkle tree designs, including Taproot's tagged hashes and the RFC 6962 standard used in Certificate Transparency, use distinct prefixes for leaf and internal hashes. These prefixes prevent this class of attack.
SPV Trust Assumptions
A Merkle proof confirms that a transaction is included in a block, but it does not confirm that the block itself is valid. An SPV client trusts that miners would not build on an invalid block because doing so wastes their proof of work, an assumption that weakens if an attacker controls significant hashrate. You reduce this risk for high-value transactions by waiting for multiple block confirmations.
Privacy with Bloom Filters
The original SPV protocol, BIP 37, required clients to send Bloom filters to full nodes, which could analyse these filters to deduce which addresses belonged to the client. BIP 157/158 compact block filters address this by reversing the information flow: the server generates filters and the client downloads and tests them locally, never revealing which transactions it cares about.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.