Bitcoin Forum
May 21, 2024, 11:34:11 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to hash the genesis block?  (Read 688 times)
cloudboy (OP)
Hero Member
*****
Offline Offline

Activity: 690
Merit: 501


View Profile
November 08, 2015, 10:05:47 PM
Merited by ABCbits (1)
 #1

Hi,

I know this question has been rehashed (pun intended) many times, but I'm having trouble generating the genesis block from the raw hex.

From http://webbtc.com/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f.hex
I can see that the raw hex of the genesis block is:

Code:
0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000

But when I put that into a sha256 online hasher, it returns
Code:
26aeebfa225713245a3a5d3f4ce26eb63fae6ec5316274c8cc0aa4d6852b5522
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6642


Just writing some code


View Profile WWW
November 08, 2015, 10:39:48 PM
 #2

You need to hash the header, which is the first 80 bytes (160 characters). You must hash that as binary data, this site is helpful: http://www.fileformat.info/tool/hash.htm. Then you must hash the sha256 hash of the header also as binary data. Lastly, you must reverse the sha256 bytes to get the hash.

cloudboy (OP)
Hero Member
*****
Offline Offline

Activity: 690
Merit: 501


View Profile
November 08, 2015, 10:56:59 PM
 #3

You need to hash the header, which is the first 80 bytes (160 characters). You must hash that as binary data, this site is helpful: http://www.fileformat.info/tool/hash.htm. Then you must hash the sha256 hash of the header also as binary data. Lastly, you must reverse the sha256 bytes to get the hash.

Thanks!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!