Author

Topic: Where is the hash of the genesis block in the Bitcoin code ? (Read 209 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
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  Huh
It's in chainparams.cpp
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
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
newbie
Activity: 8
Merit: 0
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  Huh
legendary
Activity: 1792
Merit: 1283
Everything is in the title  Grin

Thanks in advance !  Wink
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 Wink
newbie
Activity: 8
Merit: 0
Everything is in the title  Grin

Thanks in advance !  Wink
Jump to: