1

I am trying to create a altcoin using bitcoin source code.

i have changed the pszTimestamp, port number, magic number. I have cleared the DNS seeds and removed checkpoints for now. Then I printed the following values using printf and updated the new values: genesis.hashMerkleRoot and genesis.hashMerkleRoot

In the log file I see this error:

2017-10-04 18:32:29 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8) 2017-10-04 18:32:29 *** Failed to read block 2017-10-04 18:32:29 Error: Error: A fatal internal error occurred, see debug.log for details

I tried to debug the code and i see that this is where it fails in pow.cpp :

 bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params) {
      bool fNegative;
      bool fOverflow;
      arith_uint256 bnTarget;

      bnTarget.SetCompact(nBits, &fNegative, &fOverflow);

      // Check range
      if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
      {
          LogPrintf("\ncase 1\n");
          return false;
      }
      // Check proof of work matches claimed amount
      if (UintToArith256(hash) > bnTarget)
      {
          //LogPrintf(bnTarget);
          LogPrintf("\ncase 2\n");
          return false;
      }
      return true;
 }

It prints case 2. What does this mean? What am I missing?

  • I met same problem. Have you solved? How? – creator Feb 28 '18 at 13:22
0

instead of using merkel hash from the code run i used a genesis block generator to generate the hash,nounce. it took an hour to get the values using this code:

https://github.com/Gnaf/GenesisBlockZero

then i used the values from this and it worked.

| improve this answer | |
  • Now that the Bitcoin core is 0.15.1 your solution doesn't work, have you tried with latest version? – Hossein Mirheydari Nov 20 '17 at 16:41
  • Hello. I am also stuck at this stage, cloning litecoin newest source, What should I do? Please step by step instruction with no missing part.. – creator Feb 21 '18 at 5:15
  • Where can I get 'pubkey?' to use at GenesisBlockZero. – creator Feb 21 '18 at 6:29
  • Here's a step by step guide to create your own Genesis block. medium.com/@dophuoc/… – Phuoc Do Feb 23 '19 at 2:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.