Hello everyone,
I want to calculate the block hash from this block by my own with the following python script:
https://blockchain.info/rawblock/00000000000000000be983a81043933c38008010b849fd6a35d5dd2d57f929bdhash: 00000000000000000be983a81043933c38008010b849fd6a35d5dd2d57f929bd
ver: 3
prev_block: 0000000000000000051f5de334085b92ce27c03888c726c9b2bb78069e55aeb6
mrkl_root: f4db18d3ecab87eeb23a56490d5b0b514848d510d409b43f6bbf2b82f55da8db
time: 1442663985
bits: 403867578
nonce: 3548193207
My conversion looks like this:
ver --> HextoBinary --> 3 --> 11 --> 00000011
prev_block --> No conversion necessary (Hex)
mrkl_root --> No conversion necessary (Hex)
time --> toHex --> 1442663985 --> 55fd4e31 (Hex)
bits --> toHex --> 403867578 --> 181287ba
nonce --> toHex --> 3548193207 --> d37d21b7
Script:
import hashlib
header_hex = ("000000110000000000000000051f5de334085b92ce27c03888c726c9b2bb78069e55aeb6f4db18d3ecab87eeb23a56490d5b0b514848d510d409b43f6bbf2b82f55da8db55fd4e31181287bad37d21b7")
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
print hash[::-1].encode('hex_codec')
Unfortunately, the result looks like this:
7012fc1c69b4b5d0c0df1b732c5ea58752e96bd8f53f7c09d2f5b57bcc0186d1
but it should be
00000000000000000be983a81043933c38008010b849fd6a35d5dd2d57f929bd
Maybe I do something wrong with the version or prev_block field?
Thank you for your support
Sincerely,
Rambo123