Mining difficulty adjustment algorithm, talking about the evolution of Bitcoin

Mining difficulty adjustment algorithm, talking about the evolution of Bitcoin

Bitcoin is a software system developed by humans, not a magical artifact created by God , which means that Bitcoin is not perfect and developers need to continuously improve Bitcoin .

In fact, any programmer who looks at version 0.1 of Bitcoin will come to the same conclusion: this is a rather crude version in terms of both code and implementation . It was only in the following 10 years that a large number of developers continued to improve Bitcoin, which gave Bitcoin its current ecosystem and scale.

Below, I will talk about the evolution of Bitcoin by giving an example: the mining difficulty adjustment algorithm.

1. What is the “Mining Difficulty Adjustment Algorithm”?

The average block time of Bitcoin is 10 minutes, and this 10 minutes is adjusted by the "Mining difficulty adjust algorithm".

The Bitcoin blockchain system does not know how many miners (computing power) are currently mining, and can only infer how many miners are mining by the speed of mining blocks . If the blocks are produced faster than expected (over a period of time, the average block time is less than 10 minutes), it means that there is more computing power, and the mining difficulty should be increased to reduce the miners' block production speed.

2. The shortcomings of Bitcoin’s “mining difficulty adjustment algorithm”

With the development of Bitcoin, a large number of competing coins that forked the Bitcoin code have also emerged. The mining returns of different coins vary. Miners do not mine a fixed coin, but choose the one with the highest return among all coins, constantly switching to mine (jumping mines) , and even mining pools that specialize in hopping mines for profit have emerged - machine gun pools. The Litecoin Mining Pool is a famous machine gun pool that developed at that time.

These coins directly inherited Bitcoin's "mining difficulty adjustment algorithm" at the beginning. Then, the problem came out: when Satoshi Nakamoto wrote the "mining difficulty adjustment algorithm", he did not consider the situation where multiple coins coexist in the same algorithm and miners jump between different coins . The Bitcoin difficulty adjustment cycle is once every 2016 blocks (about 14 days), which is too long .

Let me use a picture to explain the problem:

Miners follow the principle of "mining the most profitable coin" and continuously rush into mining in low-difficulty cycles and withdraw from mining in high-difficulty cycles, forming a "hash power flash". This causes the difficulty adjustment algorithm to misjudge the hash power , and further adjust the mining difficulty to super low/super high positions, until a certain high-difficulty cycle is too lossy, even the most sluggish miners withdraw from mining, and the coin dies.

3. Improved “Block-by-Block Difficulty Adjustment Algorithm”

In order to solve this problem, competing coins have improved the original 14-day difficulty adjustment algorithm of Bitcoin, changing the difficulty adjustment cycle from 14 days to adjustment for each block. If no blocks are produced for a long time, the mining difficulty will automatically decrease, ensuring that there will be no situation where no one is mining for a long time.

The machine gun pool, like the natural environment during the Ice Age, wiped out all the competing coins that had not upgraded to “block-by-block difficulty adjustment” (either they had been abandoned and no one was maintaining them, or their technical level was not high enough), completing the elimination and upgrade of competing coins .

I like to say:

Survival is the ultimate debate

The competing coins that did not upgrade died, so they were wrong, so "block-by-block difficulty adjustment" was right.

4. Reflection on Bitcoin’s shortcomings and improvements from the perspective of the difficulty adjustment algorithm

Through the defects and improvements of Bitcoin’s 14-day difficulty adjustment algorithm, I believe everyone can understand the sentence I said at the beginning of the article:

Bitcoin is a software system developed by humans, not a magical artifact created by God. This means that Bitcoin is not perfect and developers need to continuously improve Bitcoin .

After all the competing coins that do not improve die, Bitcoin should also improve to adjust block by block, so that it is more robust. Although Bitcoin accounts for the vast majority of sha256 computing power, it seems that it is okay not to change, but it does not mean that there are no hidden dangers, for example:

1. “Hash rate shock” after BCH fork
When BCH just forked, there was a defect in BCH's block-by-block difficulty adjustment algorithm EDA, which led to the first large-scale mining jump in the history of the sha256 algorithm: the computing power was transferred between BTC and BCH on a large scale. Whenever a large amount of computing power went to mine BCH because of the high returns from mining BCH, the computing power of BTC was greatly reduced.

A 30% drop in hashrate = a 30% drop in block speed. Since BTC is locked to a 1M block size by Core, the block capacity changes from "1M in 10 minutes" to "0.7M in 10 minutes ", which greatly aggravates the congestion of BTC . It was not until BCH switched to a more stable DDA difficulty adjustment algorithm that the "hash rate shock" suffered by BTC came to an end.

2. The “hash power death spiral” during BCH’s comeback

