Difficulty adjustment

Onramp Fundamentals Series – Chapter IX

What is the bitcoin difficulty adjustment? In 21 million we learned that one prong of bitcoin’s simple three-pronged approach to monetary policy is that new bitcoin is released to the market every 10 minutes, on average, until the final satoshi is released around the year 2140.

That a new block is mined every 10 minutes, on average, is achieved through the bitcoin difficulty adjustment – how much computing power must be deployed to mine a new block.

The bitcoin difficulty adjustment algorithm, while simple and elegant, is one of bitcoin’s key technological breakthroughs. It ensures that no matter how much (or how little) computational resources are dedicated to mining new blocks, a new block is only mined every 10 minutes, on average.

Because of the difficulty adjustment, bitcoin is able to maintain the predetermined stock-to-flow ratio that Satoshi designed, even in the face of better technology, like bitcoin mining ASICs (application specific integrated circuits).

In this way it is similar to gold, which as we discussed in Why did gold win? has been able to maintain a constant stock-to-flow of about 67 over thousands of years of advancing mining technology.

With gold, the more gold you mine, the harder it becomes to mine more gold.

With bitcoin, the more computational resources you dedicate to mining bitcoin, the more computationally intensive mining bitcoin becomes.

Whether they realized it or not, through implementation of the bitcoin difficulty adjustment Satoshi effectively reproduced one of the natural phenomena of gold that led to its adoption of money.

What, exactly, though, is getting more difficult in the bitcoin difficulty adjustment? And how is it adjusted?

To “find” new blocks (remember, a block is just a batch of transactions) to add to the blockchain, miners must solve a math problem called a “Proof-of-Work.” This math problem is essentially a brute-force “guess and check” math problem, and the more computational resources you have the faster you can perform more guesses, increasing your chances of being the first to “find” a solution to the math problem.

Solving this math problem is what gets adjusted to be more, or less, difficult.

For more details on the specifics, see Proof of Work.

The exact mechanics of how this is implemented are that every 2,016 blocks, the bitcoin network assesses the total time it took to mine those last 2,016 blocks. Ideally, if every block is taking 10 minutes, on average, to mine, this should be exactly two weeks.

If the actual time is less than two weeks, it indicates that the collective hashing power – i.e. the collective compute dedicated to solving the proof-of-work math problem – of the network has increased, making it too easy to mine new blocks, and the difficulty of the math problem to be solved in order to mine a new blocks will be increased.

Conversely, if it took longer than two weeks, the difficulty of the math problem is decreased. This is the bitcoin difficulty adjustment.

The adjustment factor applied every 2,016 blocks is proportional to the difference between the actual time taken and and the desired time of two weeks. For example, if the actual time to mine the last 2,016 blocks was 13 days, the difficulty would be increased by a factor of 14/13 = 1.08.

If it took 7 days, the difficulty would be increased by a factor of 2.

If it took 21 days, the difficulty would be decreased by a factor of 0.667.

The maximum adjustment factor is limited to a 4x increase or decrease from the previous difficulty level to prevent abrupt changes in difficulty.

In another 2,016 blocks, the total time it took to mine those blocks is assessed again, and the difficulty is adjusted once more.

As such, the difficulty adjustment ensures that the release schedule aspect of bitcoin’s monetary policy is executed as Satoshi intended, and that bitcoin cannot be released at a faster rate no matter the technological advancements in bitcoin mining capabilities.