BitcoinMachine
TERM_DEF // MINING / DIFFICULTY
DIFFICULTY
Difficulty. A scaled inverse of the target; the difficulty-1 target corresponds to the highest threshold ever used.

This page sits in the Mining section — The energy-secured lottery: ASICs, difficulty, halvings, and the economics of block production. Read on for what it is, why it exists, how it works under the hood, and what to watch out for.
Difficulty — at a glance
MINING
Difficulty is a single number that quantifies how hard it is to find a valid block hash, relative to the easiest possible difficulty at network launch. It is recalculated every 2,016 blocks (~2 weeks) to keep average time-10-minutes/">block time at ~10 minutes regardless of how much hashrate joins or leaves.
Why it exists
DESIGN
Before Bitcoin, every digital cash proposal failed at one of two questions: who decides which transactions are valid, and who decides the order in which they happened? Trusted servers solve both — and then become the single point of failure. Proof-of-work answers the same questions without trust: whoever has burned the most electricity has the loudest, costliest vote in the current block, and the chain with the most cumulative work is the canonical one. Difficulty is one of the gears in that mechanism.
Mechanism
HOW IT WORKS
Miners batch unconfirmed transactions from the mempool into a candidate block. They then hash the 80-byte block header over and over, changing the 4-byte nonce (and, when exhausted, the coinbase extra-nonce) until the resulting double-SHA-256 hash falls below the current target. A valid hash is announced to the network in milliseconds; every node re-verifies it in microseconds. The honest miner earns the block subsidy plus all fees. The next block builds on this one, locking it in by hash. After ~6 confirmations, reversing it would require redoing more proof-of-work than the entire honest network can produce — practically impossible.
1. Collect unconfirmed transactions from the mempool, prioritising by fee-per-vbyte. 2. Assemble the candidate block — build the merkle root over all included transactions plus a coinbase tx that pays the miner. 3. Loop: set the nonce in the header, compute SHA256(SHA256(header)), compare against the target. 4. If hash < target → block is valid. Broadcast it to peers within milliseconds. 5. Every full node re-verifies in microseconds; the block is added to each node's chain. 6. The next miner starts the loop again, using this block's hash as their "previous block hash".
Difficulty across Bitcoin's history
EXAMPLE
Block 0 (Jan 2009) difficulty 1 hashrate ~ 7 MH/s (Satoshi's laptop) Block 210,000 (Nov 2012) difficulty 3.4 M hashrate ~ 24 TH/s Block 420,000 (Jul 2016) difficulty 213 G hashrate ~ 1.5 EH/s Block 630,000 (May 2020) difficulty 16.1 T hashrate ~ 115 EH/s Block 840,000 (Apr 2024) difficulty 86.4 T hashrate ~ 620 EH/s Difficulty growth since genesis: factor of ~ 80 trillion Difficulty doubles roughly every 2 years as hashrate grows. Retargeting algorithm (every 2,016 blocks): expected_time = 2016 × 600 seconds = 20,160 minutes actual_time = timestamp[2016 blocks ago] − timestamp[now] difficulty_new = difficulty_old × (expected_time / actual_time) clamped to [old/4, old×4] to prevent extreme swings.
BLOCK INTERVAL
Target ~10 minutes per block, maintained by automatic difficulty retargeting every 2,016 blocks (~2 weeks).
HONEST INCENTIVE
Honest miners earn the subsidy + fees. Attackers burn the same electricity but win nothing.
ENERGY = SECURITY
Every joule spent mining raises the cost of rewriting history. As of 2024 that cost is hundreds of millions of dollars per day.
LONGEST CHAIN
Nodes always follow the chain with the most cumulative proof-of-work. Forks resolve themselves within a block or two.
Things that catch people out
PITFALLS
  • Hashrate is not the same as winning probability for a single miner — variance is huge unless you mine in a pool.
  • The "51% attack" cannot create coins out of thin air; it can only reorganise recent history and double-spend the attacker's own coins.
  • "Solo mining" with a single CPU/GPU in 2024 has a vanishing probability of ever finding a block — ASICs dominate the hashrate by ~9 orders of magnitude.

Pages on this site that cover Difficulty in more depth:
TERMINOLOGY
Difficulty
A scaled inverse of the target; the difficulty-1 target corresponds to the highest threshold ever used.
Mining
Repeatedly hashing block headers until you find one whose hash is below the target.
Proof of Work
A scheme where producing a valid block requires demonstrably expending energy.
Hashrate
Number of header hashes attempted per second across the network — currently exahashes per second.
Hash Power
Same as hashrate; a measure of mining capacity.
Difficulty Adjustment
Every 2016 blocks, the target is rescaled so the next epoch averages 10-minute blocks.
Retarget Period (2016 blocks)
The block interval over which difficulty is recalculated, ≈ two weeks.
Target
A 256-bit number the block hash must be below for the block to be valid.