// learn · episode 03

Consensus & proof of work

Episode 2 made history tamper-evident — you can always tell two histories apart. But which one is real? This episode: how millions of strangers agree, with no referee. You've done the hashing already, so today we simulate the statistics instead — that's where consensus actually lives.

01 · the problem

Two versions of history

Digital money's oldest nightmare is the double-spend: copy the coin, spend it twice. Banks solve it with a ledger they control. Remove the bank, and you get this:

Ali has 5 coins — and quietly signs two payments with them: one to Siti, one to Raju. Two versions of history now exist. Both are internally valid: correctly hashed, properly mined, chained without a flaw. Click the one you believe.

02 · the race

The longest-chain race

Everyone follows one rule: the chain with the most work wins. So rewriting a payment that's already buried isn't just re-mining a few blocks like episode 2 — it's outpacing every honest miner, indefinitely. Try it. You're the attacker; pick your hashpower and how deep the payment is buried, and race.

#1#2#3⑂ fork
honest
you (atk)nothing yet…

“theory says” is Nakamoto's catch-up probability from the Bitcoin whitepaper — (q/p)z, a gambler's-ruin argument. Run 100 races and watch your empirical rate converge on it.

Below 50% hashpower, every block you fall behind roughly multiplies your odds down — you lose exponentially. Above 50%, given enough time you always win. That cliff is why “a 51% attack” is the number everyone quotes, and why honest majority hashpower is the whole security model.

03 · buried alive

Confirmations

Winning one race is luck. What matters is how luck decays: every block mined on top of your payment is one more block an attacker must out-race. Slide the numbers and watch reversal odds fall off a cliff.

chance your payment gets reversed: 1 in 531,441

0 conf
100%
1 conf
11.1%
2 conf
1.23%
3 conf
0.137%
4 conf
0.0152%
5 conf
1 in 59,049
6 conf
1 in 531,441
7 conf
1 in 4,782,969
8 conf
1 in 43,046,721
9 conf
1 in 387,420,489
10 conf
1 in 3,486,784,401

The bars are on a log scale — each confirmation multiplies the attacker's odds down by the same factor. Zero confirmations means reversal is free; that's why nobody serious accepts unconfirmed payments. And this is exactly why your exchange makes you wait: at 10% attacker hashpower and 6 confirmations, the odds are 1 in 531,441.

04 · the fine print

Three things worth knowing

Difficulty breathes

Every 2,016 blocks (~2 weeks), Bitcoin retunes the target so blocks keep arriving every ~10 minutes — whether a thousand miners join or quit.

Don't trust, verify

Every node re-checks every rule independently — no block is taken on anyone's word. Your browser just did the same thing, three episodes running.

Not the only ballot

Proof of work is the original consensus, not the only one — Ethereum switched to proof of stake in 2022. Same goal, different way of making votes expensive.

next up

Episode 04 — Wallets, keys & signatures play now →

The network agrees on history. Next: what it actually means to own something on it.

Building something that needs this to be right? →