<blockquote>
  <p>Which is the actual block header hash that has to be less than the target value? </p>
</blockquote>

<p>Both.</p>

<p>SHA256 produces an array of 32 bytes as output. Bitcoin treats those 32 bytes as a 256-bit <strong>LSB</strong> integer (least significant bit first). It is this integer that is compared to the target.</p>

<p>However, as humans are used to seeing numbers formatted in MSB order (most significant bit first), that too is what happens in Bitcoin. The formatting with the zeroes up front is <em>not</em> the output of the hash function. It is the output of the hash function, interpreted as an LSB-encoded integer, and then formatted in hexadecimal in MSB order.</p>

CC BY-SA 3.0
2018-04-17T21:30:46.270Z
Thanks very much. So just to be clear it is 0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6 that is compared to the target?
MSJ
CC BY-SA 3.0
2018-04-17T21:54:37.713Z
That depends what you mean by "00000...afc6". If that is your way of writing an integer with the most significant hex character first, yes.
Pieter Wuille
CC BY-SA 3.0
2018-04-17T23:29:17.110Z
Okay, and by LSB did you really mean Lease Significant Byte first as opposed to Least Significant Bit?
MSJ
CC BY-SA 3.0
2018-04-17T23:35:06.793Z
There is no distinction between the two when the smallest unit you're looking at is bytes. I mean bits.
Pieter Wuille
CC BY-SA 3.0
2018-04-17T21:23:38.843Z
2018-04-18T17:43:20.363Z
2018-04-18T17:43:20.363Z
Pieter Wuille
<p>When I go to BlockExplorer and observe the hash of block 514441's header I see it to be:</p>

<p>0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6</p>

<p>However when I obtain the header of block 514441 from:</p>

<p><a href="https://blockchain.info/rawblock/0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6?format=hex" rel="nofollow noreferrer">https://blockchain.info/rawblock/0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6?format=hex</a></p>

<p>and I double hash the first 640 bits using Java's SHA256 implementation I get the following (they are byte reversals of each other):</p>

<p>c6 af 0f c1 7d 8e 52 3e c2 9c 19 ab 80 0e dc d3 2c 8b 4d 88 16 c9 4e 00 00 00 00 00 00 00 00 00 </p>

<p>Which is the actual block header hash that has to be less than the target value? </p>

<block-header>
What should be less than the target?
MSJ
# What should be less than the target?

(Asked by: username_0 on 2018-04-17)

When I go to BlockExplorer and observe the hash of block 514441's header I see it to be:

0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6

However when I obtain the header of block 514441 from:

<https://blockchain.info/rawblock/0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6?format=hex>

and I double hash the first 640 bits using Java's SHA256 implementation I get the following (they are byte reversals of each other):

c6 af 0f c1 7d 8e 52 3e c2 9c 19 ab 80 0e dc d3 2c 8b 4d 88 16 c9 4e 00 00 00 00 00 00 00 00 00

Which is the actual block header hash that has to be less than the target value?

**Tags:** block-header


---

## 1 answers

### Answer by username_1 on 2018-04-17. Score: 2

> Which is the actual block header hash that has to be less than the target value?

Both.

SHA256 produces an array of 32 bytes as output. Bitcoin treats those 32 bytes as a 256-bit **LSB** integer (least significant bit first). It is this integer that is compared to the target.

However, as humans are used to seeing numbers formatted in MSB order (most significant bit first), that too is what happens in Bitcoin. The formatting with the zeroes up front is *not* the output of the hash function. It is the output of the hash function, interpreted as an LSB-encoded integer, and then formatted in hexadecimal in MSB order.

> **Comments:**
> **username_0**: Thanks very much. So just to be clear it is 0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6 that is compared to the target?  
> **username_1**: That depends what you mean by "00000...afc6". If that is your way of writing an integer with the most significant hex character first, yes.  
> **username_0**: Okay, and by LSB did you really mean Lease Significant Byte first as opposed to Least Significant Bit?  
> **username_1**: There is no distinction between the two when the smallest unit you're looking at is bytes. I mean bits.  

---

