1

I am trying to create a new crypto currency and i am struggling with creating genesis block with the bitcoin code. I am following this tutorial https://bitcointalk.org/index.php?topic=225690.0 and i believe the code is quite old.

I have changed the parameters and

genesis = CreateGenesisBlock(1515428732, 2018236893, 0x1d00ffff, 1, 50 * COIN);
   consensus.hashGenesisBlock = genesis.GetHash("");
   assert(consensus.hashGenesisBlock == uint256S(""));
   assert(genesis.hashMerkleRoot == uint256S(""));

but it is not compiling

chainparams.cpp:240:54: error: too many arguments to function call, expected 0, have 1
        consensus.hashGenesisBlock = genesis.GetHash("");
                                     ~~~~~~~~~~~~~~~ ^~
./primitives/block.h:63:5: note: 'GetHash' declared here
    uint256 GetHash() const;
    ^
chainparams.cpp:333:54: error: too many arguments to function call, expected 0, have 1
        consensus.hashGenesisBlock = genesis.GetHash("");
                                     ~~~~~~~~~~~~~~~ ^~
./primitives/block.h:63:5: note: 'GetHash' declared here
    uint256 GetHash() const;

I have checked the debug.log but i dont see new values for hashGenesis and Merkel root.

229tx)
2017-09-07 13:40:39 UpdateTip: new best=00000000000008838dc29dd8f585e69dc53731d6de106179c6a76b1b20c31396 height=177243 version=0x00000001 log2_work=68.044269 tx=2915938 date='2012-04-26 03:22:53' progress=0.011538 cache=210.7MiB(789124tx)
2017-09-07 13:40:39 UpdateTip: new best=0000000000000729fce8abd24f2abb7f1080f603a7d5f75794c79afec3efbadd height=177244 version=0x00000001 log2_work=68.044301 tx=2915981 date='2012-04-26 03:11:31' progress=0.011539 cache=210.7MiB(789104tx)
2017-09-07 13:40:39 UpdateTip: new best=000000000000016217c799e6d414cbd420da4a134a3b1a9b30f728b7da81d6d9 height=177245 version=0x00000001 log2_work=68.044333 tx=2916006 date='2012-04-26 03:09:07' progress=0.011539 cache=210.7MiB(789117tx)

1 Answer 1

2
genesis.GetHash("");

This is incorrect. GetHash does not take a parameter, as said in the compiler error. This should just be genesis.GetHash();.

I have checked the debug.log but i dont see new values for hashGenesis and Merkel root.

The debug.log file is only modified when you run the program, and because it isn't even compiling, when you run it, you are not running it with any of your changes.

4
  • How much time it takes to create hash of genesis block? I am using this script github.com/lhartikk/GenesisH0 but stuck for 8 hrs. algorithm: SHA256 merkle hash: 7d8d77f82fff1c303f864fcd9e48f2e20c50ff91c7144fc0bb8092205662dc33 pszTimestamp: Democracy Now 03/Jan/2018 Trump Administration Will Withhold Pakistan Military Aid pubkey: 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f time: 1515428732 bits: 0x1d00ffff Searching for genesis hash.. 149739.0 hash/s, estimate: 8.0 h
    – pbu
    Jan 11, 2018 at 17:48
  • It depends on the hashrate of your computer and the difficulty you have set for the genesis block.
    – Andrew Chow
    Jan 11, 2018 at 18:04
  • How to actually create genesis block?
    – creator
    Feb 22, 2018 at 0:01
  • How to lower difficulty for fast genesis block?
    – creator
    Feb 22, 2018 at 0:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.