<p>If we used any number less than <code>0x008000</code> in the lower 24 bits, then the exponent could be lowered, violating the rule that &quot;targets are always stored with the lowest possible exponent.&quot;</p>
<p>For example, <code>0x05007fff</code> (big endian) has exponent <code>0x05</code>, so this represents <code>0x007fff * 2^(16)</code>. Then we could have written <code>0x047fff00</code> to represent the same number, because</p>
<pre><code>0x7fff00 * 2^8 = 0x007fff * 2^16
</code></pre>
<p>You cannot do the same with <code>0x008000</code> though, because attempting to reduce the exponent and multiply the mantissa by 2^8 will produce a mantissa of <code>0x800000</code>, 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.</p>

CC BY-SA 4.0
2022-02-04T03:15:11.743Z
Thank you so much for your clear explanation! :D
strawberries
CC BY-SA 4.0
2022-02-01T22:34:24.703Z
2022-02-02T02:42:39.703Z
2022-02-02T02:42:39.703Z
meshcollider
<p>From <a href="https://en.bitcoin.it/wiki/Difficulty" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Difficulty</a>:</p>
<blockquote>
<p>How is difficulty stored in blocks?</p>
<p>Each block stores a packed representation (called &quot;Bits&quot;) 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</p>
<pre><code>0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000
</code></pre>
<p>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. <strong>Additionally, 0x008000 is the smallest legal value for the lower 24 bits since targets are always stored with the lowest possible exponent.</strong></p>
</blockquote>
<p><em>What does the last sentence mean? I don't understand why there is a lower bound.</em></p>

CC BY-SA 4.0
2022-01-31T16:12:30.307Z
You don't derive it. It's just a rule that that is the smallest legal value, whether that rule makes sense or not.
Pieter Wuille
<difficulty>
How do you derive "0x008000 is the smallest legal value for the lower 24 bits since targets are always stored with the lowest possible exponent"?
strawberries
# How do you derive "0x008000 is the smallest legal value for the lower 24 bits since targets are always stored with the lowest possible exponent"?

(Asked by: username_0 on 2022-01-31)

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.*

**Tags:** difficulty

> **Comments:**
> **username_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.  

---

## 1 answers

### Answer by username_2 on 2022-02-01. Score: 1 | Accepted answer

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.

> **Comments:**
> **username_0**: Thank you so much for your clear explanation! :D  

---

