<p>I had the same problem about a year ago. You should perhaps look into hashing the <a href="https://en.bitcoin.it/wiki/Genesis_block" rel="nofollow">Genesis Block</a>. In its hex form, it looks like:</p>

<p>0100000000000000000000000000000000000000000000000000000000000000000000003BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A29AB5F49FFFF001D1DAC2B7C0101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF4D04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73FFFFFFF0100F2052A01000000434104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC00000000</p>

<p>When properly hashed, it should take a form of:</p>

<p>000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f (can appear in reverse order).</p>

<p>Just note that the hashing function can be a bit tricky at times.</p>

CC BY-SA 3.0
2012-06-13T20:15:32.937Z
2012-06-13T20:15:32.937Z
ThePiachu
<p>See the Merkle Tree Example:</p>

<blockquote>
  <p>note that the byte order for displaying these hashes is basically
  exactly backwards vs. normal notation I'm using hex strings without
  quotes to show bytes-as-they-would-be-in-memory and in quotes to show
  uint256s in hex like in blockexplorer or returned by bitcoin rpc</p>
  
  <p>tx hashes for that block:
  "3a459eab5f0cf8394a21e04d2ed3b2beeaa59795912e20b9c680e9db74dfb18c"
  "be38f46f0eccba72416aed715851fd07b881ffb7928b7622847314588e06a6b7"
  "d173f2a12b6ff63a77d9fe7bbb590bdb02b826d07739f90ebb016dc9297332be"
  "59d1e83e5268bbb491234ff23cbbf2a7c0aa87df553484afee9e82385fc7052f"
  "f1ce77a69d06efb79e3b08a0ff441fa3b1deaf71b358df55244d56dd797ac60c"
  "84053cba91fe659fd3afa1bf2fd0e3746b99215b50cd74e44bda507d8edf52e0"
  again, that's when you read them as uint256s, little-endian all the
  way, so "bytes in memory" those really are:
  8cb1df74dbe980c6b9202e919597a5eabeb2d32e4de0214a39f80c5fab9e453a
  b7a6068e5814738422768b92b7ff81b807fd515871ed6a4172bacc0e6ff438be ...
  so, to start the merkle building, we do sha256(sha256(h1 . h2)) for
  the first two result:
  2dd3ce205cf8d03f773d46d24becfd72c766deaa0d1327d7e4c810265f59a313 again
  read it backwards because we display stuff in little-endian, and...
  "13a3595f2610c8e4d727130daade66c772fdec4bd2463d773fd0f85c20ced32d"
  looks familiar? do the same for "d173..." and "59d1..." and...
  "f6ae335dc2d2aecb6a255ebd03caaf6820e6c0534531051066810080e0d822c8"
  last pair...
  "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"</p>
  
  <p>now we only have 3, so last one gets concat'd with itself
  "13a3595f2610c8e4d727130daade66c772fdec4bd2463d773fd0f85c20ced32d"
  "f6ae335dc2d2aecb6a255ebd03caaf6820e6c0534531051066810080e0d822c8"
  gives
  "59545fd8dfdd821ca7accecab0655d77437f5bba5aaa5ea8c042a26bc9ae514b"</p>
  
  <p>"a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
  "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
  gives
  "15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3"</p>
  
  <p>and final level of the tree
  "59545fd8dfdd821ca7accecab0655d77437f5bba5aaa5ea8c042a26bc9ae514b"
  "15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3"
  gives
  "9cdf7722eb64015731ba9794e32bdefd9cf69b42456d31f5e59aedb68c57ed52"</p>
</blockquote>

<ul>
<li><a href="http://bitcointalk.org/index.php?topic=44707.msg534605#msg534605" rel="nofollow">http://bitcointalk.org/index.php?topic=44707.msg534605#msg534605</a></li>
</ul>

CC BY-SA 3.0
2012-06-13T20:08:09.363Z
2012-06-13T20:08:09.363Z
Stephen Gornick
<p>Ordering the bytes that make up a block so that you can hash them seems to be fairly complex, but if all you're looking for is an arbitrary string that hashes to something beginning with a few zeroes, you can search using a simple shell command:</p>

<pre><code>$ i=0; while true; do echo -n $i | sha256sum | grep -q '^000' &amp;&amp;
      echo $i $(echo -n $i | sha256sum); ((i++)); done
  886 000f21ac06aceb9cdd0575e82d0d85fc39bed0a7a1d71970ba1641666a44f530 -
 1039 00037f39cf870a1f49129f9c82d935665d352ffd25ea3296208f6f7b16fd654f -
 3633 00039a15178b11924de22fd1a02f6efb00d8af33c171a6b67614871e8d6012da -
 5848 000c15d0ea8224c9649c9adee30c3030ee769b2b5f6d6594f94d446adf60396b -
