— —
Follow on X
LESSONS

Mining and proof of work

Miners hash block headers until one falls below a target. The work is useless except as proof that it was done, which is exactly what makes history expensive to change.

6 MIN READ
A loop of building a block, hashing with a nonce, checking against the target and repeating until found.
LEVEL · Intermediate
IN THIS LESSON · 5 OF 9
BY THE END YOU WILL BE ABLE TO ANSWER
  • What makes a block valid for mining purposes?
  • Why can't an attacker rent cloud computers to attack Bitcoin?
  • If a valid hash must start with 4 zero hex digits, roughly how many tries does it take on average? (Each hex digit has 16 values.)

Then prove it: a 2-question quiz · a challenge. The lesson marks itself complete at 100%.

To add a block, a miner must find a header whose SHA-256 hash is below a target number. Since hashes are unpredictable, the only method is trial: change the nonce (and other fields), hash again, billions of times a second. The first miner to find one broadcasts the block; everyone checks it in microseconds and moves on to the next.

Why "work"

The hash itself is worthless. What matters is that producing it required real electricity and hardware, and that the amount is visible: the lower the target, the more expected tries. A valid hash is proof that, on average, that much work happened. Hence proof of work.

What it buys

  • Ordering without a clock-keeper. The chain with the most accumulated work is the one everyone follows.
  • Costly rewriting. To replace the last N blocks, an attacker must redo their work faster than the honest network extends the chain.
  • Fair issuance. New coins go to whoever did the work, with no allocation committee.

The reward

The winner claims the block subsidy (3.125 BTC, halving every 210,000 blocks) plus all fees in the block. Because revenue is random, most miners join pools that split rewards by contributed hash rate.

The hardware

CPUs in 2009, GPUs by 2010, ASICs since 2013. An ASIC does one thing, SHA-256, which means an attacker cannot rent general computers to attack Bitcoin; they would need to buy the chips, and the chips are worthless for anything else.

Proof of Work vs. Proof of Stake · ExplainerWatch on YouTube ↗
MINI CHALLENGEExpected tries

If a valid hash must start with 4 zero hex digits, roughly how many tries does it take on average? (Each hex digit has 16 values.)

tries
CHECK YOURSELF
1/2 What makes a block valid for mining purposes?
2/2 Why can't an attacker rent cloud computers to attack Bitcoin?
pick an answer for each question

SOURCES

  1. Bitcoin: A Peer-to-Peer Electronic Cash System (Satoshi Nakamoto, 2008)
Progress is saved in this browser only.