If the BCH price rises sharply in a short period of time, or even approaches the BTC price, the BTC computing power will be transferred to BCH in large quantities, causing BCH to enter a "computing power death spiral" : computing power decreases → block production slows down → congestion increases → market panics further → prices fall further → computing power decreases further, and accelerates BCH's turnaround.

BCH may make a comeback in a short period of time by taking advantage of the flaws in BTC's 14-day difficulty adjustment. No one is willing to lose money by mining high-difficulty blocks on BTC, and it will die suddenly in a short period of time. Many people cannot even transfer their coins to the exchange, and they have no time to escape and are buried with it .

3. The “machine gun pool effect” of miners repeatedly turning on and off their machines in a bear market

The recent sharp drop in BTC has resulted in the first time in history that the “main mining machines are shut down due to insufficient electricity” . Currently, most of the mining machines with the highest computing power are S9 and A8. When the price of the coin fell to 26,000, the electricity cost of S9 and A8 of 0.4 cents has been broken. A large number of S9 and A8 have been shut down, and the difficulty of BTC mining has dropped significantly.

In the next cycle, due to the significant decrease in mining difficulty and the increase in mining revenue, the temporarily shut down mining machines will be turned on again, and then shut down again in the next cycle. Such a large number of mining machines are repeatedly turned on and off, forming an effect similar to the machine gun pool shooting , which will cause the difficulty of BTC to fluctuate more and more violently, and the block generation will become more and more unstable.

5. The external environment is bound to change, which leads to internal evolution

The problem with Bitcoin’s 14-day difficulty adjustment algorithm leads to a deeper question:

CSW’s “ stability theory ” even “locks Bitcoin version 0.1”, right?

The difficulty adjustment algorithm is a good example. At first, BTC's 14-day difficulty adjustment was not a defect, but when the external environment changed (the rise of competing coins with the same algorithm, the shutdown wave caused by the sharp drop), it became a defect .

The external environment is always changing. In a changing environment, it is nothing but a pipe dream to expect to win the world's currency easily by keeping the internal situation unchanged and the rules unchanged .

In a changing market environment, can a company set all strategic goals, tactics, development paths, rules and regulations when it is first established, and then win the world's first place without doing anything? Is this possible?

In the rapidly developing digital currency market where new technologies emerge in an endless stream, only those currencies that proactively adapt to market changes and improve themselves according to market changes can achieve the highest efficiency and the fastest development, and defeat those passive currencies that "try not to change" and become world currencies.

Deng Xiaoping summed it up very well on this point, with three experiences of reform and opening up: "cat theory", "touch theory" and "no argument":

Cat theory: No matter whether the cat is black or white, a cat that can catch mice is a good cat.
Theory of feeling: Cross the river by feeling the stones.
Don't argue: Not arguing is one of my inventions. Not arguing is to buy time to do things. Arguing makes things complicated, and you waste all your time arguing and nothing gets done. Don't argue, try boldly, and make bold breakthroughs.

A country, a country with a billion people, dares to try and venture boldly, so why shouldn't a currency dare to do so? :)

VI. Conclusion

1. Bitcoin is a software system developed by humans, not a magical artifact created by God.

2. Version 0.1 of Bitcoin is a very rough version both in terms of code and implementation.

3. The 14-day difficulty adjustment is a defect of BTC, and may even lead to the sudden death of BTC. BCH's DDA block-by-block difficulty adjustment algorithm fixes the defects of Bitcoin and is a better evolution.

4. The external environment is always changing, and the internal environment must actively evolve in order to achieve the highest efficiency and the fastest development, defeating those passive currencies that "try not to change" and becoming the world currency.

5. Deng Xiaoping’s three experiences in reform and opening up—“the cat theory,” “the touch theory,” and “no argument”—are great wisdom.

<<:  Zcash listed on Coinbase Pro exchange

>>:  Rumors of running away have caused EOS to worry about reality

Recommend

The most favorable physiognomy of women for their husbands

It is actually very easy to identify the facial f...

Is it good to have a strong and unyielding woman?

Everyone should have backbone. Some people think ...

The face of a woman who always likes to throw tantrums

People's requirements for women are usually t...

What do wrinkles on the forehead mean?

In life, if we look carefully in the mirror, we w...

What kind of men are prone to cheating?

Classic fortune-telling: Super perfect horoscope ...

Illustration of moles on hands

Almost everyone of us has a mole, and the positio...

How to tell the gender of the baby from palmistry

Palmistry to predict the gender of the baby State...

People with these palmistry features are unlikely to become rich.

People with these palmistry features are unlikely...

Bitmain's fifth anniversary event is in full swing......

Last month, we held the first stop of Bitmain'...