freecoding.school100% FREE · NO SIGNUP
Ledger LandISSUE #8 of 90

merkle trees · proofs without the whole tree

BlockyVSDouble-Spend Dan
Blocky saysMerkle trees hash data in pairs up to one root — proving membership without the whole set.

A block can hold thousands of transactions. A Merkle tree hashes them in pairs, then hashes those hashes, up to a single Merkle root stored in the block header. To prove one transaction is included, you only need a short path of hashes (a Merkle proof), not the whole block. This makes light clients and efficient verification possible.

Power-ups you unlock

Double-Spend Dan attacks — common mistakes

Boss battleExplain how a Merkle proof verifies a transaction without downloading the block.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>tx1 tx2 tx3 tx4
 \  /    \  /
  h12      h34
    \      /
     root  ← in block header
proof for tx1 = [h2, h34] (short path)</pre></body></html>
▶ Open the interactive comic issue
‹ Digital Signatures · Sign · VerifyConsensus · The Agreement Problem ›