# What is the lowest possible value for target?

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?

However, can it be 0 given the way the target is encoded in nBits?

Yes. The encoding in nBits for target 0 is 0x00000000.

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.

The rule about the mantissa needing to be at least 0x008000 only applies when the value is nonzero. It's there to make sure numbers have a unique encoding, but as this example point out, it would preclude encoding 0 if applied the same way for it.

So, the values are:

• 0x00000000 (0),
• 0x01010000 (1),
• 0x01020000 ... 0x017F0000 (2 - 127)
• 0x02008000 (128)
• 0x02008100 (129)
• 0x02008200 ... 0x027FFF00 (130 - 32767)
• 0x03008000 (32768) and so on...
• I thought that the smallest possible value for the exponent is 0x03. What is then the correct nBits for the number 500 (in base 256 = 01F4) or the number 154 (in base 256 = 9A)? 0x020001F4 and 0x0100009A? Commented Jan 31 at 12:52
• Shouldn't base 256 have 256 possible distinct symbols for each digit? Commented Jan 31 at 12:57
• The encoding for 500 would be 0x0201F400 and the encoding of 154 would be 0x02009A00. The encoding of the number 5 would be 0x01050000. 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. Commented Jan 31 at 13:29
• @RedGrittyBrick Indeed. In the encoding of 500 (0x0201F400), the exponent is the 0x02 up front (shifted by 3, so the actual exponent is -1), and the mantissa is 0x01F400 (ignoring that its top bit is actually a sign bit), whose "digits" are 0x01, 0xF4, and 0x00. So the encoded number is (0x00 + 0xF4 * 256 + 0x01 * 256^2) * 256^(0x02 - 3) = 500. Commented Jan 31 at 13:33
• @PieterWuille Did you make a mistake for 154, isn't it 0x019A0000 instead of 0x02009A00? Commented Jan 31 at 14:43