<p>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:</p>

<p><a href="https://github.com/Gnaf/GenesisBlockZero" rel="nofollow noreferrer">https://github.com/Gnaf/GenesisBlockZero</a></p>

<p>then i used the values from this and it worked.</p>

CC BY-SA 3.0
2017-11-20T16:41:14.303Z
Now that the Bitcoin core is 0.15.1 your solution doesn't work, have you tried with latest version?
Hossein Mirheydari
CC BY-SA 3.0
2018-02-21T05:15:13.313Z
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
CC BY-SA 3.0
2018-02-21T06:29:09.800Z
Where can I get 'pubkey?' to use at GenesisBlockZero.
creator
CC BY-SA 4.0
2019-02-23T02:22:24.300Z
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
CC BY-SA 3.0
2017-10-05T01:17:14.983Z
2017-10-05T01:17:14.983Z
subodh1989
<p>I am trying to create a altcoin using bitcoin source code.</p>

<p>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</p>

<p>In the log file I see this error:</p>

<blockquote>
  <p>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</p>
</blockquote>

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

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

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

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

<p>It prints case 2. What does this mean? What am I missing?</p>

CC BY-SA 3.0
2018-02-28T13:22:44.007Z
I met same problem. Have you solved? How?
creator
<altcoin-development>
Altcoin creation from bitcoin ReadBlockFromDisk: Errors in block header at CBlockDiskPos
subodh1989
# Altcoin creation from bitcoin ReadBlockFromDisk: Errors in block header at CBlockDiskPos

(Asked by: username_0 on 2017-10-04)

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?

**Tags:** altcoin-development

> **Comments:**
> **username_1**: I met same problem. Have you solved? How?  

---

## 1 answers

### Answer by username_0 on 2017-10-05. Score: 0 | Accepted answer

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.

> **Comments:**
> **username_2**: Now that the Bitcoin core is 0.15.1 your solution doesn't work, have you tried with latest version?  
> **username_1**: 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..  
> **username_1**: Where can I get 'pubkey?' to use at GenesisBlockZero.  
> **username_3**: 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  

---

