Day 241Part 7: How Bitcoin Works

What Is Mining

Bitcoin mining is not digging for digital gold. The metaphor is catchy but misleading. Here’s what actually happens.

Mining is the process by which new blocks are added to the blockchain. Miners are specialised computers competing to find a specific output from Bitcoin’s hash function — and the competition is the point.

Here’s the mechanism. Each new block needs a valid header — a string of data that, when fed through SHA-256 twice, produces a hash that meets a specific target. The target requires the hash to start with a certain number of zeros. Finding a hash that meets the target requires guessing billions of times per second, changing a small number in the block header called the nonce with each guess.

There’s no shortcut. No pattern to exploit. Just brute force — an enormous number of attempts until one works. The miner who finds a valid hash broadcasts the new block to the network. Every other node verifies the work — which takes a fraction of a second — and adds the block to their copy of the blockchain.

The winning miner receives the block reward: newly created Bitcoin plus the fees from every transaction in the block.

Why does this matter? Because the difficulty of finding a valid hash — the requirement to do enormous computational work — is what makes Bitcoin’s history secure. To rewrite a past block, an attacker would need to redo all that work for that block plus every block since. The honest chain is always extending faster.

Mining isn’t finding coins. It’s doing the work that earns the right to write the next page of Bitcoin’s permanent history.

Tomorrow: what is proof of work — the puzzle that secures everything.

— The Daily Bit

Part of The Daily Bit — 365 days to understanding Bitcoin.