Every 2,016 Blocks, Bitcoin Admits It Was Wrong: How the Difficulty Adjustment Works

Bitcoin retargets once every 2,016 blocks, clamps the move to 4x in either direction, and still carries a 0.05% off-by-one bias from its earliest releases. It is a thermostat that reads the thermometer once every two weeks, and it protects the issuance schedule rather than your confirmation time.

ONE EPOCH, 2,016 BLOCKS, AND THE WINDOW IN WHICH NOTHING CAN BE CORRECTED

5,040 min20,160 min80,640 min

Bitcoin’s difficulty adjustment runs once every 2,016 blocks — call it fourteen days — and is deaf and blind in between. That single number explains nearly every complaint people have about confirmation times: the network is not steering toward ten-minute blocks, it is correcting its previous guess about how much hashpower exists, two weeks after the fact.

0, 2,016, 4,032 — The Only Heights That Change Anything

A synced node sits at some height. Say 839,000. Consensus does not care about that number, except in one respect: it is not divisible by 2,016. Now take 838,656 (2,016 × 416) and 840,672 (2,016 × 417). Those two heights are different in kind. At each of them the node stops, looks backward across the epoch that just closed, and recomputes the target that every miner on earth will grind against for the next 2,016 blocks.

Between two boundaries the target is frozen. A farm energising a new building and a farm going dark in the same hour are, to consensus, the same event: nothing at all. The network learns about both of them at the boundary, collapsed into one number, and not one second earlier.

Difficulty adjustment is not a continuous controller with occasional checkpoints. It is a checkpoint. Everything people repeat about it — “Bitcoin targets ten minutes”, “Bitcoin adapts to hashrate” — describes the average behaviour of that checkpoint, not a promise the protocol makes to you at any given moment.

So if your transaction is broadcast at height 839,000, one block after a large hashrate exodus, then for the next 1,672 blocks the network still does not know. It mines the old target. You wait. That is not a failure state; that is the design operating exactly as written.

A Thermostat That Reads the Thermometer Once Every Fourteen Days

Strip the mysticism away and difficulty adjustment is a negative feedback controller, the same shape as a thermostat: measure the output, compare it to a setpoint, correct the input. A thermostat does this several times a second, which is why it works.

Bitcoin’s thermostat is the same machine with the sampling interval stretched to 1,209,600 seconds. It reads the thermometer, decides, sleeps for a fortnight, and wakes up to whatever it finds. Between two readings the room can freeze solid or catch fire; the controller does not know and cannot act. Nothing in the design says the room has to stay comfortable in the meantime.

That is not an oversight, it is the trade. 2,016 × 10 minutes is exactly two weeks, and two weeks was chosen on purpose: short enough that the network tracks real hashrate trends, long enough that a lucky or unlucky run of blocks does not yank the target around. Block arrivals are a Poisson lottery and at small sample sizes variance dominates signal — How Bitcoin Mining Works covers the underlying lottery; the point here is only that the lottery’s variance is the noise this controller is deliberately built not to chase.

A controller with a fourteen-day sampling interval is not a fast controller turned down. It is a categorically different object, and you should expect it to behave like one. The thermostat does not keep the house at 21 °C; it keeps the house near 21 °C on a fortnightly average. That is a far weaker promise than most people believe they were given.

It Is a Payroll Metronome, Not a Clock

Here is the inversion that shows up in almost every explanation, including the ones I repeated for years before thinking about it properly.

Difficulty adjustment is usually introduced as the mechanism that “keeps blocks coming every ten minutes”. That is not what it protects. It protects the payout tempo — the rate at which block subsidies leave the coinbase and enter circulation. Ten minutes is the gear ratio that produces an acceptable tempo. It is not the quantity under control.

Block interval is an output, not a setpoint. When hashrate falls and blocks take twenty minutes for a week, the mechanism has not malfunctioned; the issuance ran late, and that is the specific thing the correction exists to repair. The user waiting forty minutes for a confirmation is not a party the mechanism ever made a promise to — which is uncomfortable, and also true. Bitcoin Halving Explained is the place to look for why the emission cadence carries monetary meaning while your wait time does not.

Call it what it is: a payroll metronome, not a clock. A metronome that notices, two weeks late, that the tempo drifted, and then nudges the weight on the pendulum.

