1

In Mastering Bitcoin in the section on Difficulty Bits Andreas notes:

This means that a valid block for height 277,316 is one that has a block header hash that is less than the target. In binary that number would have more than the first 60 bits set to zero. With this level of difficulty, a single miner processing 1 trillion hashes per second (1 tera-hash per second or 1 TH/sec) would only find a solution once every 8,496 blocks or once every 59 days, on average.

How was 59 days calculated?

2^60 (1.15 x 10^18) would be the number of possible values to cycle through and 1 TH/s = 1 x 10^12 attempts every second but what am I missing?

  • I also get an expected 13 days, perhaps you should write an email to Andreas or open an issue on GitHub. – Murch Mar 2 '16 at 6:52
  • @Murch The mistake is that the author mentions the more than 60 bits of leading zeros in passing, not as problem-defining information. It is not a very tight bound. See my answer for details. – pyramids Mar 2 '16 at 9:30
1

There are 2^256 possible hashes and your source gives a target value of 238348*2^176, requiring more than 60 bits of leading zeros (61 in fact, plus the slightly stricter requirement that a valid hash must be smaller than the target value and not just start with the same number of leading zeros). In fact, the fraction of acceptable hashes out of all possible hashes is 238348*2^-80. Multiplied with 10^12 hashes tested per second, multiplied with 24*60*60 seconds per day, you get a probability of finding a valid hash of about 1 / 58.70 per day, or (as reciprocal) 58.70 days per valid hash on average.

You ask how 8496 was calculated. I note that 8496 = 59 * 24 * 6, so assuming you round to exactly 59 days per valid hash and use the nominal target of having one new block recorded in the blockchain every 10 minutes (hence 24*6 per day), then with a constant, steady-state target you would indeed expect to get lucky, on average, once every 8496 blocks by finding a valid block yourself. Obviously, there is an issue with the stated precision; according to my calculation, even just the rounding to 8500 blocks would only barely be correct.

  • Thanks for pointing out the target value of 238348*2^176. I hadn't considered that. And I can derive 59 days from the starting point of 238348*2^-80. However, why is it a fraction? If 2^256 = max possible values, and the target is 238348*2^176, wouldn't the difference be the amount of possible values I'd have to cycle through? Or have I just failed Maths 101. – cloudnthings Mar 3 '16 at 2:22
  • Since you effectively cannot reverse the hash function (that's the whole point!) you can only generate essentially random hashes, of which there are 2^256. Only 238348*2^176 are valid hashes. So the fraction of these two numbers, which is also the probability that any one generated hash is valid, is 238348*2^176 / 2^256 = 238348*2^-80. Its reciprocal is the typical number of tries that you have to, in your words, "cycle through" (no actual repetition is involved!). – pyramids Mar 3 '16 at 9:28
  • Got it! My gap was not fully understanding the target. As you state, the valid hashes range from 1->238348*2^176. ie anything in that range will result in at least 60 leading zeros. Therefore, the chances are indeed 238348*2^176/2^256. Then you can multiple by speed to get time. To help others, it's like rolling a dice with a target of 2 meaning rolling any number less than 2. The chances are 2/6. (# of possibilities/total range of possibilities). – cloudnthings Mar 3 '16 at 19:59
0

Sounds like he calculated 59 days first, using the method you mention. And then for some reason did 59 * 6 * 24 (1 block per ten minutes) to come to 8496.

I agree that it confuses more than it adds.

  • Would you know how 59 days was calculated? By my calculations, at 1 TH/s, it would take 1,152,921 seconds to try every possible value. ie 13 days. – cloudnthings Feb 29 '16 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.