Understanding BTC Mining Difficulty Adjustment in One Article

Understanding BTC Mining Difficulty Adjustment in One Article

When I first learned about Bitcoin mining, I thought it would be easy, like sitting at home, doing whatever I wanted, and my computer would do the work, making money while I slept.

But not quite. It turns out there are a lot of reasons why this is not going to happen.

But in order to understand why, we first have to understand the whole concept of mining and what it means in terms of cryptocurrency.

What is mining?

Essentially, mining is about creating new blocks, filling them with transaction records, and adding them to the blockchain so that everyone can see and agree on how a particular currency is being used.

However, in order to add a block, miners must solve a “cryptographic puzzle,” or in more technical terms, they must arrive at a valid block hash.

I won’t go into too much detail about hash functions, but in short, hashing takes all the information in a block and processes it until it returns a random 64-bit hexadecimal number of letters and numbers that has nothing to do with the previous content.

If you change any data on the block, the nonce will be drastically different, but if nothing has changed, it will always return the same thing.

But how do you know if a hash value is valid? This is where the difficulty target comes in. The target describes a threshold, and for the hash to be valid, the value must be less than the target.

You might ask, if you can’t change the transaction information, how can you get a different hash value? There is another factor in the block that is taken into account when creating the hash - you can modify it, and it is called a nonce.

Source: Khaled Salah

Miners keep working on 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, it is more difficult to roll a number less than 3 than to roll a number less than 4.

So how do you determine the value of your target? The answer to this question is what we are going to discuss today: mining difficulty.

What is mining difficulty?

This should be pretty self-explanatory, but mining difficulty simply refers to how hard and time-consuming it is to find a valid hash for a block. A better question would be, why does mining need to be difficult in the first place?

The whole point of blockchain is to build consensus among multiple individuals in the network, that is, to agree on a single truth. How do they do this? They take the longest valid chain in the network, determined by how much work was put into it (the time it took to calculate the hash value), and accept it as the main chain to build on.

With this difficulty, the security of the network is ensured because it prevents fraud. If adding blocks was easy, then someone could send fraudulent transactions and then spam the network to create their own longest chain. However, due to the difficulty of mining, the process of adding blocks is slowed down to prevent spam, and it takes an average of 10 minutes to mine a block.

The tricky thing here is that an attacker can easily bypass this difficulty by finding ways to increase computing power. Fortunately, we thought ahead and figured out a way to make the system control difficult.

How is mining difficulty determined?

The difficulty is adjusted periodically to ensure that it always takes an average of 10 minutes to mine a block. After every 2016 blocks are added, the system looks at how long it took to create those 2016 blocks. Normally, it takes about 2 weeks, or 20160 minutes. If it takes more than two weeks, the difficulty is decreased, and if it takes less than two weeks, the difficulty is increased. The difficulty can be determined as follows.

Deriving the formula for the new difficulty

As you can see from the inverse function, if it takes longer than 2 weeks, the score will be less than 1 and the new difficulty will decrease. If it takes longer than 2 weeks, the score will be greater than 1 and the new difficulty will increase.

If the difficulty decreases, the target value increases, making it easier to find a valid hash, and vice versa. The maximum target value is 1, so the difficulty is also inversely proportional to the target value.

Relationship between difficulty and goal

To prevent sudden changes, difficulty cannot be increased or decreased by more than a factor of 4 in a single adjustment.

But getting back to how we came up with the target, we need to explore the different factors that influence the time it takes to mine a block.

Two things can affect this time:

Computing power

The number of individuals in the network

Computing power

In the early days of Bitcoin, you might have been able to successfully mine it, just as I think people used to do — with their personal computers. However, miners were soon forced to upgrade.

Since mining is essentially a competition where people compete to find the hash value first and receive the reward, those with more powerful computers will be able to make more calculations in the same time and therefore have a higher chance of winning.

The upgrade started out as a simple switch from a CPU to a graphics card, but in recent years it has become much more substantial, and now a so-called ASIC (application-specific integrated circuit) — a device designed specifically for mining — is the minimum required to be able to compete.

But even then, you're unlikely to earn anything. Currently, it could take you 40 years to mine a single block. If you want to earn money, you'll probably have to join a mining pool - miners joining together to increase their chances of winning.

Considering all these advances and the fact that computers keep getting faster, in order to keep up with them and maintain a 10 minute average, the mining difficulty has to compensate for this.

The size of the network

Wait, but we don’t get faster computers every two weeks, do we? While the constant improvement of computers is the main reason why the adjustment mechanism needs to be adjusted, the system also compensates for the number of individuals in the network.

The more miners there are, the less time it takes to find a valid hash value because more calculations are done in the same amount of time. Therefore, when more miners are present, the difficulty increases, and when there are fewer miners, the difficulty decreases.

Summarize

So back to where we started - in this day and age, it is almost impossible to mine Bitcoin with your PC due to the ever-increasing difficulty of mining as equipment upgrades and the network size compensate. Your PC simply doesn't have the computing power to keep up with everyone else, so your chances of successfully mining a block are very, very low.

Even though the system is designed to reduce the difficulty, it rarely does so. Faster, more powerful devices are constantly being developed, and more and more people are joining the Bitcoin network. In fact, from the creation of Bitcoin in January 2009 to November 2020, there have been 250 difficulty increases and only 53 difficulty decreases.

<<:  Is it easy to make money? What you need to know about investing in the bull market

>>:  The market broke through a new high and the top fluctuated

Recommend

What does it mean when a woman has a mole on her nipple?

Everyone has moles on their bodies, and moles in ...

Bitcoin halving countdown 5 days! Price breaks through $9,200

Author: Liang Che Source: bitpush.news According ...

What does a mole below the clavicle mean?

According to a person's mole, we can analyze ...

Good fortune in men

Good fortune in men Men are the main body of mode...

What is the relationship between moles and life destiny?

What is the relationship between moles and life d...

What does it mean when a man has sunken eyes? He has good luck in love.

The facial features of some people reveal some of...

The thickness of your lips tests what kind of partner you are looking for

The thickness of your lips tests what kind of par...

Which moles on the body bring the most luck, wealth and honor?

Which moles on the body bring the most luck, weal...

Palmistry to see your love luck

Palmistry to see your love luck 1. The love line ...