Every 2,016 Blocks, Bitcoin Admits It Was Wrong: How the Difficulty Adjustment Works
Wellcome Collection, CC BY 4.0, via Wikimedia Commons

The Formula, and Why It Is Almost Boring

One line does all the work:

new_target = old_target × (actual_timespan / expected_timespan)

expected_timespan is a constant: 1,209,600 seconds. Not measured, not smoothed, not estimated — just two weeks written down. actual_timespan is measured the crudest way available: take the timestamp of the last block in the epoch, subtract the timestamp of the first block in the epoch, done. One subtraction. Every megawatt that arrived and every megawatt that left during those two weeks is compressed into that single difference.

Slow epoch → actual larger than expected → target multiplied up → difficulty falls. Fast epoch → target multiplied down → difficulty rises. That is the entire controller. There is no feed-forward term, no derivative term, no memory of anything except the previous target.

  1. Block 1
    The boundary block lands, its timestamp becomes the epoch’s reference zero, and the previous target is inherited unchanged.
  2. Blocks 2–2,015
    Miners grind against a frozen target; hashrate may double or collapse without consensus noticing anything.
  3. Block 2,015
    The node walks back DifficultyAdjustmentInterval() − 1 blocks to locate the first block, spanning 2,015 intervals rather than 2,016.
  4. Block 2,016
    Last timestamp minus first timestamp yields the actual timespan, the single number the whole correction is computed from.
  5. Clamp
    The timespan is forced into the 5,040–80,640 minute window, so no epoch can move difficulty more than 4× up or 75% down.
  6. Multiply
    old_target × (clamped_actual / 1,209,600) produces the target for the next 2,016 blocks.
  7. Next epoch
    The correction always lands one epoch late: it repairs the previous guess, never the present moment.
  8. Steady state
    Repeat forever; the block interval hovers near ten minutes only because the controller keeps over- and under-shooting.
// Bitcoin Core, pow.cpp — CalculateNextWorkRequired(), condensed
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast,
                                      int64_t nFirstBlockTime,
                                      const Consensus::Params& params)
{
    // off-by-one: we walk back (interval - 1), i.e. 2,015 gaps, not 2,016
    int nHeightFirst = pindexLast->nHeight - (params.DifficultyAdjustmentInterval() - 1);
    const CBlockIndex* pindexFirst = pindexLast->GetAncestor(nHeightFirst);
    int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
    const int64_t nExpected = params.nPowTargetTimespan;      // 1,209,600 s
    // clamp: [expected / 4, expected * 4]
    if (nActualTimespan < nExpected / 4) nActualTimespan = nExpected / 4;
    if (nActualTimespan > nExpected * 4) nActualTimespan = nExpected * 4;
    arith_uint256 bnNew;
    bnNew.SetCompact(pindexLast->nBits);
    bnNew *= nActualTimespan;
    bnNew /= nExpected;
    // never easier than the protocol ceiling
    if (bnNew > UintToArith256(params.powLimit))
        bnNew = UintToArith256(params.powLimit);
    return bnNew.GetCompact();
}

The clamp is the piece that makes the whole arrangement survivable:

What the epoch actually tookWhat the formula is fedLargest possible move
Under 5,040 minutes5,040 minutesDifficulty ×4
Between 5,040 and 80,640 minutesThe measured valueStrictly proportional
Over 80,640 minutes80,640 minutesDifficulty ×0.25 (a 75% cut)

Even if 90% of the network’s hashrate vanished overnight, a single epoch could only give back 75%. The shortfall does not disappear — it rolls into the next epoch, and the next, which is precisely what “blocks stay slow for a while” means mechanically. The clamp is a speed limit on the correction itself, and it exists so that one pathological epoch cannot be exploited to mint blocks at trivial cost. In ordinary conditions the limit is never touched: single adjustments rarely exceed 10–15%.

The Off-by-One That Shipped in the First Version and Never Left

Look at the second line of that function again. The code walks back DifficultyAdjustmentInterval() − 1 blocks to find the first block of the epoch. But 2,016 blocks bound 2,015 intervals, not 2,016 — the gaps between fence posts are one fewer than the posts.