12823 000b07fd81c1770b514fb2998527b682c4600e0e76868011bae89a265505f652 -
20069 0002dc999ce736640267221e6a004da4b837667ca7de5c8eb92832927495013f -
21098 0007256972781977cbceab0e2cbdc57e20512a6f2975296852029da5bc8aad30 -
21244 0002a1cf14e9c1acaa8255fd6777d916d3aec6bc1f3c8a3d0a3a89a5eba87970 -
22244 00092cab56c063b7dadedbb2282decacf40d6eb31319a7ef9a6e7e7a5e0d49b7 -
23452 000f910e13e5d1b34df0a3a0fb537acaf513be60d650286e45dcdbd3d8e698f6 -
30050 000954408f96d137e3cfe0711be7856f44c4b6821d5a5d4955c87748a34118ed -
32754 000faf0e6178d6edb8490f90dcbbc33d33bf0de4783b5722bdcefff05d8748b1 -
41697 000580eb995f2a45fffce7c2651e542668ea65c1b4b89f5057601698894009ae -
48559 000eb4a177d716901148633ce477d51675b2677ba45fbc0da5125d35e1feb52b -
51623 0006412efdac205d9da274bf441e567da353fc59ee098239255bf532c9562e90 -
53278 0006220135126a47891f08c4dea54763bcb3675d322e49f064ed80c1491a422a -
60147 000f008e65121d99595e27fcb7a6ba12bc85db5289bd36b00a2654170d8d8404 -
64478 00060ae0df51bd4b2a190eb8d8bd927426601899b2bbee136a4d06dd1f39159b -
65565 000b1e1a1268f245d534e7c9ea2cef6c7123e66c9ffa5ea8848e2319d163662f -
77379 00064a5ab8c2a955d74b6b1e537d76314c61811323c803dd38cbe1c9ed111620 -
84057 0006da78c87d0454d102ec03e609a7b1a22381693e020ab1ebdf0050af9f7a7c -
86423 0009d671d687b1e712a501a25b1887bb93d091144d294a03e7368df35faeebfc -
88484 0000a456e7b5a5eb059e721fb431436883143101275c4077f83fe70298f5623d -
90947 000318ec4d26f57a5facb03401d2f879a4b5c3cb95bc2bdca378ce078833733d -
91415 0001528a3705455624f234a9066cca979b7516cdc417f5e39845b32eb107d467 -
94286 000846f85c9630becba208506e1585d2b09340e33860887403a56fd4eeaa7ea0 -
96635 0001da624eada828c3f744b73bacd8e15cf0d3e288bd092d68167dd1bab66e76 -
96952 00064ea7e7d6798cc16d9e7723150ee9a170416f05a61b7d45edd2c28ecd69f6 -
</code></pre>

<p>Here I'm hashing digit strings and searching for hashes which begin with at least three zeroes.  You would expect to find one every 4096 attempts on average, but we got lucky and found three in the first 4096 attempts.  The shell command would run forever.  I cut off the output once after the first 100,000 attempts.</p>

<p>We would expect to find a hash beginning with 4 zeroes every 65,536 attempts, and it actually takes us 88,484 attempts to find the first one:</p>

<pre><code>$ echo -n 88484 | sha256sum
0000a456e7b5a5eb059e721fb431436883143101275c4077f83fe70298f5623d  -
</code></pre>

<p>The '-n' flag to echo means 'just output 88484, don't put a newline on the end'.  The newline would change the hash.</p>

<p>We can also search through the list of words in the official Scrabble dictionary to find the five with hashes that begin with four or more zeroes:</p>

<pre><code>$ cat ~/sowpods.txt | tr A-Z a-z | while read x; do echo -n "$x" |
      sha256sum | grep -q '^0000' &amp;&amp; echo $x $(echo -n $x | sha256sum); done
debearded 0000fa20ee307c4f15a53bf69ae0ca1c66c675b0ae94781ff5b6f8cff90ebcca -
goaltenders 00002e68c9d3d1fc5d3178bee91040efbeb4ac9ea7722c834fa5d71b2e3845cd -
guilefulness 0000d79e1c6964e6806e9bbdaaaecb63dfabdb498f72bf28944119de1fe90d63 -
mismatchment 0000bb6ede9f29a01d35e15320229aa0fbd73cf8eb8bc0aac80d6a97fba63fee -
santalins 00008514dabda7cffdb10f57e492fadbd8e0cab00427e0bfa4f54248b602a4f0 -
</code></pre>

