Similar question was asked here but the answer doesn't really provide an answer.
This answer says that the lowest possible value for target is "all zeros plus a one". Pieter Wuille in the comment denied it and wrote that the target can even be 0.
However, can it be 0 given the way the target is encoded in nBits
? Since the smallest legal value for the lower 24 bits is 0x008000 and if we take into account that the minimal exponent is only 3, it look like the lowest possible value for target is 0x008000, that is for nBits
0x03008000.
Therefore, what is the lowest possible target value, ie for nBits?
0x03
. What is then the correctnBits
for the number 500 (in base 256 = 01F4) or the number 154 (in base 256 = 9A)? 0x020001F4 and 0x0100009A? – LeaBit Jan 31 '24 at 12:520x0201F400
and the encoding of 154 would be0x02009A00
. The encoding of the number 5 would be0x01050000
. I realized I made a mistake in my answer above; the mantissa will actually always be between 0x008000 and 0x7FFFFF inclusive, except when encoding 0. I've amended my answer. – Pieter Wuille Jan 31 '24 at 13:290x0201F400
), the exponent is the0x02
up front (shifted by 3, so the actual exponent is -1), and the mantissa is0x01F400
(ignoring that its top bit is actually a sign bit), whose "digits" are0x01
,0xF4
, and0x00
. So the encoded number is (0x00
+0xF4
* 256 +0x01
* 256^2) * 256^(0x02
- 3) = 500. – Pieter Wuille Jan 31 '24 at 13:330x019A0000
instead of0x02009A00
? – LeaBit Jan 31 '24 at 14:430x019A0000
represents -26 (the high bit of the mantissa is the sign). – Pieter Wuille Jan 31 '24 at 15:04