So the measured timespan covers 2,015 gaps while the expected timespan still assumes 1,209,600 seconds, i.e. 2,016 gaps of ten minutes. The controller is quietly comparing apples to apples-minus-one, and the result is a systematic bias of roughly 0.05%: the true long-run average block interval is about 10.005 minutes, not 10.000.

Is it worth fixing? No, and the reason is instructive. Fixing it changes consensus rules, which means a hard fork — every node on the network has to agree to switch on the same block or the chain splits. If you want to see what that coordination actually looks like in practice, Soft Fork vs Hard Fork walks through two real ones. A 0.05% timing bias is nowhere near the threshold where that risk is worth taking. So a bug found in the earliest code is still in the code, and will probably still be there in twenty years.

That is what a mature protocol looks like from the inside: not a clean system, but a system where every remaining wart has been priced and left alone. It also tells you something about how much precision the designers thought the block interval deserved — approximately none.

The Only Input Is Time, So Time Is What Gets Guarded

Since the entire correction derives from one subtraction of two timestamps, timestamps are the attack surface. Miners fill them in. So the rules constrain them:

  • A block’s timestamp must be greater than the median time of the previous 11 blocks (median-time-past). You cannot drag the chain’s clock backward.
  • A block’s timestamp may not be more than 2 hours ahead of the receiving node’s own clock. You cannot shove it far forward either.

Within that window a miner still has room to lie, and miners have occasionally lied. The point is that the room is bounded, and bounded on both sides: pushing timestamps forward to fake a slow epoch and harvest a difficulty cut is limited to what the 11-block median and the 2-hour ceiling allow. The guardrails are not elegant. They are just narrow enough that cheating does not pay.

Note what this implies about the thermostat. Its only sensor is a pair of clock readings supplied by the parties being regulated. Everything downstream inherits that.

There Is No Emergency Brake

Bitcoin has no emergency difficulty adjustment. There is no clause anywhere in consensus that says “if blocks have been slow for N hours, do something now”. The 2,016-block boundary is the only place the target ever moves.

Write out what that means when hashrate leaves abruptly:

  • Hashrate disappears.
  • Blocks get slower immediately — that day, not in fourteen days.
  • The controller stays silent. It has no channel through which to learn.
  • At the boundary it cuts difficulty by at most 75%, no matter how much hashrate actually left.
  • If the exodus was larger than 75%, the target is still harder than the surviving hashrate can meet, and the deficit rolls into another slow epoch.
  • Users pay in confirmation latency; miners pay in revenue per unit of hardware. Both absorb it, by design.

It reads late

The controller’s only input is one timestamp difference, and it takes that reading once per epoch — not per block, not per hour, not per day.

It moves slowly

The clamp caps every correction at 4× up or 75% down, so even a 90% hashrate collapse takes several epochs to absorb.

It promises nothing

Slow blocks are not a defect the mechanism owes you a fix for; the lag between two boundaries is carried by miners and users.

The largest single downward adjustment on record is the roughly 28% cut in July 2021, after China’s mining crackdown — an episode estimated to have taken somewhere between 50% and 75% of global hashrate offline more or less at once. Both of those are approximations and should be read as approximations. What matters is the shape: the biggest shock in Bitcoin’s history produced a correction well inside the clamp, and it still took more than one epoch for block times to look normal again.

The Control Group: Bitcoin Cash Tried the Fast Version

Every 2,016 Blocks, Bitcoin Admits It Was Wrong: How the Difficulty Adjustment Works
Wellcome Collection, CC BY 4.0, via Wikimedia Commons

This is where the design argument gets real, because someone ran the experiment.

When Bitcoin Cash split off on 1 August 2017, it shipped an extra rule alongside the ordinary 2016-block adjustment: an Emergency Difficulty Adjustment. If the median time gap across the last 6 blocks exceeded 12 hours, difficulty dropped by 20% immediately — target multiplied by 0.8 — and it could trigger on consecutive blocks, compounding.

