I am trying to create my own genesis block using the bitcoin source code but my new hashes are not being accepted by the assert statements.

Step 1:

I have changed the pszTimestamp variable in chainparams.cpp to generate my own genesis hash.

I have added into the code some print statements to check the genesis hash and merkle root as they are generated from my new pszTimestamp.

The hashes I have generated are:

MERKLE ROOT:9f46bcd8a56be2b6b022acbcc859b201534c21801b1b73685a69de17ad37665e

GENESIS HASH:cc45935bfeb12faacc8ab2797d2f5507f7eef8a44c597f3622c704cc0af8a648

Step 2:

I have changed the assert statements below to assert the new hashes on line 131 and line 230 of chainparams.cpp

The Genesis Block assert(consensus.hashGenesisBlock==uint256S("0xcc45935bfeb12faacc8ab2797d2f5507f7eef8a44c597f3622c704cc0af8a648"));

The Merkle Root assert(genesis.hashMerkleRoot==int256S("0x9f46bcd8a56be2b6b022acbcc859b201534c1801b1b73685a69de17ad37665e"));


These assert statements still fail. Why?

I have included the error message below:

bitcoin-qt: chainparams.cpp:230: CTestNetParams::CTestNetParams(): Assertion `consensus.hashGenesisBlock == uint256S("0xcc45935bfeb12faacc8ab2797d2f5507f7eef8a44c597f3622c704cc0af8a648")' failed. Aborted (core dumped)

  • Downvoted. We have many questions regarding programming issues when creating a new altcoin. I don't believe such questions benefit a general audience, and this is a Q&A site, not a place for support. Furthermore, as a learning experience, contributing to an existing project is far more valuable. – Pieter Wuille Nov 15 '18 at 21:48

The problem is that you changed the testnet parameters too, not just the mainnet parameters. However I doubt that you regenerated the testnet genesis block, or if you did, you did not set the assert correctly. You set the assert in the testnet chain parameters to be the mainnet genesis block hash and merkle root. But that is obviously wrong; testnet is not the same as mainnet. To fix this, you should either revert the change, or generate a new testnet genesis block and set those asserts accordingly.

  • If I revert the testnet params back to their original values. I still get an assert error bitcoin-qt: chainparams.cpp:227: CTestNetParams::CTestNetParams(): Assertion consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943")' failed. Aborted (core dumped)` – Oscar Chambers Nov 14 '17 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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