<p>and the same for uppercase words:</p>

<pre><code>$ cat ~/sowpods.txt | while read x; do echo -n "$x" |
      sha256sum | grep -q '^0000' &amp;&amp; echo $x $(echo -n $x | sha256sum); done
APPLICANT 0000ca01adc973c2a5a8e6a30134f07396d088b6d65025292f6ff97b237cab4d -
JACKEROOED 0000182955fd82edd0acc949ea5050a0f8c7107c5dbed07f94f474cc1c31be90 -
KYE 0000331b9f8ffef05bbee59dca2a7b03e281e22bf1d3d9324f607ad8eb1fbb64 -
RECREANCES 0000392b2a9f2d9ff2bbc35b8fddfdbb91f73cb7a43602782280ae69d13146e3 -
SCHILLERIZE 000010f44bb61a7805f10dbd90c3c51a67da52001858ee45e0d015c38a344fb1 -
STRIVINGLY 000034f8005572e686cc2f4628107bd16e339d86cbe4d5309105ebb42e8b07dd -
UNDETERRED 00006433ddbde4028b88a4ca8d6c578641462697134bd1936693a1f1b05b4224 -
WIDDIES 000000c71f1bda5b63f5165243e10394bc9ebf62e394ef7c6e049c920ea1b181 -
</code></pre>

<p>Notice <a href="http://www.merriam-webster.com/dictionary/widdy" rel="noreferrer"><code>WIDDIES</code></a> is the only one with a hash starting with five zeroes (it actually begins with six zeroes - a 1 in 16.7 million chance), making it the (official British English scrabble) word with the lowest sha256 hash.</p>

CC BY-SA 3.0
2012-06-13T20:45:00.353Z
2012-06-17T23:59:52.077Z
2012-06-17T23:59:52.077Z
Chris Moore
<p>So as my understanding goes, there's some input (block header) that needs to be altered (via a nonce or other mechanism) which is run through a SHA256 to generate an output with X amount of leading 0's.</p>

<p>I've tried (manually), just for fun, to find an input that will hash out to even 2 consecutive leading 0's with no luck.</p>

<p>Where can I find an input, so that I can hash it, to a correct output?</p>

CC BY-SA 3.0
2012-06-13T20:03:27.383Z
I believe it is a blob that is hashed.  

Perhaps BlockExplorer's "raw block" will show the data from the Blob though:

 - http://blockexplorer.com/rawblock/000000000000063a02a2fe35a8afb9d8ab1920b04f1a75b470eaab3669445c68
Stephen Gornick
<sha256><nonce><hash>
Where can I see an input that will hash to a solution?
Shamoon
# Where can I see an input that will hash to a solution?

(Asked by: username_0 on 2012-06-13)

So as my understanding goes, there's some input (block header) that needs to be altered (via a nonce or other mechanism) which is run through a SHA256 to generate an output with X amount of leading 0's.

I've tried (manually), just for fun, to find an input that will hash out to even 2 consecutive leading 0's with no luck.

Where can I find an input, so that I can hash it, to a correct output?

**Tags:** sha256, nonce, hash

> **Comments:**
> **username_1**: I believe it is a blob that is hashed.    Perhaps BlockExplorer's "raw block" will show the data from the Blob though:   - http://blockexplorer.com/rawblock/000000000000063a02a2fe35a8afb9d8ab1920b04f1a75b470eaab3669445c68  

---

## 3 answers

### Answer by username_3 on 2012-06-13. Score: 6 | Accepted answer

Ordering the bytes that make up a block so that you can hash them seems to be fairly complex, but if all you're looking for is an arbitrary string that hashes to something beginning with a few zeroes, you can search using a simple shell command:

