Chapter 2 · Mechanics · lesson 2
Why tampering is loud
6 min
Builds on Hash it yourself
Chapter 2 · Mechanics · lesson 2
6 min
Builds on Hash it yourself
Track 0 showed that editing a block breaks every block after it. Now for the part that makes the whole thing practical: you can prove one transaction is in a block without downloading the block.
✓ every link matches
The transactions root in the header is not a hash of the whole list glued together. The transactions are hashed in pairs, then those hashes are hashed in pairs, and so on until a single hash is left at the top.
That structure is a Merkle tree, and the hash at the top is the root.
The useful property: to prove your transaction is in the block, you do not need the other transactions. You need your transaction, plus one hash per level of the tree — about twenty hashes for a block of a million.
Anyone can recompute the root from those and compare it to the header. If it matches, your transaction is in that block. If a single bit of it were altered, it would not.
Predict
Put the two mechanisms together:
There is no edit small enough to slip through. Not because anyone is watching closely, but because the arithmetic stops working, and every node checks the arithmetic.
Check
This is not trivia. Merkle proofs are load-bearing infrastructure:
That last one is a genuinely common contract pattern, and you will build it.