# nBit to leading zeros in Block Hash

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? but I could not find the answer.

• Try this answer: bitcoin.stackexchange.com/a/61951/51948 Commented Nov 4, 2017 at 12:49
• 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. Commented Nov 4, 2017 at 12:56

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.

• 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? Commented Nov 5, 2017 at 12:58