<p>The formula for the conversion can be found on <a href="https://en.bitcoin.it/wiki/Difficulty" rel="nofollow noreferrer">the bitcoin wiki</a>.</p>

<p>Essentially, the first byte indicates the number of trailing 0 bytes (minus 3 for some reason). The remaining 3 bytes are the next 3 bytes of the target.</p>

<p>So <code>0x1d00fffff</code> has <code>0x00ffff</code> followed by <code>0x1d - 3 = 26</code> trailing 0 bytes with the whole thing padded out to 32 bytes. So the final result is <code>0x00000000ffff00000000000000000000000000000000000000000000000000000</code>.</p>

CC BY-SA 4.0
2020-05-20T21:38:56.680Z
2020-05-20T21:38:56.680Z
Ava Chow
<p>I remember some where was table and python scrypt for do this , when reinstall my debian i was lose this script.</p>

<p>Example we hv uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); 
what is = 0x1d00ffff</p>

<altcoin><genesis-block><nbits>
How to calculate nbits from powlimit
tseries
# How to calculate nbits from powlimit

(Asked by: username_0 on 2020-05-19)

I remember some where was table and python scrypt for do this , when reinstall my debian i was lose this script.

Example we hv uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
what is = 0x1d00ffff

**Tags:** altcoin, genesis-block, nbits


---

## 1 answers

### Answer by username_1 on 2020-05-20. Score: 1 | Accepted answer

The formula for the conversion can be found on [the bitcoin wiki](https://en.bitcoin.it/wiki/Difficulty).

Essentially, the first byte indicates the number of trailing 0 bytes (minus 3 for some reason). The remaining 3 bytes are the next 3 bytes of the target.

So `0x1d00fffff` has `0x00ffff` followed by `0x1d - 3 = 26` trailing 0 bytes with the whole thing padded out to 32 bytes. So the final result is `0x00000000ffff00000000000000000000000000000000000000000000000000000`.


---

