Errors in block header at CBlockDiskPos(nFile=0, nPos=8) forking Monacoin

Errors in block header at CBlockDiskPos(nFile=0, nPos=8) forking Monacoin

I'm trying to run some tests forking Monacoin. After I generate the genesis block, I get this error in the debug.log file.

Errors in block header at CBlockDiskPos(nFile=0, nPos=8)

Which of course means that the genesis block's wrong.

I tried with Vertcoin and I'm getting the same error. I'm not sure what's wrong.

Monacoin original params

    consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000002ee52a8e6e4475732");
    consensus.defaultAssumeValid = uint256S("0x8ee1fd0a836d804422a100fb5c1ca7626c7a35b492c234146797f4a50f38eea8");
    assert(consensus.hashGenesisBlock == uint256S("0xff9f1c0116d19de7c9963845e129f9ed1bfc0b376eb54fd7afa42e0d418c8bb6"));
    assert(genesis.hashMerkleRoot == uint256S("0x35e405a8a46f4dbc1941727aaf338939323c3b955232d0317f8731fe07ac4ba6"));

My params

    consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
    consensus.defaultAssumeValid = uint256S("0x0");
    assert(consensus.hashGenesisBlock == uint256S("00000b77d35990d98dd772387b495e21ba71f3b8472c50376bfda5ddc884f9a4"));
    assert(genesis.hashMerkleRoot == uint256S("b13b6b3ac11f98527f656abe8f49dcf6945aad5b4c00b975ba23137160fd0ad6"));

Mining the genesis block

    genesis = CreateGenesisBlock(1537810364, 229659, 0x1e0ffff0, 1, 50 * COIN);

    /*printf("Genesis mining started\n");
    genesis.nNonce = 0;
    consensus.hashGenesisBlock = uint256S("0x001");
    for(genesis.nNonce == 0; UintToArith256(genesis.GetHash()) > UintToArith256(consensus.powLimit); genesis.nNonce++){  } 
    printf("New genesis merkle root: %s\n", genesis.hashMerkleRoot.ToString().c_str());
    printf("New genesis nonce: %lu\n", (unsigned long)genesis.nNonce);
    printf("New genesis hash: %s\n", genesis.GetHash().ToString().c_str());
    printf("Now replace the values, reComment the Genesis mining code and reCompile. \n");*/

    consensus.hashGenesisBlock = genesis.GetHash();
    assert(consensus.hashGenesisBlock == uint256S("00000b77d35990d98dd772387b495e21ba71f3b8472c50376bfda5ddc884f9a4"));
    assert(genesis.hashMerkleRoot == uint256S("b13b6b3ac11f98527f656abe8f49dcf6945aad5b4c00b975ba23137160fd0ad6"));

It generates the block but then I get the error.

I noticed that Monacoin genesis block looks very different to the one I created. I tried to create the genesis block using other project and it works. At this point I have no idea what I'm doing wrong.

EDIT: I tried to generate exactly the same genesis block using Monacoin default params, but it's different. Probably my genesis code is wrong... but it worked for other coins.

https://ift.tt/2MVoPcY

Comments

Popular posts from this blog

bitcoin node: what is the difference between simnet and regtest?

How to check if Electrum is masking my IP with the Tor proxy?

Need help to recover blpckchain.info wallet, my wife forgot her password and the brute force with btcrecover is not catching the password