Glossary / Mining & consensus
Mining difficulty
Also known as Difficulty, Network difficulty.
- Definition
- Mining difficulty is the dial the network turns every 2,016 blocks to keep blocks arriving about ten minutes apart, no matter how much or how little hash rate shows up.
Difficulty is a single number that expresses how much harder a block is to find than it was for Satoshi in January 2009. It is recalculated every 2,016 blocks, roughly two weeks, from how long the previous 2,016 actually took, and it can move by at most a factor of four in either direction. That is why ten minute blocks have survived a hundred trillion fold rise in mining power.
How it works
Difficulty is a ratio, and the protocol computes it from timestamps alone with no human input anywhere in the loop.
Underneath it sits the target, a 256 bit number that a block header hash must come in below, stored in the header as a compact four byte field called nBits. Difficulty is defined as the difficulty 1 target divided by the current target, so a difficulty of 126 trillion means a valid header is 126 trillion times rarer than in the first week of the network. Nodes never actually check difficulty; they check the header hash against the target. Difficulty exists because a ratio is readable and a 256 bit threshold is not.
The retarget happens at every block height that is a multiple of 2,016. The node takes how long that window really took, compares it with the intended 20,160 minutes, and scales the target by the ratio, clamped so that no single adjustment can be more than four times easier or four times harder. There is a famous off by one in the calculation: the timespan is measured between the first and last block of the window, which spans 2,015 intervals rather than 2,016, so the network actually aims at about 10.0049 minutes per block. Correcting it would be a hard fork over a rounding error, so it stays.
History shows the mechanism working in both directions. Difficulty sat at 1 for almost a year until the first retarget at block 32,256 on December 30, 2009, when it rose to about 1.18. It has since climbed above 120 trillion. The largest fall on record came on July 3, 2021, when China's expulsion of its mining industry took difficulty down 27.94 percent in one step, from roughly 19.93 trillion to 14.36 trillion.
Why this matters when you buy bitcoin
Difficulty is the reason your withdrawal confirms in minutes rather than hours, and stale difficulty is the reason it sometimes does not.
The mechanism only corrects in arrears. If a large share of hash rate switches off, blocks keep arriving at the old difficulty and take longer than ten minutes each, right up until the next retarget as much as two weeks later. During those weeks confirmations are slower, the mempool drains more slowly than it fills, and fee rates climb because the same block space is being auctioned less often. Anyone withdrawing from an exchange in July 2021 felt this directly. Blocks in that window were averaging close to fourteen minutes.
The opposite case is quieter but more common. When new fleets come online, blocks arrive faster than ten minutes until difficulty catches up, so confirmations are briefly cheaper and quicker than the schedule suggests.
Two things difficulty does not do are worth stating plainly. It has no effect on the halving schedule, which counts blocks and not time, and it is not a price signal. Difficulty rises because miners bought machines that were profitable months ago. Reading it as a forecast is reading a rear view mirror.
The July 3, 2021 retarget
The retarget of July 3, 2021 is the clearest demonstration of the mechanism, because the shock was enormous and the correction was automatic.
China's crackdown pushed a large fraction of the world's mining fleet offline within weeks in mid 2021. Machines went into shipping containers bound for Texas, Kazakhstan, and Paraguay, and while they were in transit they hashed nothing. The network did not slow to a halt or ask anyone for help. It simply produced blocks more slowly: a 27.94 percent reduction implies the previous window had averaged about 13.9 minutes per block instead of ten. At the retarget, difficulty dropped to 14.36 trillion, the ten minute pace returned within hours, and the four consecutive downward adjustments of that summer together took roughly 45 percent off the number. Adjustments in the other direction erased the whole drop over the following months, without anyone deciding that they should.
Mining difficulty vs difficulty adjustment
Mining difficulty is the number; the difficulty adjustment is the event that changes it. Difficulty is a value that holds constant for a full 2,016 block epoch, so every block in that epoch is exactly as hard as every other. The adjustment is the recalculation that happens at the epoch boundary, and it is the thing miners watch, because it is the moment revenue per machine changes. Saying difficulty rose on a Tuesday is shorthand for saying an adjustment occurred that Tuesday.
Mining difficulty vs target threshold
Mining difficulty is a convenience for humans; the target is what the software enforces. The target is the actual 256 bit ceiling a block hash must fall below, and it is what appears in every block header, compressed into the nBits field. Difficulty is derived from it by division and appears nowhere in the block. When a headline says difficulty rose 5 percent, the underlying change is the target getting about 5 percent smaller, and every miner on earth quietly needing about 5 percent more attempts per block.