LearnBitcoin

Glossary

Emergency Difficulty Adjustment (EDA)

The extra difficulty rule Bitcoin Cash launched with on August 1, 2017: whenever the chain's median time past had advanced twelve hours or more over six blocks, the next block's difficulty dropped by 20 percent. It kept a minority chain alive and then made it oscillate, as miners left to trigger the cut and returned to mine the cheap blocks. Replaced on November 13, 2017 by a rolling 144-block algorithm.

When a chain splits off with a small share of the hash rate, its first problem is arithmetic. Bitcoin's difficulty adjustment runs every 2,016 blocks and never looks at the clock in between. A chain that inherits Bitcoin's difficulty with five percent of Bitcoin's miners finds a block every three hours or so, and its first retarget is about nine months away. That is the chain death spiral worry, and the developers of Bitcoin Cash, who were about to split from Bitcoin on August 1, 2017 without knowing how many miners would follow, wrote a rule to get around it.

The rule was the Emergency Difficulty Adjustment, requirement 7 of the UAHF (user-activated hard fork) specification: if the median time past of the chain tip is twelve hours or more ahead of the median time past six blocks earlier, the next block's target goes up by a quarter, which is a 20 percent cut in difficulty. It fired on every block for which the condition held, with no floor other than Bitcoin's minimum difficulty, and it sat on top of the ordinary 2,016-block retarget rather than replacing it. The rationale in the specification is two sentences: the hash rate a chain will get depends on its price and is hard to predict, so difficulty must be able to fall after an abrupt drop if the chain is to stay viable. For a chain that might otherwise freeze, it did the job, and the chain kept moving through its first weeks with a small share of the miners.

Then the miners read the rule the other way. It paid out for gaps, so the profitable move was to leave the chain until twelve-hour gaps had piled up and cut difficulty to a fraction, then come back and mine blocks minutes apart until the normal retarget caught up, then leave again. Hash rate moved between the two chains in waves, Bitcoin Cash produced blocks in bursts after hours of nothing, and the coin's issuance ran far ahead of its schedule. From the split to the fix, 104 days, the chain mined about 25,500 blocks, nearly 10,000 more than Bitcoin found in the same time. The waves pulled miners off Bitcoin too, and BitMEX Research, which had flagged the design as a problem in September 2017, worked out the spillover: a chain with a two-week window is the one that feels an oscillation longest, because it corrects last.

Bitcoin ABC, the main Bitcoin Cash implementation, replaced the rule in a hard fork that activated on November 13, 2017, once the chain's median time past passed 1510600000. Three candidate algorithms had been simulated, from Neil Booth, Amaury Sechet and Tom Harding, with Bitprim and nChain running independent tests, and Sechet's was chosen as the least risky. It takes the chain work and the elapsed time over roughly the previous 144 blocks, about a day, clamps the elapsed time to between half a day and two days, and sets the next target from the ratio, on every block. The same fork made BIP-146's LOW_S and NULLFAIL rules mandatory. The oscillations shrank after that, though BitMEX's later work still found the chain more exposed to timestamp games than Bitcoin, because the two-hour future limit on a block's timestamp is 8.3 percent of a one-day window and a fraction of a percent of a two-week one.

For Bitcoin the episode is a lesson in what the slow retarget buys. A two-week window cannot be gamed by sitting out for twelve hours, and the price of that is a chain which would take months to recover from losing most of its miners at once. Bitcoin's own history says the trade has been the right one so far. The 2021 mining ban in China took roughly half the hash rate offline and the next retarget handled it.

Key takeaways

  • The rule (UAHF specification, REQ-7): when the median time past of the tip is 12 hours or more past the median time past six blocks earlier, the target rises by a quarter, a 20 percent difficulty cut, on top of the normal 2,016-block retarget
  • The incentive it created: a stall was rewarded, so hash rate swung between the two chains in waves; by the November fix Bitcoin Cash had mined about 25,500 blocks since the split against Bitcoin's 15,700, nearly 10,000 blocks of subsidy pulled forward
  • The fix (the November 13, 2017 hard fork): Amaury Sechet's 144-block algorithm, which sets each block's target from the work done and time elapsed over about a day, chosen over two rival designs after independent simulation; BIP-146's LOW_S and NULLFAIL rules activated in the same fork

Sources (10)

Related terms (11)

Published . No corrections logged for this page.

Edit this page on GitHub