Skip to content

Instantly share code, notes, and snippets.

@bitbd83
Created February 6, 2020 16:35
Show Gist options
  • Save bitbd83/e6232e646729bd7eb821cd138bd56775 to your computer and use it in GitHub Desktop.
Save bitbd83/e6232e646729bd7eb821cd138bd56775 to your computer and use it in GitHub Desktop.
if(genesis.GetHash() != uint256("0x"))
{
printf("Searching for genesis block...\n");
uint256 hashTarget = CBigNum().SetCompact(genesis.nBits).getuint256();
while(uint256(genesis.GetHash()) > hashTarget)
{
++genesis.nNonce;
if (genesis.nNonce == 0)
{
printf("NONCE WRAPPED, incrementing time");
std::cout << std::string("NONCE WRAPPED, incrementing time:\n");
++genesis.nTime;
}
if (genesis.nNonce % 10000 == 0)
{
printf("Mainnet: nonce %08u: hash = %s \n", genesis.nNonce, genesis.GetHash().ToString().c_str());
}
}
printf("block.nTime = %u \n", genesis.nTime);
printf("block.nNonce = %u \n", genesis.nNonce);
printf("block.GetHash = %s\n", genesis.GetHash().ToString().c_str());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment