‹ CHAPTER 11, ALL LESSONS

PATHFINDER · CHAPTER 11 · LESSON 2 OF 4

Double spending

The heaviest chain wins

When two versions of history exist, which one do nodes follow? 5 min

Inside one chain, the rule is easy: a coin spent in an earlier block cannot be spent again later, and a block containing a conflict is invalid. The hard case is when two valid chains exist at the same time.

Most work, not most blocks

Every node follows the valid chain that contains the most accumulated proof of work. It is often called the longest chain, but the exact rule is the heaviest: a chain of fewer blocks mined at a higher difficulty can outweigh a longer one. In practice the two almost always agree.

Valid comes first. A chain with more work but an invalid block, a forged signature or an oversized reward, is ignored by every node, whatever it cost to mine. Work only decides between chains that already follow the rules.

▶ SEE IT IN THE MACHINE

The BLOCKCHAIN rail shows the chain every node agrees on: the one with the most work behind it.

What to remember

  • Nodes follow the valid chain with the most accumulated work.
  • Longest chain is the common name, heaviest is the exact rule.
  • An invalid chain is ignored however much work it has.

Quick check

Two valid chains compete. Which one do nodes follow?

A chain with more work contains a block that creates extra bitcoin. What do nodes do?