3

I am trying to create a genesis block in twister-core using Ubuntu and IDE Qt Creator. I have compiled the twister-core successfully, I have changed the these parameters for creating the genesis block pszTimestamp, genesis.nTime and genesis.nNonce. Then I re-compiled it successfully. When I am executing twisterd in the terminal using this command

./twisterd -rpcuser=user -rpcpassword=pwd -rpcallowip=127.0.0.1

this error occured:

Terminal Error :
Assertion `hashGenesisBlock == uint256("b24b7a9c568b4ae288c0be34699c4c79fc22848e7c346afd5f63901e41ed8640")' failed. Aborted (core dumped)

When I run it On Qt-Creator same error occur Error:

twisterd: ../twister/src/chainparams.cpp:216: CMainParams::CMainParams(): Assertion `hashGenesisBlock == uint256("b24b7a9c568b4ae288c0be34699c4c79fc22848e7c346afd5f63901e41ed8640")' failed.
The program has unexpectedly finished.
../twister-qt-Output/twisterd exited with code 0

Please help me to resolve this problem.

1

1 Answer 1

2

chainparams.cpp contains a line of code that checks whether the chain’s genesis block is equal to a specified hash. Since you created a new genesis block, you will have to update the value to your own hash.

You can see an example for the line here:

 hashGenesisBlock = genesis.GetHash();
 assert(hashGenesisBlock == uint256("9915158279673d101912be80f25c20627f1dd8bf5231e7c46bfec5ed19737f44"));

Which I took from miguelfreitas/twister-core/…/chainparams.cpp

To figure out what to put there, you can print genesis.GetHash() and replace the old hash in the assertion.

To print it the hash of the genesis block, you can use

printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());

just above the line with the assertion, which will write to the ~/.bitcoin/debug.log.

5
  • Hi , I ave also printed the genesis.hashMerkleRoot using above example ,Please tell me where I put these hash to create genesis block?
    – amit kumar
    Commented Jan 4, 2016 at 12:50
  • Thanks, I got the solution bitcointalk.org/index.php?topic=391983.msg4223449#msg4223449
    – amit kumar
    Commented Jan 5, 2016 at 7:23
  • at newest source bitcoin 0.15.1, debug.log file does not be generated? Why?
    – creator
    Commented Feb 13, 2018 at 8:13
  • @leegod: If you have a new question, please start another topic
    – Murch
    Commented Feb 13, 2018 at 16:41
  • Hi. So even if after change hash value to match, but still another occured, ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8) I posted this forum, replier says "Your genesis block is wrong. You actually have to mine the block, not just change the parameters." but, how to? I searched a lot but most code mine the block is outdated, and not work at currently. Do you know this solution? Thanks.
    – creator
    Commented Feb 23, 2018 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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