The Mining Race
Blockchain mining is a competitive lottery where miners burn computational energy for the chance to add the next block and earn rewards. Each miner repeatedly hashes a candidate block with different nonces, searching for a hash value below the network's difficulty target. The first miner to find a valid hash broadcasts it, and all other miners verify and accept it — resetting the race for the next block.
Difficulty Adjustment
The genius of Bitcoin's design is its self-adjusting difficulty. If more miners join (increasing total hash rate), blocks would be found too quickly without adjustment. Every 2016 blocks, the protocol compares actual elapsed time against the expected 20160 minutes and scales the difficulty target proportionally. This ensures blocks arrive approximately every 10 minutes regardless of how much or how little computing power is on the network.
Block Structure
Each block contains a header (previous block hash, Merkle root of transactions, timestamp, nonce, and difficulty target) and a body (the ordered list of transactions). The header is just 80 bytes — it is what gets hashed. The Merkle root summarizes all transactions in a compact 32-byte hash, allowing efficient verification that any specific transaction is included in the block.
Economics of Mining
Mining profitability depends on hardware efficiency (hashes per joule), electricity cost, block reward, and transaction fees. As block rewards halve every four years, miners increasingly depend on fees. The hash rate naturally adjusts: unprofitable miners shut down, reducing difficulty until mining is again viable. This economic feedback loop has maintained Bitcoin's security through multiple reward halvings.