Problem In Creating Genesis Block Twister-Core using Ubuntu and (Qt Creator IDE)

3

2

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.

amit kumar

Posted 2016-01-04T08:01:41.780

Reputation: 33

possible duplicate of How can I create a new Genesis Block?

– Murch – 2016-01-04T10:21:40.257

Answers

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.

Murch

Posted 2016-01-04T08:01:41.780

Reputation: 51 063

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 – 2016-01-04T12:50:50.547

Thanks, I got the solution https://bitcointalk.org/index.php?topic=391983.msg4223449#msg4223449

– amit kumar – 2016-01-05T07:23:46.437

at newest source bitcoin 0.15.1, debug.log file does not be generated? Why? – creator – 2018-02-13T08:13:51.853

@leegod: If you have a new question, please start another topic – Murch – 2018-02-13T16:41:34.087

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 – 2018-02-23T01:39:03.600