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...
0x00000000
(0),0x01010000
(1),0x01020000
...0x017F0000
(2 - 127)0x02008000
(128)0x02008100
(129)0x02008200
...0x027FFF00
(130 - 32767)0x03008000
(32768) and so on...