Post
Topic
Board Altcoin Discussion
Re: More Genesis Block Discussion
by
anush3070
on 18/04/2014, 08:22:01 UTC
I have the following problem - when I compile daemon based on fehcoin (with pszTimestamp, block.nTime etc. changes) and I run it, I get empty nNonce:
Code:
Loading block index...
CBlock(hash=c18a2e48349763b42b90ac00881abee846203b789a2d86aacb2cd2aa5161c66f, ver=1, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=25cc2e3283b86f225057d0eaa0eaa0003b891de79828f59bb4fc0b290ab897e2, nTime=1388419211, nBits=1f00ffff, nNonce=0, vtx=1, vchBlockSig=)
  Coinbase(hash=25cc2e3283, nTime=1375995262, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff001d020f272957687920776f756c6420796f75206e65656420426974207768656e20796f7520686176652053776167)
    CTxOut(empty)
  vMerkleTree: 25cc2e3283
block.GetHash() == c18a2e48349763b42b90ac00881abee846203b789a2d86aacb2cd2aa5161c66f
block.hashMerkleRoot == 25cc2e3283b86f225057d0eaa0eaa0003b891de79828f59bb4fc0b290ab897e2
block.nTime = 1388419211
block.nNonce = 0

block.nNonce = 0 Why is this happening?

Do This Modification in the Code:

Hello,

You can use this Code to find Genesis Block for N-Scrypt, Insert it before ///debug print comment which would be near hashMerkleRoot and compile ^_^:

Code:
              if (true &&block.GetHash() != hashGenesisBlock)
              {
                  printf("Searching for genesis block...\n");
                  // This will figure out a valid hash and Nonce if you're
                  // creating a different genesis block:
                  uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
                  uint256 thash;

                  unsigned long int scrypt_scratpad_size_current_block = ((1 << (GetNfactor(block.nTime) + 1)) * 128 ) + 63;
                  char scratchpad[scrypt_scratpad_size_current_block];

                  loop
                  {
                 // Generic scrypt
                      scrypt_N_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad, GetNfactor(block.nTime));

                      if (thash <= hashTarget)
                      {
                     printf ("found it!\n");
                          break;
                      }
                      if ((block.nNonce & 0xFFF) == 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, incrementing time\n");
                          ++block.nTime;
                      }
                  }
               }