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 in which specialized hardware bundles pending transactions into a candidate block and tries to be the first to find an input — the nonce — that, when combined with the rest of the block header and hashed twice with SHA-256, produces a result low enough to satisfy the network’s current difficulty target.

The miner who wins that race extends the blockchain by one block and claims a reward composed of newly issued bitcoin plus the fees attached to every transaction inside the block. There is no shortcut to finding a valid hash — only raw trial and error performed trillions of times per second per chip. This guide walks through that lifecycle end to end.

Prerequisites

Before you can mine Bitcoin in any serious capacity, you need a small set of essentials in place:

  • ASIC hardware capable of computing SHA-256 hashes at a competitive rate. Modern units are measured in hundreds of terahashes per second; CPU and GPU mining stopped being profitable for Bitcoin over a decade ago.
  • Cheap electricity, typically below $0.06 per kilowatt-hour. Power is by far the largest recurring cost, and a few cents per kWh is the difference between profit and loss over a machine’s lifetime.
  • A Bitcoin wallet address that you control, used as the payout destination for any rewards you earn.
  • Mining software running on the ASIC’s control board — either the manufacturer’s firmware or a third-party alternative like Braiins OS that offers tuning, monitoring, and pool features.
  • A mining pool account, unless you have enough hash rate to solo mine. For almost everyone, pool mining is the only way to earn predictable income.
  • Adequate cooling and ventilation. A single high-end ASIC dissipates more heat than a household oven and will throttle, error, or fail early if airflow is inadequate.

Step-by-Step: How a Block Is Mined

Step 1: Collect Transactions from the Mempool

Pending Bitcoin transactions wait in the mempool, a queue replicated across every full node. A miner — or, more precisely, the pool’s block-template builder — selects transactions, prioritizing those with the highest fees per virtual byte, and packs them into a candidate block until the 4-million-weight-unit limit is nearly reached.

Step 2: Build the Block Header

The 80-byte block header is the input the miner will hash repeatedly. It contains the hash of the previous block, the Merkle root summarizing every included transaction, a timestamp, the current difficulty target encoded as “bits,” a version field, and a 32-bit nonce that 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 resulting 256-bit number to the difficulty target. If the hash exceeds the target, the miner increments the nonce and tries again. When the 32-bit nonce space is exhausted, the miner adjusts an “extranonce” inside the coinbase transaction, which changes the Merkle root and resets the search space. Modern ASICs perform hundreds of trillions of attempts per second per device.

Step 4: Find a Valid Hash

When a hash finally falls below the target, the candidate block is provisionally valid. The lucky miner immediately broadcasts it so other nodes can verify and extend it before any competing block can take its place.

Step 5: Network Verifies and Extends

Other full nodes verify the block in milliseconds. They re-check the proof of work, re-validate every transaction, and confirm that no consensus rules are broken. Honest miners then begin working on the next block, building on top of this one. The block becomes harder to reverse with each subsequent block stacked above it.

Step 6: Claim the Reward

The first transaction in every block is the coinbase transaction, which pays the miner the block subsidy (currently 3.125 BTC after the 2024 halving) plus the sum of all transaction fees inside the block. Subsidy coins are subject to a 100-block maturity period before they can be spent, but pools typically credit miners as soon as a block confirms.

Common Mistakes

  1. Underestimating electricity costs. Even highly efficient ASICs become unprofitable at residential power prices in many countries. Run the math at your actual all-in kilowatt-hour cost — including cooling overhead — before committing to hardware.
  2. Solo mining without enough hash rate. A single ASIC mining solo against the global network may go years between blocks. Pool mining trades a small percentage fee for predictable, frequent payouts.
  3. Ignoring the next halving. The block subsidy drops in half roughly every four years. A miner that breaks even today at $0.05/kWh may be unprofitable overnight after the next halving unless fee revenue rises to compensate.
  4. Skipping ventilation planning. Heat is the silent killer of mining hardware. ASICs throttle, error out, or fail prematurely when intake air is too warm or exhaust paths are blocked.
  5. Leaving firmware at factory defaults. Stock firmware is conservative. Tuning voltage and frequency curves with reputable third-party firmware can improve efficiency, but only if you monitor temperature and chip health closely.

FAQ

How long does it take to mine one Bitcoin?

The network produces a block roughly every ten minutes, with a 3.125 BTC subsidy plus accumulated fees. For a solo miner the answer is purely statistical: expected time to find a block equals the network difficulty divided by your hash rate, which for a typical home setup is measured in years or decades. Pool miners receive their proportional share continuously.

Is Bitcoin mining still profitable?

Profitability depends on three numbers: your hash rate, your all-in electricity cost, and the current Bitcoin price. Use a mining calculator that also factors in pool fees, hardware depreciation, and expected difficulty growth. Profitable operations typically pair sub-$0.05/kWh power with the latest-generation ASICs.

Why is mining so energy-intensive?

The energy expenditure is the security. The cost of producing a valid block is what makes rewriting the chain prohibitively expensive for an attacker. Reducing energy use without changing the consensus rules would directly weaken the network’s defenses.

Can I mine Bitcoin with a CPU or GPU?

Not competitively. SHA-256 ASICs are roughly a million times more efficient than general-purpose hardware on the same workload. Bitcoin itself has been ASIC-only for over a decade.

Do I need to run a full node to mine?

Pool miners do not — the pool runs the node and hands out work. Solo miners and pool operators do, because constructing valid block templates requires up-to-date knowledge of the chain tip, the mempool, and the consensus rules.

Conclusion

Bitcoin mining boils down to a simple loop: collect transactions, build a header, hash until you win, claim the reward. The supporting machinery — SHA-256, the difficulty adjustment, Merkle trees, the coinbase transaction — exists to make that loop secure and self-coordinating without any central authority.

Once the mechanics click, the harder questions become economic: where to source cheap power, when to upgrade hardware, and how to plan around halvings. For the deeper cryptographic mechanics behind the puzzle itself, see the Proof of Work entry.