How Bitcoin Mining Works: A Complete Guide

A step-by-step walkthrough of how Bitcoin mining works — from collecting transactions to claiming the block reward.

beginner 8 min read
bitcoinminingproof-of-work

Introduction

Bitcoin mining is often described as “solving math problems,” but that framing hides what is really happening. Mining is a competitive race to bundle pending transactions into a block and to win the right to extend the blockchain by being the first to find a hash that meets the network’s difficulty target.

This guide walks through the full lifecycle of a mined block.

Prerequisites

Before mining, you’ll need:

  • ASIC hardware capable of computing SHA-256 hashes at competitive speed
  • Cheap electricity (typically under $0.05/kWh to be profitable)
  • A Bitcoin wallet to receive block rewards
  • Mining software (e.g., CGMiner, BFGMiner) or a mining pool account

Step-by-Step: How a Block Is Mined

Step 1: Collect Transactions from the Mempool

Pending Bitcoin transactions wait in the mempool — a network-wide queue. A miner selects transactions, typically prioritizing those with the highest fees per byte, and assembles them into a candidate block.

Step 2: Build the Block Header

The block header is the input the miner will hash repeatedly. It contains:

  • The hash of the previous block
  • The Merkle root of all included transactions
  • A timestamp
  • The current difficulty target
  • A nonce field the miner is free to vary

Step 3: Hash, Vary the Nonce, Repeat

The miner runs the header through SHA-256 twice and compares the result to the difficulty target. If the hash is higher than the target, the miner increments the nonce and tries again. Modern ASICs perform hundreds of trillions of these attempts per second.

Step 4: Find a Valid Hash

When a hash falls below the target, the block is valid. The lucky miner immediately broadcasts it to the network.

Step 5: Network Verifies and Extends

Other nodes verify the block in milliseconds — they check the hash, the transactions, and the proof of work. Honest miners then start working on the next block, building on top of this one.

Step 6: Claim the Reward

The first transaction in the block (the coinbase transaction) pays the miner the block subsidy (currently 3.125 BTC) plus all transaction fees. This is how new bitcoins enter circulation.

Common Mistakes

  1. Underestimating electricity costs — even efficient ASICs are unprofitable at high power prices
  2. Solo mining without enough hash rate — without a mining pool, you may go years without finding a block
  3. Ignoring the next halving — block rewards drop in half every ~4 years, halving your mining revenue overnight

FAQ

How long does it take to mine one Bitcoin?

The network produces a block roughly every 10 minutes, with 3.125 BTC per block split among the winning miner (or pool). For a solo miner, the answer is statistical: it depends on your share of total hash rate.

Is Bitcoin mining still profitable?

It depends on your hash rate, electricity cost, and the current Bitcoin price. Use a mining calculator that factors in all three plus pool fees and hardware depreciation.

Why is mining so energy-intensive?

The energy cost is the security. Without it, the network would be cheap to attack. See our Proof of Work glossary entry for more.

Conclusion

Bitcoin mining boils down to: collect transactions, build a header, hash until you win, claim the reward. The technical machinery — SHA-256, difficulty adjustment, Merkle trees — exists to make this process secure and fair without a central coordinator.

For the deep mechanics behind the puzzle itself, read our Proof of Work entry. To understand the moving target, see Mining Difficulty.