# Bitcoin Cash EDA, 2017-08-01 to 2017-11-13 (simplified)
EDA_HEIGHT     = 478559               # first BCH block
MEDIAN_BLOCKS  = 6
SLOW_LIMIT     = 12 * 60 * 60         # 12 hours
RELEASE_FACTOR = 4 / 5                # difficulty *= 0.8
def next_work_required(chain):
    tip    = chain.tip()
    target = bits_to_target(tip.bits)
    if tip.height >= EDA_HEIGHT:
        gaps   = [b.time - b.prev.time for b in last_n(tip, MEDIAN_BLOCKS)]
        spread = median(gaps)
        if spread > SLOW_LIMIT:
            # emergency release: make it 20% easier, right now
            return target_to_bits(min(target / RELEASE_FACTOR, POW_LIMIT))
    # the original 2016-block DAA keeps running underneath
    if (tip.height + 1) % 2016 == 0:
        return classic_2016_adjustment(chain)
    return tip.bits                    # unchanged

What happened next was not a bug. It was a control loop with two controllers fighting, and it oscillated:

  • BCH price falls, miners leave, blocks slow down.
  • EDA fires, difficulty drops 20% per trigger.
  • BCH becomes more profitable per hash than BTC, so hashrate floods back in.
  • Blocks come extremely fast, difficulty climbs back up via the 2016-block rule.
  • BCH becomes unprofitable again, miners return to BTC, blocks slow down.
  • Repeat.

At its worst BCH ran thousands of blocks ahead of BTC, and by the time the EDA was retired more than 100,000 BCH had been emitted earlier than the intended schedule. The payroll metronome was being cranked by hand, in both directions, and the tempo it was supposed to hold is exactly what got damaged.

On 13 November 2017 a hard fork removed the EDA and replaced it with a new DAA that adjusts every block, using a moving window of the last 144 blocks toward a 600-second target.

Bitcoin DAABCH EDA (Aug–Nov 2017)BCH DAA (from 13 Nov 2017)
Adjusts whenEvery 2,016 blocksAny block whose last-6 median gap exceeds 12 hEvery block
Looks atFirst-vs-last timestamp of the epochMedian gap of the last 6 blocksLast 144 blocks
Nominal target1,209,600 s per epoch600 s per block600 s per block
Under a hashrate shockBlocks stay slow until the boundary; one epoch gives back at most 75%Drops 20% per triggering block, compounding, until blocks speed upRe-targets continuously from the 144-block window

Read that table as a trade, not a scoreboard. The EDA did what it was designed to do: it stopped blocks from being slow. What it could not do was stop itself from being profitable to game, because a controller that reacts to six blocks of data will chase anything, including its own previous reaction.

Why Bitcoin Keeps the Slow One

Put the two analogies back together, because they are the same object seen from two sides.

The thermostat with a fourteen-day sampling interval is what the difficulty adjustment is mechanically: a feedback loop with an absurd delay, protected against its own delay by a clamp, and by a rule that limits how far the sensor itself can be lied to. The payroll metronome is what it is for: not your confirmation time, but the tempo at which new coins are issued, a tempo that matters precisely because nobody can vote to change it.

Bitcoin chose the slow controller on purpose. A difficulty rule that reacts to six blocks is a difficulty rule that reacts to miners who have noticed the rule, and miners are the fastest learners in any system that pays them. Two weeks of enforced deafness is not sluggishness — it is the part of the design that makes the controller hard to game, because nobody can move enough hashrate for two weeks cheaply enough to make the exploit worth more than just mining honestly.

That is the trade, stated without flinching: you get a monetary metronome that cannot be cranked, and you pay for it with confirmation times that are nobody’s guarantee. The 2021 shock was absorbed over several epochs. The 2,015-interval arithmetic error has been sitting in the code since the beginning and will outlive us. Neither is a scandal; both are what a controller built to resist its own operators looks like from the outside.

So the honest question is not “why is Bitcoin’s difficulty adjustment so slow”. The honest question is this: if you had a machine whose only job was to keep paying out on schedule, and every participant in the system had a financial reason to make it pay out faster — would you really give that machine a panic button, and hand the button to them?

(The End)

Bitcoin

Block 481,824 vs Block 478,559: Why One Fork Split Bitcoin and the Other Didn't

2026-10-17 13:25:27

Bitcoin

300 MB, 336 Hours, No Queue: What the Bitcoin Mempool Actually Is

2026-10-18 7:53:51

❯
Profile
Cart
Coupons
Search