```
$ i=0; while true; do echo -n $i | sha256sum | grep -q '^000' &&
      echo $i $(echo -n $i | sha256sum); ((i++)); done
  886 000f21ac06aceb9cdd0575e82d0d85fc39bed0a7a1d71970ba1641666a44f530 -
 1039 00037f39cf870a1f49129f9c82d935665d352ffd25ea3296208f6f7b16fd654f -
 3633 00039a15178b11924de22fd1a02f6efb00d8af33c171a6b67614871e8d6012da -
 5848 000c15d0ea8224c9649c9adee30c3030ee769b2b5f6d6594f94d446adf60396b -
12823 000b07fd81c1770b514fb2998527b682c4600e0e76868011bae89a265505f652 -
20069 0002dc999ce736640267221e6a004da4b837667ca7de5c8eb92832927495013f -
21098 0007256972781977cbceab0e2cbdc57e20512a6f2975296852029da5bc8aad30 -
21244 0002a1cf14e9c1acaa8255fd6777d916d3aec6bc1f3c8a3d0a3a89a5eba87970 -
22244 00092cab56c063b7dadedbb2282decacf40d6eb31319a7ef9a6e7e7a5e0d49b7 -
23452 000f910e13e5d1b34df0a3a0fb537acaf513be60d650286e45dcdbd3d8e698f6 -
30050 000954408f96d137e3cfe0711be7856f44c4b6821d5a5d4955c87748a34118ed -
32754 000faf0e6178d6edb8490f90dcbbc33d33bf0de4783b5722bdcefff05d8748b1 -
41697 000580eb995f2a45fffce7c2651e542668ea65c1b4b89f5057601698894009ae -
48559 000eb4a177d716901148633ce477d51675b2677ba45fbc0da5125d35e1feb52b -
51623 0006412efdac205d9da274bf441e567da353fc59ee098239255bf532c9562e90 -
53278 0006220135126a47891f08c4dea54763bcb3675d322e49f064ed80c1491a422a -
60147 000f008e65121d99595e27fcb7a6ba12bc85db5289bd36b00a2654170d8d8404 -
64478 00060ae0df51bd4b2a190eb8d8bd927426601899b2bbee136a4d06dd1f39159b -
65565 000b1e1a1268f245d534e7c9ea2cef6c7123e66c9ffa5ea8848e2319d163662f -
77379 00064a5ab8c2a955d74b6b1e537d76314c61811323c803dd38cbe1c9ed111620 -
84057 0006da78c87d0454d102ec03e609a7b1a22381693e020ab1ebdf0050af9f7a7c -
86423 0009d671d687b1e712a501a25b1887bb93d091144d294a03e7368df35faeebfc -
88484 0000a456e7b5a5eb059e721fb431436883143101275c4077f83fe70298f5623d -
90947 000318ec4d26f57a5facb03401d2f879a4b5c3cb95bc2bdca378ce078833733d -
91415 0001528a3705455624f234a9066cca979b7516cdc417f5e39845b32eb107d467 -
94286 000846f85c9630becba208506e1585d2b09340e33860887403a56fd4eeaa7ea0 -
96635 0001da624eada828c3f744b73bacd8e15cf0d3e288bd092d68167dd1bab66e76 -
96952 00064ea7e7d6798cc16d9e7723150ee9a170416f05a61b7d45edd2c28ecd69f6 -

```

Here I'm hashing digit strings and searching for hashes which begin with at least three zeroes. You would expect to find one every 4096 attempts on average, but we got lucky and found three in the first 4096 attempts. The shell command would run forever. I cut off the output once after the first 100,000 attempts.

We would expect to find a hash beginning with 4 zeroes every 65,536 attempts, and it actually takes us 88,484 attempts to find the first one:

```
$ echo -n 88484 | sha256sum
0000a456e7b5a5eb059e721fb431436883143101275c4077f83fe70298f5623d  -

```

The '-n' flag to echo means 'just output 88484, don't put a newline on the end'. The newline would change the hash.

We can also search through the list of words in the official Scrabble dictionary to find the five with hashes that begin with four or more zeroes:

```
$ cat ~/sowpods.txt | tr A-Z a-z | while read x; do echo -n "$x" |
      sha256sum | grep -q '^0000' && echo $x $(echo -n $x | sha256sum); done
debearded 0000fa20ee307c4f15a53bf69ae0ca1c66c675b0ae94781ff5b6f8cff90ebcca -
goaltenders 00002e68c9d3d1fc5d3178bee91040efbeb4ac9ea7722c834fa5d71b2e3845cd -
guilefulness 0000d79e1c6964e6806e9bbdaaaecb63dfabdb498f72bf28944119de1fe90d63 -
mismatchment 0000bb6ede9f29a01d35e15320229aa0fbd73cf8eb8bc0aac80d6a97fba63fee -
santalins 00008514dabda7cffdb10f57e492fadbd8e0cab00427e0bfa4f54248b602a4f0 -

```

and the same for uppercase words:

