0

It is said that to discover a block, the person has to get a SHA256 number that has all 0's for the first 72 bits.

Does this number 72 change and become bigger and bigger over the years (say, every 4 years)? Or does it depend on how many miners are competing?

So that's could mean, in the year 2010, the number of 0's could be the same as in 2020, if there were as many miners in 2010 as today in 2021.

Murch
  • 71,155
  • 33
  • 180
  • 600

1 Answers1

1

Leading zeroes

The number you refer to is usually called the mining difficulty or target.

The aim of miners is to produce a block with a hash less than that target.

If you represent numbers in binary, a number with more leading zeroes is a smaller number. For example 00010 (2) is smaller than 00101 (5)

However you shouldn't think about leading zeroes because 00101 (5) is smaller than 00110 (6) but bigger than 00100 (4) although all have the same number of leading zeroes.

It is an arithmetic relationship that is tested, not the number of leading zeroes.

Target value and mining

The target is adjusted up and down regularly. It doesn't continually increase.

The target is adjusted to make the average time to find a new block close to 10 minutes.

This means as there are more miners the target is likely to increase. But more importantly, if there were fewer miners but each had more powerful hardware, the target would also increase, not decrease. It is the total amount of mining power, not the number of miners, that affects the target.

In the past, when the value of bitcoin fell, the value of the mining reward also fell. This can result in less efficient miners leaving the mining business and the difficulty target dropping not rising.


Miners assemble a block of transactions selected from a pool, then calculate the hash, if too big, they make a small change to the block, like change the nonce value, and recalculate the hash, they repeat this until either they find an arrangement that hashes to a value smaller than the target or until some other miner beats them and they have to start all over again.

RedGrittyBrick
  • 24,039
  • 3
  • 23
  • 47
  • 1
    so it is basically, generate a random number, and if the SHA256 of it (together with other data) can be less than, say `0000000007426d23...39`, then it is a successful mining of a block, and therefore 12.5 bitcoins rewarded at the moment? – deeper-understanding Jan 31 '21 at 12:46
  • It isn't generating a random number. Miners assemble a block of transactions selected from a pool, then calculate the hash, if too big, they make a small change to the block, like change the nonce value, and recalculate the hash, they repeat this until either they find an arrangement that hashes to a small value or until some other miner beats them and they have to start all over again. – RedGrittyBrick Jan 31 '21 at 13:06
  • oh... how can the moms and pops understand this... I am already quite technical, but I guess it is like, you don't have to understand how a credit card works underneath in order to use it – deeper-understanding Jan 31 '21 at 13:25
  • 1
    If the barrier to entry for any product is that it can be described in layman's terms we wouldn't be able to do anything. A black box understanding ("miners create timestamps") is far more useful than confusing people with technical explanations they don't need to know is counter productive. – Claris Jan 31 '21 at 13:59
  • @RedGrittyBrick hmm... I have watched some YouTube videos, and they tend to say the same thing: they SHA256 together with some kind of random number, and SHA256 twice indeed, and reach a number, and compete for this number to be "small enough"... I guess you can say, they don't need to do it with a random number: they can go from 0, and 1, and 2... but how do they coordinate the effect with thousands of miners in their mining pool? And if two or three mining pools do the same sequence, isn't it a waste of duplicate effort? So wouldn't it be better just to go "random"? – deeper-understanding Feb 02 '21 at 09:22
  • @RedGrittyBrick and that number is actually called `nonce`, which the book Mastering Bitcoin 2nd Ed by O'Reilly says p.225, is a random number... – deeper-understanding Feb 02 '21 at 09:48
  • There's nonce, extranonce, the timestamp, the order of transactions and many other things that miners can change to affect the generated hash. This is a level of detail that you don't need to understand just to use Bitcoin. The same applies to the various mechanisms and stratagems of coopereating miners in pools and of competing pools. If you really want to go into that rabbit hole it goes very very deep. The material that is hashed may or may not have some randomly chosen elements at the discretion of the miner but that seems insufficient justification to label it "generate a random number". – RedGrittyBrick Feb 02 '21 at 10:18