Author

Topic: what is this confusing sentence of mining difficulty. (Read 135 times)

legendary
Activity: 1512
Merit: 7340
Farewell, Leo
By the way, "leading zeroes" is a simplified way of describing the target, but it is wrong, and has to stop. The software doesn't check the leading zeroes, and there are times when the leading zeroes are the same, but the target changes. (i.e., 0x0001 and 0x000f both have the same leading zeroes)

Note that the hashes are actually displayed as big endian when you're looking at the block explorers but is in actuality little endian when you're looking in the code.
Which code are you referring to? There are various parts of the repository, to which large numbers are represented in big endian. The hashing is performed using the little endian representation, as outlined by the protocol, if that's what you meant.
legendary
Activity: 3444
Merit: 10537
Imagine that you are rolling a 6 sided die to get numbers between 1 and 6, you can set a condition to only accept numbers that are smaller than or equal to 5. So the number 5 becomes your "target". Now each of your rolls have a high chance of giving you a valid number (1, 2, 3, 4, 5). To make this harder you decrease this target to something like 3. Now each of your rolls have a lower chance of giving you a valid number (1, 2, 3) so you need to roll more times to get what you need.

In bitcoin mining instead of "rolling the die" we compute a hash which is also random and instead of a small range of numbers like the die example, it gives us a big number in a much bigger range between 0 and 2256.
Our "target" is similarly a big number between 0 and 2256; to make mining harder (ie. increase difficulty) it goes down (towards zero) and to make mining easier (ie. decrease difficulty) it goes higher (towards 2256).

We readjust this target every 2016 blocks in a way that it takes 2 weeks to mine them. Meaning if it took less than 2 weeks to mine the previous 2016 blocks we increase the difficulty and if it had taken more we decrease it.
The target value is deterministic (reproducible by everyone) because we all have the same blocks and use the same algorithm to compute it using the time value already inside the block headers.
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
I am confused in this sentence...
learnmeabitcoin has a beginner and technical articles regarding 'target' and 'difficulty'.

The explanation in the beginner page should be enough to explain how difficulty works: https://learnmeabitcoin.com/beginners/difficulty
After that, go to the technical part for more information about the target: https://learnmeabitcoin.com/technical/target
legendary
Activity: 2954
Merit: 4158
Difficulty is a representation of the target, and they are not directly interchangeable.

Think of mining as a game of probability. The more narrow the acceptable range, the harder it gets because your range of acceptable value gets smaller. Hence, you would need more tries to be able to hit a number within that range. If it gets harder and you can only guess at the same speed, your rate of getting the number correct gets lesser. Hence, smaller target = higher difficulty.

Note that the hashes are actually displayed as big endian when you're looking at the block explorers but is in actuality little endian when you're looking in the code. Talking about the number of leading zeros would be correct if you look at blockheaders in hexadecimal and in big endian.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Well, there's also this page I wrote to explain mining, that includes a relevant comment Smiley
https://kano.is/index.php?k=mining
legendary
Activity: 4116
Merit: 7849
'The right to privacy matters'
the mining gear spins an invisible code base wheel of fortune. if it spins a number high enough it hits a block.

so with hardly any gear in the world the difficulty number can be low easy to reach.

so pretend difficulty is 10 the machine mining would be slow as fuck since you want the machine to hit a block every 10 minutes.

So the shit all works and a block is being made 1 time every ten minutes on average.

If no one adds more gear the diff never changes.

but now I put two miners on doing the twice the work. blocks are getting made every 5 minutes until the difficulty goes from say 10 to 20.

And since both the gear and and the difficulty doubled the time per block  stays balanced at 10 minutes.

of course the difficulty is now over 50trillion as there are a lot of mining units.
legendary
Activity: 2380
Merit: 5213
To mine a block, miners must find a block header which is actually a hexadecimal number. The condition for the block header to be valid is that if it is hashed twice through SHA-256 function, the result must be below a certain number. That certain number is called target.

The smaller the target, the more difficult it's to mine a block. So, the target would increase, if the average block time is more than 10 minutes and it would decrease, if the average block time is less than 10 minutes.
full member
Activity: 448
Merit: 222
I am confused in this sentence...
what changes after 14 days? and what is mining difficulty target, tried to read many times but all gone over head Grin
Jump to: