<p>I haven't followed the details of your calculation but I noticed:</p>
<blockquote>
<p>hash of previous block = 0x0000000000000000000000000000000000000000000000000000000000000000</p>
</blockquote>
<p>That seems wrong for block 1 because it should have the hash of block 0 (known as the Genesis block).</p>
<p>In my copy of the blockchain, block 1 has a non-zero value for hash of previous block.</p>

CC BY-SA 4.0
2022-02-22T20:35:08.523Z
2022-02-22T21:15:58.073Z
2022-02-22T21:15:58.073Z
RedGrittyBrick
<p>So I'm trying to validade a bitcoin block just for curiosity, let's take for example bitcoin block #1 (<a href="https://bitpay.com/insight/#/BTC/mainnet/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048" rel="nofollow noreferrer">https://bitpay.com/insight/#/BTC/mainnet/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048</a>)
So the header will be something like:</p>
<ul>
<li>version = 0x00000001</li>
<li>hash of previous block = 0x0000000000000000000000000000000000000000000000000000000000000000</li>
<li>hash of merkle root = 0x0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098</li>
<li>time stamp = 0x49676521 (9th jan 2009, 12:54:25 GMT-2)</li>
<li>Target = 0x1d00ffff</li>
<li>Nonce = 0x9962E301 (2573394689 in hex)</li>
</ul>
<p>So the final header is: &quot;0x0000000100000000000000000000000000000000000000000000000000000000000000000e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098496765211d00ffff9962E301&quot;, but when I use this header here: &quot;https://emn178.github.io/online-tools/sha256.html&quot;
I get the first answer &quot;0x8b35dccfcd6775827147594afa923bcc2b10645ef24aa3d22b22c2b0bed17ea2&quot; and I use the first answer to get the double sha-256 but I'm getting &quot;4d154a2d19d08ccc9328bcce8d965bdd3285035a40936fb43fd8da4d9dc5392e&quot; instead of the &quot;00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048&quot; that I was expecting. Does anyone have any idea of what I'm doing wrong? Maybe the site is wrong?</p>

<bitcoin-core><block><bitcoin-core-development><validation><source-code>
Trying to validade a bitcoin block
Gabriel Lucas
# Trying to validade a bitcoin block

(Asked by: username_0 on 2022-02-20)

So I'm trying to validade a bitcoin block just for curiosity, let's take for example bitcoin block #1 (<https://bitpay.com/insight/#/BTC/mainnet/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048>)
So the header will be something like:

* version = 0x00000001
* hash of previous block = 0x0000000000000000000000000000000000000000000000000000000000000000
* hash of merkle root = 0x0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098
* time stamp = 0x49676521 (9th jan 2009, 12:54:25 GMT-2)
* Target = 0x1d00ffff
* Nonce = 0x9962E301 (2573394689 in hex)

So the final header is: "0x0000000100000000000000000000000000000000000000000000000000000000000000000e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098496765211d00ffff9962E301", but when I use this header here: "https://emn178.github.io/online-tools/sha256.html"
I get the first answer "0x8b35dccfcd6775827147594afa923bcc2b10645ef24aa3d22b22c2b0bed17ea2" and I use the first answer to get the double sha-256 but I'm getting "4d154a2d19d08ccc9328bcce8d965bdd3285035a40936fb43fd8da4d9dc5392e" instead of the "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048" that I was expecting. Does anyone have any idea of what I'm doing wrong? Maybe the site is wrong?

**Tags:** bitcoin-core, block, bitcoin-core-development, validation, source-code


---

## 1 answers

### Answer by username_1 on 2022-02-22. Score: 1

I haven't followed the details of your calculation but I noticed:

> hash of previous block = 0x0000000000000000000000000000000000000000000000000000000000000000

That seems wrong for block 1 because it should have the hash of block 0 (known as the Genesis block).

In my copy of the blockchain, block 1 has a non-zero value for hash of previous block.


---

