Skip to content

Instantly share code, notes, and snippets.

@blockchain-ai
Created November 21, 2017 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blockchain-ai/89de00431cf2cfbca058f137f4c5653f to your computer and use it in GitHub Desktop.
Save blockchain-ai/89de00431cf2cfbca058f137f4c5653f to your computer and use it in GitHub Desktop.
tarocoin_add_code
if(true && block.GetHash() != hashGenesisBlock)
{
printf("Searching for genesis block...\n");
//this will figure out a vlid hash and nonce if you're
//createing a different genesis block.
uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
uint256 thash;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
loop
{
scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
if (thash <= hashTarget)
break;
if ((block.nNonce & 0xFF) == 0)
{
printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
}
++block.nNonce;
if (block.nNonce == 0)
{
printf("NONCE WRAPPED, inccrementing time\n");
++block.nTime;
}
}
printf("block.nTime = %u \n",block.nTime);
printf("block.nNonce = %u \n",block.nNonce);
printf("block.GetHash = %s \n",block.GetHash().ToString().c_str());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment