I decided to write this post because i was taken to this reflection by persons around me on different bitcoin chats. Infact on july the third 2021 there was an important difficulty retarget with a huge decrease (because of shutdown of many mining farms in China). I came across these reflections thanks to a little branstorming with @rivale27 @dave160488 @Lucayepa and @polto thank you all very much.
Values after retarget are the following:
decimal target: 1877009475827353279654828838027187714710153476809162752 target 0000000000000000001398ce0000000000000000000000000000000000000000 bits 171398ce difficulty: 14363025673659.96
Values before retarget are the following:
decimal target: 1352521844740049480301990665795127943729248621043908608 target 0000000000000000000e1ef90000000000000000000000000000000000000000 bits 170e1ef9 difficulty: 19932791027262.74
Change in difficulty is then: 27,94%
Apparently this is against the protocol laws because we think that the variation of difficulty in a single cycle may be no more than 25% up or down. But a more closer view shows that this is not true. Infact we can give a look to piece of code in bitcoin core source code:
// Limit adjustment step int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); if (nActualTimespan < nTargetTimespan/4) nActualTimespan = nTargetTimespan/4; if (nActualTimespan > nTargetTimespan*4) nActualTimespan = nTargetTimespan*4; // Retarget CBigNum bnNew; bnNew.SetCompact(pindexLast->nBits); bnNew *= nActualTimespan; bnNew /= nTargetTimespan;
looking carefully into the bitcoin core code, the change can be -75%(1/4x) (diff drop) or +300% (4x) (diff increase). why? because it’s 1/4x and 100*1/4=25% this means as 75% less than the total of 100%. this conclusion infact matches with the difficulty drop just happened yesterday.
Here the calculations with the difficulty data from the recent change
>>> before=19932791027262 >>> after=14363025673659 >>> maxdown=before-(before*75/100) >>> maxdown 4983197756815.5 >>> before/4 4983197756815.5 >>> maxup=before+(before*300/100) >>> maxup 79731164109048.0 >>> before*4 79731164109048 >>> maxdown<after<maxup True
So this has been a great decrease in difficulty, because an high amount of hashrate has been removed from the network. Many chinese farms have shutdown and this impacted strongly. A large change in the map of hashing power has been performed and this is very useful for decentralization of the Bitcoin network. As usual the protocol worked properly and securely and this is why we can always afford to transact without worries on this powerful network.