A dive in five depths · Blockchain

How proof-of-work
really works

Mining is the most misunderstood machine in computing. "Solving complex math problems" is wrong in every single word. What it actually does is quieter and stranger: it turns electricity into unforgeable history. This guide takes that machine apart. Stop wherever you like — each depth is complete on its own. (Part 2 of the blockchain trilogy — it builds on Guide 1.)

New to it? Levels 1–2 are plenty.
Working dev? Land at 3.
Want the truth? Reach the abyss.
begin the descent
LVL 1
▸ Surface · 0–10m

A lottery where tickets cost electricity

Guide 1 ended on a cliff: writing to the ledger must be expensive, or the Sybil attack wins. Here's the first way to make it expensive — and it's a lottery, not a math test.

To add a block to the ledger, you must win a lottery. Lottery tickets aren't free — each one costs a tiny burst of electricity, spent guessing. The more electricity you burn, the more tickets you hold, the better your odds of being the one who writes the next block. Guessing costs real money; but verifying a winner is instant and free — anyone can check the winning ticket in microseconds. And here's the payoff for security: rewriting old history means re-buying all the tickets for every block since, while the rest of the world keeps buying tickets for the real chain and pulling further ahead.

If that sounds wasteful, it's supposed to. The waste is the product — and that idea predates Bitcoin by a decade.

The origin: proof-of-work was invented to fight spam

In 1997, Adam Back proposed Hashcash: make every email carry a small proof that some computation was done. For one email it's imperceptible; for a spammer sending a million, it's ruinous. The cost is a filter that honest low-volume behavior barely notices and abusive high-volume behavior can't afford. Bitcoin took that anti-spam stamp and scaled it into a security budget for an entire ledger.

🎭
Naive · one identity, one vote

Free to fake

Count votes by identity and the Sybil attack from Guide 1 wins instantly — whoever spins up the most virtual machines controls the ledger. Identity is free on the internet, so it can't be the thing you count.

Proof-of-work · one watt, one vote

You can't fake a megawatt

Count votes by electricity burned and faking is impossible: a million fake identities are worthless unless each is backed by a real power draw. Voting weight is anchored to a physical, external, auditable cost that exists outside the computer.

The takeaway for Level 1

Proof-of-work converts electricity into security. The ledger is protected not by secrecy or authority but by the brute cost of out-computing everyone else. To rewrite history you must out-spend the entire honest network — that price tag is the whole defense.

What is a ticket, exactly? It comes down to one hash function and one inequality — and you can run it yourself ↓
LVL 2
▸ Sunlit zone · 10–50m

The puzzle: one inequality

Strip away the mystique and mining is a single comparison, repeated a quintillion times a second. Here it is — then mine a real block with it.

The entire "puzzle" is this: SHA-256(block header) < target. That's all. The miner assembles a candidate block and then varies one throwaway field — the nonce — rehashing again and again until, by pure luck, the header's hash lands below a target number. Think dice, not math: a hash is effectively a uniformly random 256-bit number, and a low target means "keep rolling until you roll under this line." Difficulty is just how low the line is.

// mining, in full
// the entire "puzzle" — guess nonces until the hash rolls under target
nonce = 0
while sha256(block_header + nonce) >= target:   // too high? try again
    nonce += 1                                 // no skill, no memory — just roll again
// found one. broadcasting it lets everyone verify with ONE hash.

Three properties fall out of using a hash this way, and each one is load-bearing:

Progress-free (memoryless). Guess number one and guess number ten-quadrillion have identical odds. There is no "almost solved," no partial credit, no progress bar — which is why block discovery is a random (Poisson) process and a miner who just joined is not one step behind anyone. No skill component — deliberately. Any cleverness that helped you guess faster would centralize mining around the clever; pure dice keep it purchasable only with electricity. Brutally asymmetric — the network makes on the order of 10²⁰ guesses per second to find a block, but checking a winner is a single hash, done in microseconds on a phone. That asymmetry is what lets every node hold every miner accountable — Guide 1's "everyone re-validates everything," now with teeth.

Enough theory — mine one. Start at 8 bits (a few hundred guesses), then climb. Watch each extra 4 bits multiply the work by ~16×, and notice the whole thing is just the loop above running as fast as your browser can hash:

nonce0
hash
Not yet mined — press Mine to start guessing.
Bitcoin's real target is around 77 leading zero bits. At this laptop's hash rate, one block would take far longer than the age of the universe — which is exactly the point.

Then edit the block data after you've mined it. The found nonce instantly stops working — one character changed means every guess has to be made again. That's the tamper cascade from Guide 1, now with a price tag attached to each block.

!

"Miners solve complex mathematical problems" — wrong in every word

