Proof of Work and Mining
Bitcoin needs someone to propose each new block, but it cannot hold an election among anonymous nodes. Instead it runs a lottery in which every ticket costs real electricity. Proof of work is that lottery, and mining is buying the tickets.
The rule
Proof of work is costly to find and takes one hash to check.
A miner assembles a candidate block, then hashes its header again and again, changing a field called the nonce each time. The goal is a hash below a target, which in hex roughly means "starts with enough zeros". Here is a toy version on the co-op chain, hashing a short text with SHA-256 and asking for four leading zeros:
"block 3: Ravi pays Meera 3, nonce 0" → ab334a8f6f6a… too high
"block 3: Ravi pays Meera 3, nonce 1" → 8102cbaa16e3… too high
"block 3: Ravi pays Meera 3, nonce 2" → bada5b55d4f8… too high
…
"block 3: Ravi pays Meera 3, nonce 97200" → 0000771469e9… below target: block found- Hard to find. Hashes are unpredictable, so the only method is to keep trying nonces. With four required hex zeros, each try succeeds with a chance of 1 in 65,536. This toy search needed 97,201 tries; luck varies around the average.
- Easy to check. Anyone can confirm the winning nonce with a single hash.
- Self-adjusting. The network retunes the target so blocks keep a steady pace however much mining power joins. Bitcoin retunes every 2,016 blocks, aiming for one block about every 10 minutes.
Incentives. The winning miner collects the block reward: newly created coins, called the subsidy, plus the fees of every transaction in the block. On Bitcoin the subsidy halves every 210,000 blocks, roughly every four years, so fees are meant to carry more of the reward over time. Honest mining pays. A miner who wastes work on an invalid block earns nothing, because full nodes reject it.
Security. Nodes follow the chain with the most accumulated work. Rewriting an old block means redoing its work and the work of every block after it, faster than the rest of the network keeps adding blocks. Doing that reliably needs more than half of all mining power, a 51% attack, and even then the attacker could only reorder or censor recent transactions. They still could not forge anyone's signature.