I'm trying to create a new genesis block, you know for science.
I saw a lot of write ups online but most of them seem kinda outdated.
I found the function CreateGenesisBlock()
in the source code.
genesis = CreateGenesisBlock(1317972665, 1337, 0x1e0ffff0, 1, 100 * COIN);
std::cout<< genesis.GetHash().ToString().c_str() << std::endl;
std::cout<< genesis.hashMerkleRoot.ToString().c_str() << std::endl;
consensus.hashGenesisBlock = genesis.GetHash();
This is my current code.
When running my coind
it fails with ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
From my current research it seem the genesis block failed the PoW criteria somehow.
I thought about putting the CreateGenesisBlock
in a loop to generate blocks until I found a valid one but I'm not sure how to check if the block is valid.
Can someone gimme a tip?