Bitcoin Q&A: Difficulty targeting and the “death spiral”

Gabriel asks, “Is it a rule of Bitcoin, or an average
number based on computation power, that blocks are formed every ten minutes or so?” Both. It is a rule of Bitcoin that the [difficulty target],
based on [the] computation [power of the network], forms blocks every ten minutes. The rule in Bitcoin is [about] the difficulty of doing
the calculation, which is adjusted every two weeks. The average number of blocks in a period of time
[will] equal a block about every ten minutes. The way this works is, over a period of two weeks,
there should be 2016 blocks [mined]. Therefore, we can count [blocks from] the previous
two weeks, and if the answer is exactly 2016, that means the difficulty of [solving the proof-of-work]
algorithm and the amount of [hash power that miners]… are committing to Bitcoin mining, is perfect. Blocks are coming out every ten minutes,
[so there is] nothing to adjust. Let’s say that instead of 2016 blocks, we had
2,217 blocks, or effectively 10% more blocks. The network [would adjust] the
difficulty [to be] 10% [more difficult], the same ratio as the [percentage] of extra blocks
we had versus the number of blocks we should have. If that difference is 10%, then the
difficulty target will be adjusted by 10%. As a result, we will be closer to ten-minute blocks in the future. If instead of 2016 blocks, we had 1,814 blocks
[and were] two hundred blocks or 10% short, we would adjust by about 10% in the difficulty target. That calculation happens every two
weeks, at exactly the same block, and affects the difficulty of the next block
across the entire network [of nodes]. Every computer in the network [counts] the
number of blocks it saw over the last two weeks, measures [the amount of time between them],
adjusts the difficulty by the same amount, and arrives at the same answer, as the entire
network switches [the difficulty target]. For the exact same amount, every two weeks. Jimmy has a great question. “Is it possible that the blockchain will not proceed
or propagate because we come to a point where… the difficulty required cannot be satisfied anymore,
in all the iterations of the nonce and extraNonce?” Yes. In fact, that has already happened. We have
the extraNonce because we [once reached] a point… where the difficulty could not be satisfied in the nonce. So extraNonce had to be [appended
as a field of the coinbase transaction]. There are a number of other things in the block header
that can be changed to produce more variation. The most important one, interestingly enough, is the
order and types of the transactions [a miner] includes. Let’s say you have 2,000 transactions in your block. These transactions were received and put
into the candidate block in a specific order. Because of the order of the transactions in the block,
they [will] produce a specific Merkle tree. Each pair of transactions — first and second, third
and fourth, then fifth and sixth — are hashed together. Then those hashes are hashed together, etc.
until you get to the Merkle root of the tree. It is a binary tree. If you change [even] two transactions
at the bottom of the tree, or reverse the order, the calculation all the way up changes
and you [will] get a different Merkle root. Effectively, that is like changing a nonce.
You have changed the block header. All you did was flip two transactions
around and re-calculate the Merkle root. With 2,000 transactions in the block, there are a lot
of [possible] combinations [in which to] order those. to produce all kinds of variety in the Merkle root. Re-ordering transactions is one of the
ways miners can vary the block header… when they run out of nonce and extraNonce. That [could] already [be] happening [with covert]
ASICBoost, which is a particular shortcut [involving]… [finding a collision in the last 4 bytes of the Merkle root;] [overt “version-rolling” ASICBoost only
changes the version field in the block header]. The point [that matters is] you can still satisfy the
difficulty by varying other parts of the block header. It is very likely that, over the next few years, we [will]
see a change in the format of the block header. One of the things that [will] change in the format of
the block header is more space for a bigger nonce, There is no reason why that can’t be done again,
to increase the [potential] amount of difficulty. The amount of nonce required can be satisfied.
That is not a problem [for Bitcoin]. M.J. asks about the Bitcoin “death spiral.” “Some believe that a combination of economic [and
political] factors, such as a crashing bitcoin price… [or] governments outlawing mining, could cause
a sudden and sustained reduction in hash power.” “What threat would this pose to Bitcoin?
Could it cause a ‘death spiral,’ as some fear (or hope)?” The “death spiral” phenomenon is this: [The difficulty] is not calculated based on time, but
[on the number of blocks], every 2016 blocks [mined]. Let’s assume that [hash power] drops dramatically,
with only 50% of miners [still] participating. Blocks [would be issued] every twenty
minutes instead of every ten minutes. Because [block issuance] is twenty minutes instead
of ten minutes, it [will take longer than] two weeks… to recalculate the difficulty and adjust
[the average block time] back to ten minutes. It will [be] four weeks [before the next re-targeting];
it will take four weeks for 2016 blocks to be produced. A sudden and sustained reduction in hashing power will
cause an increase of the time [between each] block. which will increase the interval [of time]
until the next difficulty re-targeting. Of course, some people assume if that
happens, then a lot of miners will [leave]; [that they will say], “I’m not making enough profit
anymore because things are moving a lot slower.” “I will turn off my mining [equipment],”
which then causes [hash rate] to drop even further. [That makes block issuance even] slower,
which causes [more miners to drop out], etc. [There is this] death spiral and [difficulty] never adjusts. First of all, that is unlikely to happen. We have seen that in other blockchains
which suffered sudden reductions in [hash power]. Miners have a much more long-term perspective. They have an existing investment in equipment
and usually purchase electricity on long-term plans. They don’t pay for it by the week. Therefore, if they have to wait three
months to become profitable again, and they already have the equipment
in place, then they are not turning it off. They take a bet that they will return to profitability. In fact, if they wait until the re-targeting and difficulty
becomes easier, miners who wait make more profit. In the new [network distribution], they have a greater
percentage of the [hash] power than they did before. Let’s say the [number of miners] dropped by 50%. The miners who stick around and wait for the difficulty
re-targeting, are now twice as profitable [afterwards]. That is a pretty good incentive to stick around. The other reason this is unlikely to happen: it assumes,
[with such a threat], the rest of the network [will] sit… idly by and no changes are made to the protocol. Arguably, if you had such a drastic reduction in [hash]
power, [such] that the time until the re-targeting… was pushed [too] far, one of the [possible solutions]
is to change the [difficulty adjustment] algorithm. This happened in Bitcoin Cash, where the
difficulty [target] was being [adjusted] far too often. A hard fork was made to change
the difficulty [adjustment] algorithm. Changing the algorithm, to make the difficulty be
re-targeted sooner, is something that could be done, as long as there is a big enough reason
and everybody agrees that it must be done. You [must] achieve consensus [on the new
algorithm] in order to avoid a [network] fork. Otherwise, those who disagree, [or aren’t
coordinating], will end up on a different [chain]. Arguably, yes, this could [cause a network] fork, but it is
more likely that you would have overwhelming support, if it becomes a big enough problem. I think the term “death spiral” in itself
produces this fantastic, dark image. It is a very strong, emotionally triggering
term [for those who care about Bitcoin]. People are thinking, “Oh, this is
a terrible thing that could happen!” But the chances of it happening are low; the chances
of nobody doing anything to fix it, are near zero. I don’t think we have anything to fear
from this situation of difficulty re-targeting. “Do you think there will ever come a time
when the Bitcoin / crypto economy is so large… that controlling a proportion of the mining capacity
will be considered a central bank responsibility?” “Or a national security issue?” “For example, where the United States, European Union,
China, and Russia would be running state-controlled… mining operations and competing against each other.” “Or do you think mining will remain in the hands
of private enterprises, for the foreseeable future?” “Or perhaps states will seize privately-owned mining
facilities and forcibly take them into public ownership.” Well, here’s the thing… There is something to be said about the possibility
of state entities taking over private mining facilities… and turning them into state-owned enterprises. You would think that, because this is a free market, where energy use [for] mining can be done
[almost] anywhere [that has] usable [energy sources], perhaps electricity that is difficult to distribute
or delivered in excess of the local demand… but can be utilized [by miners]… You would think that the distribution of
mining would follow free-market principles. If [a state] took it over and turned [a private
mining operation] into a state-owned enterprise, it is extremely likely that a state-owned enterprise
would be less efficient than its private counterpart. Effectively, the state [would be] sinking a lot of
money into building a failed national infrastructure. That [might be] okay if the production of electricity
wasn’t highly monopolistic and state-controlled. This isn’t a level playing field entirely.
There might be some advantages for state entities… to nationalize mining, in conjunction
with a nationalized energy infrastructure. in order to gain some strategic
advantage [in the Bitcoin network]. The strategic advantage in this particular case
wouldn’t be taking over, changing the rules, or trying to interfere with Bitcoin. As I mentioned in a previous answer, that would fail
so spectacularly and in such a costly fashion. However, consider it this way: what if [some] national interest would be
to maintain the neutrality of the protocol, to not allow anyone else to take it over, to [use
hash power to] resist attempts to centralize mining? That’s an interesting possibility; I don’t
think it is entirely out of the question. You might see actors eventually
doing large, state-level mining. I don’t think they [will] be competitive, but they
could use control over the energy [sector] to do that. I don’t know if that is a good thing or a
bad thing [for] the cryptocurrency economy. I don’t think it [would be] a bad thing [if] they
have to follow the rules like everybody else. If they tried to break the rules, they would face a
network-wide change in the proof-of-work algorithm. There is always that, the nuclear option.

Leave a Reply

Your email address will not be published. Required fields are marked *