Mining
Mining is how new blocks are added to the blockchain, keeping the Bitcoin network running and secure. The process starts when miners pick up unconfirmed transactions from the mempool to form a block. Next comes the hard part: miners compete to find a special value, or hash, that meets strict criteria. This search for a valid hash, known as Proof-of-Work, involves heavy computational effort and uses significant electricity.
When a miner finally finds a correct hash, they broadcast their new block to the network. As a reward for this work and to help cover their costs, the miner receives newly created bitcoin—referred to as the block subsidy or mining reward.
There’s no shortcut to finding a valid hash: miners must rapidly try as many guesses as possible. The speed at which they do this is called hash rate, measured in hashes per second. The combined hash rate of all miners helps determine the network's level of security, since an attacker would need to control most of this computing power to compromise the blockchain—a scenario known as a 51% attack.
Bitcoin mining is named after gold mining because, on average, the expense of mining new coins is close to their market value. This costliness by design prevents anyone from generating free bitcoin, ensuring a fair and secure system.