Merkle Path & Proofs
The Merkle Path: Efficient Verification
A Merkle Proof (or Merkle Path) allows an SPV Wallet to verify that a transaction is included in a block without downloading the full block data. This is the cornerstone of Bitcoin's scalability for light clients.
1. The Verification Problem
If you are running a wallet on your phone, you don't want to download 1MB of data just to verify one $10 transaction. You only have the 80-Byte Block Header and your transaction. How do you know the miner actually included it?
2. The Merkle Path Solution
Instead of the whole block, a full node sends you a Merkle Path: the specific set of "neighboring" hashes needed to reconstruct the path from your transaction to the root.
Example: Verifying $TX_A$ in a 4-TX block
To verify $TX_A$, you only need two hashes from the network: 1. $H_B$: The neighbor of $H_A$. 2. $H_{CD}$: The neighbor of the pair $H_{AB}$.
Calculation: * You compute $H_A = Hash(TX_A)$. * You compute $H_{AB} = Hash(H_A + H_B)$. * You compute $Root_{calc} = Hash(H_{AB} + H_{CD})$. * If $Root_{calc}$ matches the Merkle Root in your header, the transaction is 100% verified.
3. Logarithmic Scaling
The number of hashes required for a proof scales logarithmically ($\log_2(N)$). * 1,000 Transactions: Requires only 10 hashes (~320 bytes). * 1,000,000 Transactions: Requires only 20 hashes (~640 bytes).
4. Trustlessness
Even though you are getting the Merkle Path from a third party (a full node), the proof is mathematically certain. The full node cannot lie to you because any incorrect hash in the path would result in a final root that doesn't match your hard-coded block header.
[!TIP] This efficiency is why you can see your Bitcoin balance update almost instantly on a mobile wallet without waiting for a massive sync. The wallet simply checks the Merkle Root for every block to see if any of your addresses are involved.
Next, we will look at how Bitcoin handles Odd Transaction Counts in the tree.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: