<p>The bits value you have written is in decimal, in hex it is <code>0x181b7b74</code></p>

<p>We split this into the exponent and mantissa as shown in this answer: <a href="https://bitcoin.stackexchange.com/a/61951/51948">https://bitcoin.stackexchange.com/a/61951/51948</a></p>

<p><code>0x18</code> in decimal is 24, so we calculate the target to be:
<code>0x1b7b74000000000000000000000000000000000000000000</code></p>

<p>Now as the target takes up 24 bytes, out of the total 32 bytes for a block hash, the remaining 8 bytes must be 0's in order for the hash to be less than the target  (as well as the rest of the number being less than, of course). Usually leading 0's are omitted for readibility, but 8 zero bytes is written as 16 zero characters in hexadecimal, which is why the hash must have at least 16 leading zeros - which it does. </p>

CC BY-SA 3.0
2017-11-05T12:58:16.123Z
Thus, the number to be compared is 0x00000000000000001b7b74000000000000000000000000000000000000000000. In another words, number lower end equal than 0x1B7B73FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF are the solutions for the problem. Am I correct?
JRbarros
CC BY-SA 3.0
2017-11-04T19:29:07.187Z
2017-11-04T19:29:07.187Z
meshcollider
<p>I am trying to understand how can I check if my Block Hash satisfies or not the nBits.</p>
<p>For example, for block 506679 (<a href="https://blockchain.info/block-index/506679" rel="nofollow noreferrer">https://blockchain.info/block-index/506679</a>):</p>
<blockquote>
<p>nBits: 404454260</p>
<p>Block Hash: 000000000000000015A8D88216918C8DE090268A5E7F53FEEF72CD111F7F27FF</p>
</blockquote>
<p>How can I double check that this Block Hash satisfies the nBits?</p>
<p>PS: I have already read the <a href="https://bitcoin.stackexchange.com/questions/57184/what-does-the-nbits-value-represent/57186#57186">What does the nBits value represent?</a> but I could not find the answer.</p>

CC BY-SA 3.0
2017-11-04T12:49:30.997Z
Try this answer: https://bitcoin.stackexchange.com/a/61951/51948
meshcollider
CC BY-SA 3.0
2017-11-04T12:56:35.310Z
The answer gave there is the same example I have seen over and over. But makes no sense. Because according to that calculation, for the block 506679, the Block Hash should have 21 leading zeros, but in reality, the Block Hash is 16 leading zeros.
JRbarros
<blockchain><block><hash><difficulty>
nBit to leading zeros in Block Hash
JRbarros
# nBit to leading zeros in Block Hash

(Asked by: username_0 on 2017-11-04)

I am trying to understand how can I check if my Block Hash satisfies or not the nBits.

For example, for block 506679 (<https://blockchain.info/block-index/506679>):

> nBits: 404454260
>
> Block Hash: 000000000000000015A8D88216918C8DE090268A5E7F53FEEF72CD111F7F27FF

How can I double check that this Block Hash satisfies the nBits?

PS: I have already read the [What does the nBits value represent?](https://bitcoin.stackexchange.com/questions/57184/what-does-the-nbits-value-represent/57186#57186) but I could not find the answer.

**Tags:** blockchain, block, hash, difficulty

> **Comments:**
> **username_1**: Try this answer: https://bitcoin.stackexchange.com/a/61951/51948  
> **username_0**: The answer gave there is the same example I have seen over and over. But makes no sense. Because according to that calculation, for the block 506679, the Block Hash should have 21 leading zeros, but in reality, the Block Hash is 16 leading zeros.  

---

## 1 answers

### Answer by username_1 on 2017-11-04. Score: 1

The bits value you have written is in decimal, in hex it is `0x181b7b74`

We split this into the exponent and mantissa as shown in this answer: <https://bitcoin.stackexchange.com/a/61951/51948>

`0x18` in decimal is 24, so we calculate the target to be:
`0x1b7b74000000000000000000000000000000000000000000`

Now as the target takes up 24 bytes, out of the total 32 bytes for a block hash, the remaining 8 bytes must be 0's in order for the hash to be less than the target (as well as the rest of the number being less than, of course). Usually leading 0's are omitted for readibility, but 8 zero bytes is written as 16 zero characters in hexadecimal, which is why the hash must have at least 16 leading zeros - which it does.

> **Comments:**
> **username_0**: Thus, the number to be compared is 0x00000000000000001b7b74000000000000000000000000000000000000000000. In another words, number lower end equal than 0x1B7B73FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF are the solutions for the problem. Am I correct?  

---

