Every ten minutes, thousands of machines race to solve a mathematical puzzle that no human could crack, and the winner earns the right to add the next page to Bitcoin’s permanent ledger. This process, known as Bitcoin mining, secures a network that now holds over $1.3 trillion in value while consuming more electricity than some nations. Whether you are trying to understand the technology behind Bitcoin or evaluating whether mining is still profitable, this guide breaks down exactly how Bitcoin mining works, from the SHA-256 hash function to the halving schedule that controls supply.
Key Takeaways
- Bitcoin mining uses a proof-of-work consensus mechanism where miners compete to find a valid hash below a target threshold set by the network
- The SHA-256 hashing algorithm processes block data billions of times per second, with miners adjusting a nonce value each attempt until a valid hash is found
- Mining difficulty adjusts every 2,016 blocks (approximately 14 days) to maintain an average block time of 10 minutes, regardless of how much computing power joins or leaves the network
- The block reward halves every 210,000 blocks (roughly 4 years), dropping from 50 BTC in 2009 to 3.125 BTC after the April 2024 halving
- Bitcoin mining consumes an estimated 150 TWh per year, though the share of renewable energy sources in the mining mix has grown to approximately 54.5% as of 2024
- Solo mining is virtually impossible for individual operators today, with over 99% of miners working through mining pools to receive consistent payouts
What Is Bitcoin Mining?
Bitcoin mining is the process by which new Bitcoin transactions are validated and added to the blockchain. Miners use specialized computers to solve cryptographic puzzles, and the first miner to find a valid solution gets to add the next block of transactions to the chain. In return, that miner receives a block reward (currently 3.125 BTC) plus any transaction fees included in the block.
Mining serves two critical functions simultaneously. First, it processes and confirms transactions without requiring a bank or payment processor. Second, it controls the issuance of new Bitcoin according to a fixed, predictable schedule that no single entity can change. This dual role is what makes Bitcoin a trustless system: participants do not need to trust each other or any central authority because the math enforces the rules.
The term “mining” is an analogy to gold mining. Just as extracting gold requires energy and effort, producing new Bitcoin requires computational work. The key difference is that Bitcoin’s supply schedule is entirely predetermined. There will only ever be 21 million BTC, and the rate of new issuance decreases over time through a mechanism called halving.
How Bitcoin Mining Works: The Step-by-Step Process
The mining process follows a precise sequence that repeats roughly every 10 minutes. Understanding each step reveals why the system is both secure and energy-intensive.
| Step | Action | Technical Detail |
|---|---|---|
| 1 | Collect pending transactions | Miners pull unconfirmed transactions from the mempool and assemble them into a candidate block (up to ~4 MB with SegWit) |
| 2 | Build the block header | The header includes the previous block hash, Merkle root of transactions, timestamp, difficulty target, and a nonce (starting at 0) |
| 3 | Hash the block header | The miner runs the block header through the SHA-256 algorithm twice (double SHA-256), producing a 256-bit output |
| 4 | Check the result | If the resulting hash is below the current difficulty target, the block is valid. If not, increment the nonce and repeat Step 3 |
| 5 | Broadcast the valid block | The winning miner broadcasts the block to the network. Other nodes verify the block independently before accepting it |
| 6 | Receive the reward | The coinbase transaction in the block awards the miner 3.125 BTC (post-April 2024 halving) plus accumulated transaction fees |
| 7 | Network moves to next block | All miners discard their current work and begin competing for the next block using the new block’s hash as their reference |
Source: Bitcoin Whitepaper, Bitcoin Core Documentation
A miner may attempt billions of nonce values before finding a valid hash. When the nonce range is exhausted (all 4.3 billion 32-bit values), miners modify the coinbase transaction or extra nonce field and start over. Modern ASIC miners can perform over 100 trillion hashes per second (100 TH/s), yet finding a valid block still takes the entire network an average of 10 minutes collectively.
How SHA-256 Hashing Works in Bitcoin
SHA-256 (Secure Hash Algorithm 256-bit) is a cryptographic function developed by the NSA and published by NIST in 2001. It takes any input data and produces a fixed 256-bit (64-character hexadecimal) output. Three properties make Bitcoin’s security essential.
First, it is deterministic: the same input always produces the same output. Second, it is a one-way function: you cannot reverse-engineer the input from the output. Third, it is avalanche-sensitive: changing even a single bit of input produces a completely different hash. These properties mean the only way to find a hash below a given target is brute-force trial and error.
Consider a simplified example. Suppose the network requires a hash starting with four zeros. The miner hashes the block header with nonce = 0 and gets a random-looking result. Then nonce = 1, nonce = 2, and so on, each time producing an entirely different hash. Eventually, one nonce value produces a hash like 0000a3f7b… that meets the target. That single valid result is trivially easy for other nodes to verify (just hash the same input once), but finding it required enormous computational effort.
The current Bitcoin network hash rate exceeds 700 EH/s (exahashes per second), meaning the collective network performs roughly 700 quintillion SHA-256 calculations every second. Our coverage of Bitcoin mining history traces how this figure grew from a single CPU in 2009 to today’s industrial-scale operations.
Mining Difficulty and the Adjustment Mechanism
Bitcoin’s difficulty adjustment is one of its most elegant engineering decisions. Every 2,016 blocks (approximately every two weeks), the network automatically recalculates how hard the mining puzzle should be. If the previous 2,016 blocks were mined faster than the 20,160-minute target (10 minutes per block), the difficulty increases. If they were mined more slowly, the difficulty would decrease.
This self-regulating mechanism ensures that blocks are produced at a roughly consistent rate regardless of how many miners participate. When Bitcoin’s price rises, and more miners join the network, difficulty increases to compensate. When unprofitable miners shut down, difficulty drops to make mining easier for those who remain.
The difficulty target is a 256-bit number. A valid block hash must be numerically less than this target. A lower target means fewer valid hashes exist, which means more guesses are required on average. In April 2024, Bitcoin’s difficulty reached an all-time high above 86 trillion, meaning a miner needed to perform roughly 86 trillion hash calculations on average to find a single valid block.
This mechanism also protects the network against attacks. To consistently produce blocks faster than the honest network, an attacker would need to control more than 50% of the total hash rate. At current levels, that would require an investment measured in billions of dollars in hardware alone, not counting electricity costs.
Mining Hardware Evolution
Bitcoin mining hardware has gone through four distinct generations, each delivering orders-of-magnitude improvements in efficiency. The progression from CPUs to purpose-built ASIC chips mirrors the industrialization of the mining sector.