How to mine a genesis block?

0

1

Following this guide, I'm trying to learn how to mine a genesis block, not to launch another altcoin or anything, blockchain databases are going to be important and I want to be ahead of the curve.

I'm using this script and working with the litecoin source. I have only changed the following:

find LoadBlockIndex() function, inside, change:
    - paraphrase (pszTimestamp) to any recent news phase.
    - get the latest unix time (do a google), and put in block.nTime.
    - set any nNonce (doesn't really matter)
you can change the time/nonce for testnet too, if you want to use it.

Those variables are now found in chainparams.cpp and I didn't change the testnet time/nonce.

After compiling when I try to run litecoind I get the following error:

litecoind: chainparams.cpp:220: CTestNetParams::CTestNetParams(): Assertion `hashGenesisBlock == uint256("0xf5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f")' failed.
Aborted

If anyone can help or point me in the direction of some modern documentation I'd me most grateful :)

derrend

Posted 2016-03-05T07:16:46.117

Reputation: 636

If you change the genesis block you have to change the hash check assertion, because the hash will have changed. – morsecoder – 2016-03-05T14:58:43.323

Related: http://bitcoin.stackexchange.com/questions/34107/how-do-i-create-a-new-genesis-block-for-an-altcoin. This question seems to have better answers, so maybe the linked question should be marked as a duplicate of this.

– morsecoder – 2016-03-05T14:58:47.993

Thanks @StephenM347 but how do I calculate what the 'hash check assertion' should be? – derrend – 2016-03-05T20:30:19.677

Also there are no answers in the link you provided. – derrend – 2016-03-05T20:36:45.133

After this, you maybe suffer ReadBlockFromDisk: Errors in block header at CBlockDiskPos(, have you? – creator – 2018-03-02T14:06:09.607

Answers

2

How to make an altcoin on Bear's Den

derrend

Posted 2016-03-05T07:16:46.117

Reputation: 636

0

You have to add smth like this genesis.nNonce = 353314; hashGenesisBlock = genesis.GetHash();

LogPrintf("Display genesis hash so we can input it below %s\n", hashGenesisBlock.ToString().c_str());

assert(hashGenesisBlock == uint256("0xe133d1d3f584f1c3f561e7d0606fa87dabb869325a979c2a82e2f3943c0e3370")); vFixedSeeds.clear();

then after ./coind in debug.log you can get genesis hash

nikky

Posted 2016-03-05T07:16:46.117

Reputation: 1