Altcoin creation from bitcoin ReadBlockFromDisk: Errors in block header at CBlockDiskPos

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?

subodh1989

Posted 2017-10-04T19:00:50.357

Reputation: 111

I met same problem. Have you solved? How?creator 2018-02-28T13:22:44.007

Answers

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.

subodh1989

Posted 2017-10-04T19:00:50.357

Reputation: 111

Now that the Bitcoin core is 0.15.1 your solution doesn't work, have you tried with latest version?Hossein Mirheydari 2017-11-20T16:41:14.303

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 2018-02-21T05:15:13.313

Where can I get 'pubkey?' to use at GenesisBlockZero.creator 2018-02-21T06:29:09.800

Here's a step by step guide to create your own Genesis block. https://medium.com/@dophuoc/how-to-mine-a-genesis-block-for-your-bitcoin-fork-471b1fb47efb

Phuoc Do 2019-02-23T02:22:24.300