Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: RisitasLeGrand on January 11, 2018, 12:50:42 PM



Title: Where is the hash of the genesis block in the Bitcoin code ?
Post by: RisitasLeGrand on January 11, 2018, 12:50:42 PM
Everything is in the title  ;D

Thanks in advance !  ;)


Title: Re: Where is the hash of the genesis block in the Bitcoin code ?
Post by: eternalgloom on January 11, 2018, 01:06:15 PM
Everything is in the title  ;D

Thanks in advance !  ;)
There's an entry in the Bitcoin Wiki about that, here's the link to the page: https://en.bitcoin.it/wiki/Genesis_block

So, the hash of the genesis block is: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
The Bitcoin wiki article also mentions where it's found in the code ;)


Title: Re: Where is the hash of the genesis block in the Bitcoin code ?
Post by: RisitasLeGrand on January 12, 2018, 09:46:54 AM
I don't find it, the "main.cpp" file doesn't exists anymore, I've looked for the Genesis Block hash in validation.cpp and net_processing.cpp but i don't find anything  ???


Title: Re: Where is the hash of the genesis block in the Bitcoin code ?
Post by: LoyceV on January 12, 2018, 11:47:19 AM
I assume you've downloaded https://github.com/bitcoin/bitcoin, just search for the hash eternalgloom mentioned. Quick and dirty, but it works:
Code:
bitcoin-master $ for i in `find`; do grep 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f $i 2> /dev/null; done
                settings['genesis'] = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
        assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
    src/bitcoin-cli -named getblock blockhash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

Or, if you want to see which files contain these lines:
Code:
bitcoin-master $ for i in `find`; do if [ -n "`grep 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f $i 2> /dev/null`" ]; then echo $i; fi; done
./contrib/linearize/linearize-data.py
./contrib/linearize/example-linearize.cfg
./src/chainparams.cpp
./doc/release-notes/release-notes-0.14.0.md


Title: Re: Where is the hash of the genesis block in the Bitcoin code ?
Post by: achow101 on January 13, 2018, 12:07:26 AM
I don't find it, the "main.cpp" file doesn't exists anymore, I've looked for the Genesis Block hash in validation.cpp and net_processing.cpp but i don't find anything  ???
It's in chainparams.cpp