The Bitcoin Difficulty Adjustment

What is it?

The difficulty adjustment is what makes sure new Bitcoin blocks (of transactions) get created every ~10 minutes.

Why does it matter?

Every time a new Bitcoin block of transactions gets created, new bitcoin get released. So by regulating the number of blocks that get created, the difficulty adjustment regulates the incoming supply of bitcoin.

This ensures:

  • We can predict with a high degree of certainty how many bitcoin will be created this year, next year, and even in 2069 😉
  • When a lot of new miners join the network, too many bitcoin don't get created too fast.
  • If a lot of miners leave the network, it's not too hard for the remaining miners to create new blocks (and add bitcoin to the tradeable supply).

Real-World Analogy

diff adjustment twitter

How does it work?

Every 2016 blocks (~2 weeks), the difficulty "re-adjusts". That means the Bitcoin network looks at how long it took to mine those 2016 blocks (we'll call this the "expected time") and divides it by how long it actually took to mine the 2016 blocks ("actual time").

Move the slider to set the "actual time" (in days) it took to mine 2016 blocks.
14

Mining the last 2016 blocks:

  • Expected time: 14 days
  • Actual time: 14 days
  • Blocks were mined perfectly on time and the difficulty adjustment stays the same.

*The fastest the 2016 blocks has ever been mined is ~10.6 days (in 2010). Slowest was ~24 days (in 2009). Median is ~13.5 days. Source

Following Difficulty Adjustment:

  • New Difficulty Adjustment (in minutes) = Expected Time / Actual Time
  • New Difficulty Adjustment = 20,160 minutes / 20,160 minutes
  • The New Difficulty Adjustment is equal to: 1.00
  • Blocks will continue to be mined at the same rate as the previous 2016 blocks.

Caveats

I've simplified some things in this explanation and haven't explained how the mining algorithm is actually changed.

Go to Learn Me A Bitcoin to learn more. It's the best Bitcoin explainer site I know.

  • Fun fact: There's a bug in the Bitcoin code so only the last 2015 blocks are actually used in the difficulty adjustment calculation. It would require a hard fork (massive change) to change it and since it's not a big deal, a hard fork isn't worth it.
  • My example assumes we are starting with a difficulty of 1. That was the difficulty when the first Bitcoin block was mined. The current difficulty is much higher than 1.