From https://en.bitcoin.it/wiki/Difficulty:

How is difficulty stored in blocks?

Each block stores a packed representation (called "Bits") for its actual hexadecimal target. The target can be derived from it via a predefined formula. For example, if the packed target in the block is 0x1b0404cb (stored in little-endian order: cb 04 04 1b), the hexadecimal target is

0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000

Note that this packed format contains a sign bit in the 24th bit, and for example the negation of the above target would be 0x1b8404cb in packed format. Since targets are never negative in practice, however, this means the largest legal value for the lower 24 bits is 0x7fffff. Additionally, 0x008000 is the smallest legal value for the lower 24 bits since targets are always stored with the lowest possible exponent.

What does the last sentence mean? I don't understand why there is a lower bound.

  • 1
    You don't derive it. It's just a rule that that is the smallest legal value, whether that rule makes sense or not. Jan 31, 2022 at 16:12

1 Answer 1


If we used any number less than 0x008000 in the lower 24 bits, then the exponent could be lowered, violating the rule that "targets are always stored with the lowest possible exponent."

For example, 0x05007fff (big endian) has exponent 0x05, so this represents 0x007fff * 2^(16). Then we could have written 0x047fff00 to represent the same number, because

0x7fff00 * 2^8 = 0x007fff * 2^16

You cannot do the same with 0x008000 though, because attempting to reduce the exponent and multiply the mantissa by 2^8 will produce a mantissa of 0x800000, which is negative (the 24th bit is a sign bit). the difficulty target must be a positive number, so this sign bit must always be set to 0.

  • Thank you so much for your clear explanation! :D Feb 4, 2022 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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