Diving into Bitcoin's Difficulty Adjustment
Bitcoin difficulty has a cap on its adjustment, so there will be a lag in moving to a new equilibrium hash rate after big price moves
One of the greatest innovations in Bitcoin is the difficulty adjustment. Satoshi built a system that was robust and would endure over time, regardless of the computing power of miners on the network. Every 2016 blocks, or roughly every two weeks, the Bitcoin protocol adjusts the target used in Bitcoin mining. Let's dive deep into how Bitcoin difficulty works and its economic ramifications.
Mining and Difficulty
Bitcoin miners win the global mining lottery by producing a hash of a block header that is less than a target set by the Bitcoin protocol. Each hash operation takes energy and produces a random number. This number is, on average, quite large. But very occasionally, it can be small. Miners pick each random number as a single hash operation.
Over time, as computing hardware improve, miners can run more of these hash operations, producing ever more such random numbers and, therefore, ever more chances to win the lottery. If the target was fixed, miners would win their lottery in faster and faster times (as computing hardware improves) and therefore block times would shrink. This would be a problem since it would overload the blockchain saved on disk by all the full nodes.
To prevent this, Satoshi adjusts the target to revert to the average block time of 10 minutes per block. That means that if block times in any window of 2016 blocks, called a difficulty adjustment period, lie below 10 minutes, the difficulty will increase, i.e., the target will decrease (difficulty moves exactly inversely to the target). That way, as computers improve, even though block times may shrink in the short term, the target simply adjusts downwards so that the block times will revert to their mean of 10 minutes per block. And this works in reverse as well. If block time expands, then Bitcoin will automatically decrease the difficulty (and therefore raise the target), and this will return the block times to their average of 10 minutes per block.
To see this intuitively, imagine a lottery where the lottery administrator announces that anyone who picks a random number between one and a million will win if their number lies below 100. If each draw of the lottery is truly random, then the probability of winning the lottery is 100 in a million; there are 100 possible winning numbers (each number from 1 to 100), and probability of drawing any of them is 1 in a million. So the probability of winning is 0.01% for any given lottery ticket. If that target of 100 reduces to 10, then the lottery just became 10 times harder, with the chance of winning now 0.001%. This is essentially the Bitcoin mining lottery, except that the space of numbers is not up to a million but a much higher amount, 2^256.
The Caps on Difficulty
Satoshi implemented the difficulty adjustment with a cap. In fact, the target can adjust by, at most, a factor of four in either direction. To see this, here is a graph of what the new target will be in proportion to the old target:
Let’s explain this picture.
Keep reading with a 7-day free trial
Subscribe to Principles of Bitcoin to keep reading this post and get 7 days of free access to the full post archives.