Not solving (they're guessing), not complex (it's one hash comparison), not problems (it's a lottery). And the cousin myth: the puzzles compute nothing useful, on purpose. If solving them produced something valuable (protein folds, primes), that value would subsidize some miners over others and break the clean "cost = security" accounting. The uselessness is a feature — the only thing being proven is that energy was spent.

One inequality — but who sets the target, and why does a block still take ten minutes no matter how many miners pile in? ↓
LVL 3
▸ Twilight zone · 50–200m

The machinery: difficulty, subsidies, pools

A self-running economy sits on top of that one inequality: a thermostat that holds block time steady, a shrinking reward that funds it, and pools that tame the variance.

Difficulty is a thermostat. If more miners join, blocks would come faster — so the target must tighten to slow them back down. Bitcoin does this every 2,016 blocks (about two weeks): every node independently recomputes the target so that blocks average ten minutes. No vote, no announcement — just arithmetic every node agrees on.

// difficulty retargeting — run identically by every node
// every 2016 blocks, every node recomputes the target — no committee
expected = 2016 * 10 // minutes the last 2016 blocks *should* have taken
actual   = time(block[2016]) - time(block[0])   // what they *did* take

new_target = old_target * (actual / expected)      // slow chain → easier; fast → harder
new_target = clamp(new_target, old_target/4, old_target*4)  // never more than 4× a step

This isn't theoretical. In mid-2021 China banned mining and roughly half the network's hashrate unplugged in weeks. Blocks slowed to ~19 minutes. Then the next retarget arrived and cut difficulty by −27.9% on July 3, 2021 — the largest downward adjustment in Bitcoin's history — and block times snapped back to ten minutes. No committee met; no emergency was declared. The thermostat just did its job. (Ethereum's proof-of-work retargeted every single block toward a ~13-second target — a detail that matters when Guide 3 explains why it could switch consensus so cleanly.)

The most misunderstood consequence

More miners does not mean more bitcoin, or faster bitcoin. Hashrate has grown by a factor of roughly a trillion since 2009; the issuance schedule and the ten-minute block time are unchanged. Extra hashrate buys exactly one thing: a more expensive chain to attack. Security scales with hashrate; throughput does not scale at all.

Who pays for the electricity? The protocol does, by minting new coins. Each block's first transaction — the coinbase — pays its producer the block subsidy plus all the transaction fees in the block. The subsidy halves every 210,000 blocks (~4 years): 50 → 25 → 12.5 → 6.25 → 3.125 BTC since April 2024. That geometric decay sums to the famous 21-million cap, with the last fraction of a coin minted around 2140. Keep one consequence in your pocket for the abyss: when the subsidy reaches zero, transaction fees alone must fund the entire security budget.

The hardware arms race. CPU (2009) → GPU (2010) → FPGA → ASIC (2013 onward): chips that do nothing but SHA-256, a roughly trillion-fold efficiency climb. The number that matters is joules per terahash — a current ASIC does ~200 TH/s at around 17 J/TH. The consequence, which the abyss will indict: mining professionalized into industrial datacenters chasing the planet's cheapest power. "One CPU, one vote" quietly became "one power-purchase-agreement, one vote."

Mining pools — variance, not power. A solo miner with 0.01% of the hashrate would find a block about once every 1.5 years: unlivable. So miners join pools that combine hashrate and split rewards. Members submit shares — near-misses that prove work was done — and get paid pro-rata for every block the pool wins. The subtlety that matters: traditionally the pool operator chooses which transactions go in the block, so pool concentration concentrates ordering and censorship power even while the hardware stays spread across thousands of members. (Stratum V2 exists partly to hand transaction selection back to individual miners.)

