Glossary · deep dive

Mining

The process of repeatedly hashing block candidates to find one that meets the difficulty target.

Mining is the process that adds new blocks to the blockchain and issues new bitcoin. It is both Bitcoin's security system and its money printer, with a fixed schedule.

Step by step

1. Gather transactions. A miner selects transactions from the mempool, usually the ones paying the highest fees.

2. Build a block. The miner adds a coinbase transaction that pays the block reward to itself, then creates a header containing the previous block's hash, a summary of the transactions, a timestamp and a number called the nonce.

3. Hash, hash, hash. The header is hashed with SHA-256 twice. If the result is below the target, the block is valid. If not, the miner changes the nonce and tries again, trillions of times per second.

4. Broadcast. When a valid block is found, it is sent to the network. Nodes verify it in milliseconds and add it to their copy of the chain. Everyone then starts work on the next block.

Why make it hard?

This is proof of work. Because finding a block costs real energy, rewriting history would require redoing all that work. The difficulty adjusts every 2,016 blocks so that, no matter how much hash power joins, blocks arrive about every ten minutes.

The energy debate

Mining uses a lot of electricity, estimated by the Cambridge Centre for Alternative Finance to be comparable to a mid-sized country. Critics see waste. Supporters argue that energy is what makes the ledger expensive to attack. They also note that miners can be switched off instantly, which lets them use surplus or stranded power and help balance grids. Supporters sum it up this way: the energy use is not a bug, it is the security.

Over time, the halving shrinks the new-coin part of the reward, and fees become more important.