How to get block header hex? I am trying to research hash functions and I want to be able to use bitcoin's mining outputs as hashes. I am curious about where the actual hex value of the data that generates that hash with a lot of zeroes is. So, this is what I want: the 80 byte input that gives a 32 bit output with a lot of zeros from sha256(sha256(x)).
I am curious about where the actual hex value of the data that generates that hash with a lot of zeroes is.


It is a composite of values from the block - in brief, it is the concatenated binary (represented here in hex notation) little endian value of each of the fields:

version + previous_block_hash + merkle_root_hash + time + bits + nonce

of the block that is being mined.

These are contained in the "block header".

You have examples of Python code here: https://en.bitcoin.it/wiki/Block_hashing_algorithm , for example for block 125552:

&gt;&gt;&gt; import hashlib
&gt;&gt;&gt; header_hex = ("01000000" +
 "81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
 "e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
 "c7f5d74d" +
 "f2b9441a" +
 "42a14695")
&gt;&gt;&gt; header_bin = header_hex.decode('hex')
&gt;&gt;&gt; hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
&gt;&gt;&gt; hash.encode('hex_codec')
'1dbd981fe6985776b644b173a4d0385ddc1aa2a829688d1e0000000000000000'
&gt;&gt;&gt; hash[::-1].encode('hex_codec')
'00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d'


Note that the value is reversed at the last step in order to be represented in the big-endian format that we humans are used to.


  So, this is what I want: the 80 byte input that gives a 32 bit output with a lot of zeros from sha256(sha256(x)).


You can check these 6 values for every block mined using any one of the many online block explorers available: for example here for the particular block of the previous example: https://blockexplorer.com/block/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d (you'll only have to convert the human time to unix time being careful with the time zone).

Here is a quick link to download blocks' headers in binary form (until May 2018) and start playing with real values. You can convert it to .csv if needed.