From the birth of Bitcoin in January 2009 to November 2020, there have been 250 difficulty increases and only 53 difficulty decreases.
Author: Samantha Ouyang
Translation/Editing: Sherrie
When I first learned about Bitcoin mining, I thought it was as simple as sitting at home and doing what I wanted to do, and my computer would go to work and make money while I was sleeping.
But not exactly. Facts have proved that there are many reasons that make the above situation completely impossible.
But in order to understand the reasons, we must first understand the entire concept of mining and its significance in cryptocurrency.
What is mining?
Essentially, mining is to create new blocks, fill them with transaction records, and add them to the blockchain so that everyone can see and how a particular currency is used. Agree.
However, in order to add a block, miners must solve an “encryption puzzle”, or in more technical terms, they must get a valid block hash .
I won’t talk too much about the Hash function, but to put it simply, Hash is to get all the information of the block and then process it until it returns a random letter and number 64 that has nothing to do with the previous content. Bit hexadecimal number.
If you change any data on the block, the random number will be very different, but if nothing changes, it will always return the same content.
But how do you know whether the hash value is valid? This is the origin of the difficulty target. The target describes a threshold, and for the Hash to be valid, the value must be smaller than the target .
You may ask, if the transaction information cannot be changed, how to obtain different Hash values? When creating a Hash, there is another factor to consider in the block-you can modify it, it is called a nonce .
Source: Khaled Salah
Miners have been working hard for this number until the output Hash value is less than the target value. Because the hash value is random, the lower the target, the harder it is to find a valid hash value. Just like rolling a dice, rolling a number less than 3 is more difficult than rolling a number less than 4.
So how do you determine the value of the goal? The answer to this question is the topic we are going to discuss today: mining difficulty .
What is mining difficulty?
This is self-explanatory, but the difficulty of mining only refers to how difficult and time-consuming it is to find a valid hash value for a block. A better question should be, why does mining need to be difficult in the first place?
The whole point of the blockchain is to establish consensus among multiple individuals in the network, that is, to reach an agreement on a truth. How do they do this? They take the longest effective chain in the network, which depends on how much work is invested in it (the time it takes to calculate the hash value), and accept it as the main chain for construction.
With this difficulty, the security of the network can be ensured because it can prevent fraud . If adding blocks is easy, someone might send a fraudulent transaction and then spam the network to create their own longest chain. However, due to the difficulty of mining, in order to prevent spam, the process of adding blocks becomes slow, and it takes an average of 10 minutes to mine a block.
The tricky part here is that attackers can easily bypass this difficulty by finding ways to increase computing power. Fortunately, we thought ahead and figured out a way to make system control difficult.
How to determine the difficulty of mining?
Adjust the difficulty regularly to ensure that it always takes an average of 10 minutes to mine a block. After every 2016 blocks are added, the system will look at the time taken to create these 2016 blocks. Under normal circumstances, it takes about 2 weeks, or 20160 minutes. If it is more than two weeks, the difficulty will decrease, and if it is less than two weeks, the difficulty will increase. The difficulty can be determined as follows.
Derive the formula for the new difficulty
As you can see from the inverse function, if it takes more than 2 weeks, the score will be less than 1, and the new difficulty will decrease. If it takes more than 2 weeks, the score will be greater than 1, and the new difficulty will increase.
If the difficulty decreases, the target value will increase, making it easier to find a valid hash, and vice versa. The maximum target value is 1, which shows that the difficulty is also inversely proportional to the target value.
The relationship between difficulty and goal
To prevent sudden changes, the increase or decrease in difficulty cannot exceed 4 times in one adjustment .
But back to the question of how we come up with goals, we need to explore different factors that affect the time required to mine a block.
Two things may affect this time: computing power and the number of individuals in the network .
Calculate ability
In the early days of Bitcoin, you may have been able to successfully mine, as I thought people did in the past-with their personal computers . However, the miners were quickly forced to upgrade.
Since mining is essentially a race, people race to find the hash value first and get rewards. Those with more powerful computers will be able to make more calculations at the same time, and therefore have a higher chance of winning.
The upgrade was a simple conversion from the CPU to the graphics card at the beginning, but in recent years, the upgrade has been much larger. Now the so-called ASIC (application-specific integrated circuit)-a device specifically designed for mining-has been It is the minimum required to be able to compete.
But even so, you are unlikely to earn anything. Currently, it may take 40 years for you to mine a block. If you want to make money, you may have to join a mining pool-miners unite to increase their chances of winning.
Considering all these advancements and the fact that computers are constantly getting faster and faster, in order to keep up with them and maintain an average speed of 10 minutes, mining difficulty must compensate for this.
Network size
Wait, but we don’t have faster computers every two weeks, right? Although the continuous improvement of computers is the main reason for the need to adjust the mechanism, the system also compensates for the number of individuals in the network.
The more miners, the less time it takes to find a valid hash value, because more calculation results will be performed in the same time. Therefore, when more miners are present, the difficulty increases, and when there are fewer miners, the difficulty decreases.
to sum up
So back to where we started-in today’s era, it is almost impossible to mine Bitcoin with your PC. The reason is that due to the compensation of equipment upgrades and increased network size, the difficulty of mining continues to increase . Your PC simply does not have the computing power to keep up with other people’s footsteps, so your chances of successfully mining a block are very, very low.
Even though the system is designed to reduce difficulty, it rarely does so. Faster and more powerful devices are constantly being developed, and more and more people are joining the Bitcoin network. In fact, from the birth of Bitcoin in January 2009 to November 2020, there have been 250 difficulty increases and only 53 difficulty decreases .