Why ten minutes? A found block must propagate to the whole planet before the next one is found — otherwise two miners routinely find blocks at once, the network forks, and honest work cancels itself out as orphans. Ten minutes is a deliberately conservative cushion over worst-case global propagation. This is why "just make blocks faster or bigger" was never free, and why that exact debate split Bitcoin (Guide 1's block-size war).

The machine runs itself. Now stress-test it: what would an attack actually cost, and who has really been robbed? ↓
LVL 4
▸ Midnight zone · 200–1000m

Game theory & real blood

Proof-of-work's genius is that it makes honesty the greedy strategy. Its limit is that the guarantee is only as strong as the money being spent — and on small chains, that money runs out.

Why honest mining wins. For any miner well below 50% of the hashrate, building on the tip of the longest chain maximizes expected reward. Blocks built anywhere else are likely to be orphaned — pure electricity lost. No one mines honestly out of virtue; the protocol arranges the incentives so that honesty is simply the most profitable move. That alignment, not morality, is the achievement.

Pricing a 51% attack on Bitcoin. To out-produce the honest network you'd need to match ~800 EH/s — millions of the latest ASICs, more than the world manufactures in a year, so you cannot simply buy your way in on any timescale — plus gigawatts of power under contract. And the elegant trap: succeeding would crash the price of the very asset and hardware you just spent billions acquiring. A rational whale with that much capital earns more by mining honestly. Attack capital is self-defeating. (And remember the scope limit from Guide 1: even a successful 51% attacker can only reorg recent blocks and censor — never forge a signature or mint coins from nothing.)

But small chains bleed. The security guarantee is not a property of the software — it's a property of the money behind it. Chains that shared an algorithm with a bigger chain could be attacked with hashrate rented by the hour:

ChainWhenDamage
Bitcoin GoldMay 2018, again Jan 2020~$18M double-spent from exchanges via rented hashrate
Ethereum ClassicAug 2020Attacked three times in one month; one reorg rewrote 7,000+ blocks (~two days of history)

The mechanism was a marketplace: services like NiceHash let anyone rent enormous hashrate for thousands of dollars an hour, and sites like crypto51.app still publish the hourly cost to attack each chain. When a chain's honest security budget is small, that number is small too.

Selfish mining. There's an even subtler crack. A miner who finds a block can withhold it and secretly mine ahead, releasing blocks strategically so honest miners waste effort on a tip that's already stale. Eyal and Sirer showed (2013) this can be profitable from as little as ~25–33% of hashrate, depending on network position. The point isn't the exact threshold — it's that 50% is not a magic safety line. It's an upper bound on safety, not a guarantee of it.

The big misconception: PoW security is a property of the algorithm

It isn't. It's a property of the spend. Same SHA-256, same code, same rules: Bitcoin is armored behind billions of dollars of daily energy, and Bitcoin Gold got robbed with a rented rig. Security is the electricity bill — and the bill must be paid, in full, forever. A blockchain is exactly as immutable as its security budget, and not one block more.

Paid forever — by whom, burning what, concentrating where? The abyss is that bill itself, and it's the reason Ethereum spent seven years engineering an exit. → Guide 3: proof-of-stake & The Merge
LVL 5
▸ The abyss · 1000m+

The case against (the road to PoS)

Everything above shows proof-of-work works. The abyss is the four structural costs that are baked into how it works — the tradeoffs Bitcoin knowingly accepts, and the ones that pushed Ethereum to leave. Presented fairly, because they deserve it.

These are not gotchas. Each is a direct consequence of "security = energy spent," which is the source of proof-of-work's strength. You cannot keep the strength and discard the cost; they are the same fact seen from two sides.

Pod 1 The energy bill can't be optimized away

Bitcoin draws roughly 120–150 TWh/year (Cambridge's CBECI tracks it) — the electricity of a mid-size country on the order of Argentina or Poland. The honest nuances: miners chase the world's cheapest power, so stranded, flared, and off-peak renewable energy is over-represented, and energy used is not the same as carbon emitted. But the structural fact is inescapable: security is proportional to energy spent, by design. A "greener" proof-of-work that used 10× less energy would be precisely 10× cheaper to attack. And efficiency doesn't help — better chips don't cut consumption, they raise hashrate at the same spend (Jevons paradox). Pre-Merge Ethereum alone burned tens of TWh/year.

Pod 2 Centralization gravity

ASIC manufacturing is an oligopoly (Bitmain and a handful of others) — the hardware supply chain is itself a chokepoint. Pool concentration means the top two or three pools frequently command a majority of blocks between them, concentrating ordering and censorship power even though the underlying hardware is spread wide. And geography: cheap-power clustering created the China era (>60% of hashrate before 2021); the ban then relocated it to the US and Kazakhstan almost overnight — proving both the network's resilience (it survived) and its exposure (a single government moved half the hashrate).

Pod 3 E-waste and the ASIC treadmill

An ASIC does exactly one thing, and it's obsolete within ~1.5–2 years — the moment a newer chip makes its power draw unprofitable, it becomes scrap with no second use. Estimates (Digiconomist, contested) put Bitcoin's e-waste in the tens of kilotonnes per year, comparable to the small-IT-equipment waste of a country. Hold this one up against the next guide: a proof-of-stake validator runs on a machine the size of a paperback that you never need to replace.

Pod 4 The long-term security-budget problem

This is Bitcoin's genuine open question. The subsidy halves toward zero, so eventually fees alone must pay for essentially all security. Today, outside brief fee spikes, fees are a small minority of miner revenue. Either fee pressure rises structurally (block space becomes reliably expensive) or the security budget thins as the subsidy vanishes. There is no consensus answer yet — it's actively debated, and honest people disagree. No doom, but no solution either.

Pod 5 The probabilistic-finality ceiling

Under proof-of-work, "final" is always "probably final." Every exchange and bridge picks its own confirmation depth (why 6? folklore plus a margin), and a deep reorg remains possible, just priced out of reach. That's the ceiling this model can't break through: it can make reversal astronomically expensive, but never mathematically impossible. Proof-of-stake turns finality from a probability into a cryptoeconomic guarantee with an exact price — which is where the last guide goes.

Next: make the money itself stand hostage

Proof-of-work answers "who may write history?" with "whoever burns the most, verifiably." It works — and its costs are the design, not a bug. Ethereum bet there was a second answer that kept the security and dropped the energy: don't burn an external resource, put your own capital at risk. The final guide, How proof-of-stake & The Merge really work, takes that idea down to slashing and finality — and tells the story of the night a $200B system swapped engines mid-flight.