<blockquote>
  <p>I've read that it's some variation of: version, previous block hash,
  merkle root, time, bits, and nonce</p>
</blockquote>

<p>This is exactly right.</p>

<h2>Manually verify block hash</h2>

<p>(thanks to @exmachinalibertas) on <a href="https://www.reddit.com/r/Bitcoin/comments/6gl8ol/how_to_manually_verify_a_hash_from_a_block/" rel="nofollow noreferrer">this reddit comment</a></p>

<ol>
<li><p>Grab a block (eg. block 3): <a href="https://blockchain.info/block/0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449?format=json" rel="nofollow noreferrer">Block 3 in json</a> or <a href="https://blockchain.info/block/0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449?format=hex" rel="nofollow noreferrer">Block 3 in hex</a>
Concatenate (in this order, little endian, hex format) the <strong>version</strong>, <strong>previous block hash</strong>, <strong>merkle root</strong>, <strong>unix epoch time</strong>, <strong>difficulty target (bits)</strong>, and <strong>nonce</strong>. You'll see you can copy the first 160 characters from the <a href="https://blockchain.info/block/0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449?format=hex" rel="nofollow noreferrer">Block 3 in hex link</a>. <code>01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d</code></p></li>
<li><p>Run the terminal command (unix):</p>

<p><code>$ echo 01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d | xxd -r -p | openssl sha -sha256 | xxd -r -p | openssl sha -sha256</code></p></li>
<li><p>Reverse the output from</p></li>
</ol>

<p><code>4944469562ae1c2c74d9a535e00b6f3e40ffbad4f2fda3895501b58200000000</code>
to
<code>0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449</code></p>

<p>And there's the block hash!</p>

<blockquote>
  <p>I'd like to know the exact string I can put into something like this
  and exactly where I can find it</p>
</blockquote>

<p>This likely will not work because it looks like it's expecting a string and it will be strange to try and convert the bytes in the block header to ASCII characters.</p>

<p><strong>Note: You will need to install openssl for terminal. Also, the <code>xxd</code> command will convert the hex string to bytes so the hash is not done on the ASCII bytes.</strong></p>

CC BY-SA 4.0
2018-07-10T13:45:33.680Z
2018-07-10T13:50:40.093Z
2018-07-10T13:50:40.093Z
JBaczuk
<p>I've read that it's some variation of: version, previous block hash, merkle root, time, bits, and nonce, but I'm not certain on where to get this data and how it should be formatted. I'd like to know the exact string I can put into something like <a href="https://www.movable-type.co.uk/scripts/sha256.html" rel="nofollow noreferrer">this</a> and exactly where I can find it. I've followed <a href="https://youtu.be/UZBZPOEVyJA" rel="nofollow noreferrer">this</a> video and downloaded his spreadsheet but am uncertain on which part I can copy into the hash function to get the same output as the spreadsheet. Also wondering about how to convert time to the right format. Thanks in advance.</p>

<mining-theory><hash>
What is the exact input for the hash function?
anon
# What is the exact input for the hash function?

(Asked by: username_0 on 2018-07-10)

I've read that it's some variation of: version, previous block hash, merkle root, time, bits, and nonce, but I'm not certain on where to get this data and how it should be formatted. I'd like to know the exact string I can put into something like [this](https://www.movable-type.co.uk/scripts/sha256.html) and exactly where I can find it. I've followed [this](https://youtu.be/UZBZPOEVyJA) video and downloaded his spreadsheet but am uncertain on which part I can copy into the hash function to get the same output as the spreadsheet. Also wondering about how to convert time to the right format. Thanks in advance.

**Tags:** mining-theory, hash


---

## 1 answers

### Answer by username_1 on 2018-07-10. Score: 1

> I've read that it's some variation of: version, previous block hash,
> merkle root, time, bits, and nonce

This is exactly right.

## Manually verify block hash

(thanks to @exmachinalibertas) on [this reddit comment](https://www.reddit.com/r/Bitcoin/comments/6gl8ol/how_to_manually_verify_a_hash_from_a_block/)

1. Grab a block (eg. block 3): [Block 3 in json](https://blockchain.info/block/0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449?format=json) or [Block 3 in hex](https://blockchain.info/block/0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449?format=hex)
   Concatenate (in this order, little endian, hex format) the **version**, **previous block hash**, **merkle root**, **unix epoch time**, **difficulty target (bits)**, and **nonce**. You'll see you can copy the first 160 characters from the [Block 3 in hex link](https://blockchain.info/block/0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449?format=hex). `01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d`
2. Run the terminal command (unix):

   `$ echo 01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d | xxd -r -p | openssl sha -sha256 | xxd -r -p | openssl sha -sha256`
3. Reverse the output from

`4944469562ae1c2c74d9a535e00b6f3e40ffbad4f2fda3895501b58200000000`
to
`0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449`

And there's the block hash!

> I'd like to know the exact string I can put into something like this
> and exactly where I can find it

This likely will not work because it looks like it's expecting a string and it will be strange to try and convert the bytes in the block header to ASCII characters.

**Note: You will need to install openssl for terminal. Also, the `xxd` command will convert the hex string to bytes so the hash is not done on the ASCII bytes.**


---

