Koinlytics

How Bitcoin Mining Actually Works

Bitcoinintermediate9 min read
Not gold digging. Not solving an equation. Miners are trying trillions of random numbers per second to find one that produces a hash below a target. Full mechanics.

Bitcoin mining is not solving an equation. It is guessing. Miners hash a candidate block with different random numbers (called nonces) until the output starts with enough zeros. That is it. The whole security model rests on this one game.

What a miner does step by step

  1. Collects pending transactions from the mempool.
  2. Builds a candidate block: header, coinbase transaction (their reward), then the transactions.
  3. Computes the SHA-256 hash of the block header.
  4. If the hash is a number below the current target, the block is valid and gets broadcast. If not, they change the nonce and try again.

A modern ASIC miner tries something like 200 trillion nonces per second. The whole network combined is currently around 700 EH/s. That is 700 quintillion guesses per second.

Why the difficulty target

The target adjusts every 2016 blocks so that blocks arrive on average every 10 minutes. If hashrate goes up, the target gets harder. If hashrate collapses (like it did when China banned mining in 2021), the target eases so blocks keep coming. This is the difficulty adjustment. It is the single most elegant piece of code in Bitcoin.

Who pays for it

Miners earn the block subsidy (currently 3.125 BTC) plus all the fees in the block. Their costs are electricity, hardware depreciation, and cooling. Global mining is estimated to consume 0.4-0.5% of world electricity, mostly from otherwise-stranded generation: hydro in Sichuan wet season, gas that would otherwise be flared, wind in Texas at times of overproduction.

Pools, not solo miners

Solo mining a block today has odds worse than winning most lotteries. Miners join pools that combine hashrate and split rewards proportionally. The top three pools account for over 60% of network hashrate. This is a real centralization risk, but not the one people usually name: pools do not own the hashrate, individual miners do, and they can switch pools instantly.

The 51% attack in plain English

If a single entity controlled more than half the hashrate, they could reverse recent transactions (double spend) by producing a longer chain than the honest one. The cost of doing this against Bitcoin today is tens of billions of dollars in hardware plus billions per month in electricity. It has never happened on Bitcoin. It has happened on smaller proof-of-work chains.

PreviousThe Bitcoin Halving Explained NextUTXOs and the Mempool
Powered by Koinlytics · Free crypto education.

Ready to try what you just learned?

Open the Koinlytics dashboard and see the concepts live on your real portfolio.

Launch App