2

The current value of bits in the block header is: 18034379. In target form, this is equal to:

0x0000000000000000034379000000000000000000000000000000000000000000

However, if you calculate the target using the difficulty:

target = maxtarget / difficulty
target = 0x00000000ffff0000000000000000000000000000000000000000000000000000 / 336899932795.8077
target = 0x0000000000000000034379000000004000000000000000000000000000000000

As you can just about see, this calculated value is more accurate than the truncated target you get using bits.

My question is:

  • When mining, is the truncated target used (the one you get from bits), as opposed to the more accurate target you get by dividing the maxtarget by the difficulty?
  • Therefore, for all practical purposes, you should truncate the target you get when you divide the maxtarget by the difficulty?
3

When mining, is the truncated target used (the one you get from bits), as opposed to the more accurate target you get by dividing the maxtarget by the difficulty?

Yes. The bits value actually stored in headers is what matters, as this allows validation of standalone headers without context. Due to headers-first sync this is no longer strictly needed, but there is no reason to change the rules now.

Therefore, for all practical purposes, you should truncate the target you get when you divide the maxtarget by the difficulty?

Yes.

There is at most a 0.0015% difference between the two, though (1 in 2**16).

  • Thanks, as always. So if I were to create my own bits from the targetmax/difficulty calculation, should I simply use the first 3 significant bytes as the coefficient part of the bits? If so, should I round up or down? – inersha Jan 18 '17 at 20:04

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.