```
$ cat ~/sowpods.txt | while read x; do echo -n "$x" |
      sha256sum | grep -q '^0000' && echo $x $(echo -n $x | sha256sum); done
APPLICANT 0000ca01adc973c2a5a8e6a30134f07396d088b6d65025292f6ff97b237cab4d -
JACKEROOED 0000182955fd82edd0acc949ea5050a0f8c7107c5dbed07f94f474cc1c31be90 -
KYE 0000331b9f8ffef05bbee59dca2a7b03e281e22bf1d3d9324f607ad8eb1fbb64 -
RECREANCES 0000392b2a9f2d9ff2bbc35b8fddfdbb91f73cb7a43602782280ae69d13146e3 -
SCHILLERIZE 000010f44bb61a7805f10dbd90c3c51a67da52001858ee45e0d015c38a344fb1 -
STRIVINGLY 000034f8005572e686cc2f4628107bd16e339d86cbe4d5309105ebb42e8b07dd -
UNDETERRED 00006433ddbde4028b88a4ca8d6c578641462697134bd1936693a1f1b05b4224 -
WIDDIES 000000c71f1bda5b63f5165243e10394bc9ebf62e394ef7c6e049c920ea1b181 -

```

Notice [`WIDDIES`](http://www.merriam-webster.com/dictionary/widdy) is the only one with a hash starting with five zeroes (it actually begins with six zeroes - a 1 in 16.7 million chance), making it the (official British English scrabble) word with the lowest sha256 hash.


---

### Answer by username_2 on 2012-06-13. Score: 2

I had the same problem about a year ago. You should perhaps look into hashing the [Genesis Block](https://en.bitcoin.it/wiki/Genesis_block). In its hex form, it looks like:

0100000000000000000000000000000000000000000000000000000000000000000000003BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A29AB5F49FFFF001D1DAC2B7C0101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF4D04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73FFFFFFF0100F2052A01000000434104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC00000000

When properly hashed, it should take a form of:

000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f (can appear in reverse order).

Just note that the hashing function can be a bit tricky at times.


---

### Answer by username_1 on 2012-06-13. Score: 0

See the Merkle Tree Example:

> note that the byte order for displaying these hashes is basically
> exactly backwards vs. normal notation I'm using hex strings without
> quotes to show bytes-as-they-would-be-in-memory and in quotes to show
> uint256s in hex like in blockexplorer or returned by bitcoin rpc
>
> tx hashes for that block:
> "3a459eab5f0cf8394a21e04d2ed3b2beeaa59795912e20b9c680e9db74dfb18c"
> "be38f46f0eccba72416aed715851fd07b881ffb7928b7622847314588e06a6b7"
> "d173f2a12b6ff63a77d9fe7bbb590bdb02b826d07739f90ebb016dc9297332be"
> "59d1e83e5268bbb491234ff23cbbf2a7c0aa87df553484afee9e82385fc7052f"
> "f1ce77a69d06efb79e3b08a0ff441fa3b1deaf71b358df55244d56dd797ac60c"
> "84053cba91fe659fd3afa1bf2fd0e3746b99215b50cd74e44bda507d8edf52e0"
> again, that's when you read them as uint256s, little-endian all the
> way, so "bytes in memory" those really are:
> 8cb1df74dbe980c6b9202e919597a5eabeb2d32e4de0214a39f80c5fab9e453a
> b7a6068e5814738422768b92b7ff81b807fd515871ed6a4172bacc0e6ff438be ...
> so, to start the merkle building, we do sha256(sha256(h1 . h2)) for
> the first two result:
> 2dd3ce205cf8d03f773d46d24becfd72c766deaa0d1327d7e4c810265f59a313 again
> read it backwards because we display stuff in little-endian, and...
> "13a3595f2610c8e4d727130daade66c772fdec4bd2463d773fd0f85c20ced32d"
> looks familiar? do the same for "d173..." and "59d1..." and...
> "f6ae335dc2d2aecb6a255ebd03caaf6820e6c0534531051066810080e0d822c8"
> last pair...
> "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
>
> now we only have 3, so last one gets concat'd with itself
> "13a3595f2610c8e4d727130daade66c772fdec4bd2463d773fd0f85c20ced32d"
> "f6ae335dc2d2aecb6a255ebd03caaf6820e6c0534531051066810080e0d822c8"
> gives
> "59545fd8dfdd821ca7accecab0655d77437f5bba5aaa5ea8c042a26bc9ae514b"
>
> "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
> "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
> gives
> "15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3"
>
> and final level of the tree
> "59545fd8dfdd821ca7accecab0655d77437f5bba5aaa5ea8c042a26bc9ae514b"
> "15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3"
> gives
> "9cdf7722eb64015731ba9794e32bdefd9cf69b42456d31f5e59aedb68c57ed52"

* <http://bitcointalk.org/index.php?topic=44707.msg534605#msg534605>


---

