<p>Ok so im cloning BitcoinGreen... It uses Quark Algorithm. The way I generate the genesis block &amp; MerkleRoot is by pasting the code on the chainparams.cpp which is this..</p>

<p>printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());</p>

<p>printf("Gensis Hash Merkle: %s\n", genesis.hashMerkleRoot.ToString().c_str());</p>

<p>Even tho this gave me the code to the genesis block, it did not generate the correct code for the coin. I even use this special code, which generate the genesis block as well...</p>

<p>const int SCRYPT_SCRATCHPAD_SIZE = 131072 + 63;</p>

<pre><code>      //if (true &amp;&amp; genesis.GetHash() != hashGenesisBlock)
    if(true)
    {
        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(genesis.nBits).getuint256();
        uint256 thash;
        char scratchpad[SCRYPT_SCRATCHPAD_SIZE];

        while(true)
        {
            scrypt_1024_1_1_256_sp_generic(BEGIN(genesis.nVersion), BEGIN(thash), scratchpad);
            if (thash &lt;= hashTarget)
                break;
            if ((genesis.nNonce &amp; 0xFFF) == 0)
            {
                printf("nonce %08X: hash = %s (target = %s)\n", genesis.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
            }
            ++genesis.nNonce;
            if (genesis.nNonce == 0)
            {
                printf("NONCE WRAPPED, incrementing time\n");
                ++genesis.nTime;
            }
        }
        printf("block.nTime = %u \n", genesis.nTime);
        printf("block.nNonce = %u \n", genesis.nNonce);
        printf("block.GetHash = %s\n", genesis.GetHash().ToString().c_str());

        }
</code></pre>

<p>This also did not work. So thats pretty much it. I tried.</p>

CC BY-SA 4.0
2018-06-22T23:57:33.483Z
Please update your original question next time instead of adding your update as an answer. I went to give your question an upvote for some research effort and gave it to your answer instead.
apt-getschwifty
CC BY-SA 4.0
2018-06-21T21:21:27.797Z
2018-06-21T21:21:27.797Z
Fray Contreras
<p>Please provide more data. How did you generate your genesis block? (Specific parameters) Which coin are you cloning using what PoW algorithm? What steps have you taken relative to editing the source code?</p>

<p>EDIT:</p>

<p>Okay, so it looks like you're depending on the client to print the genesis hash into the debug log, which won't work if the client never successfully starts. It is either this, or some kind of checkpoint error based on the output of the debug log. Either way, I recommend using the genesis python script @ <a href="https://github.com/lhartikk/GenesisH0/blob/master/genesis.py" rel="nofollow noreferrer">https://github.com/lhartikk/GenesisH0/blob/master/genesis.py</a></p>

<p>After successfully downloading all dependencies you can run the terminal command python genesis.py help in the directory you downloaded it to for a full list of available commands/flags. Essentially it asks for all required parameters (Unix timestamp, pzTimestamp, PubKey, PoW algorithm, nonce etc.) required to produce a valid genesis hash.</p>

<p>You will then need to replace all of these parameters in the source code as well as the actual genesis hash itself and make sure that there are NO references to ANY other block since we are in fact starting from the genesis block.</p>

<p>Please feel free to post updates for further assistance if required.</p>

CC BY-SA 4.0
2018-06-13T17:29:31.820Z
2018-06-22T23:59:57.007Z
2018-06-22T23:59:57.007Z
apt-getschwifty
<p>Im trying to clone a coin and I created a genesis block but when I run the wallet, it dosent start.. When I go to the log file, I see this error and I honestly dont know how to solve the problem. How do I create the genesis block for the quark-hash algorithm.. I tried some generators and it didnt work. Any help would be appreciated.</p>

<p>This is from the debug.log file...</p>

<p>ERROR: CheckProofOfWork() : hash doesn't match nBits
ERROR: CheckBlockHeader() : proof of work failed
ERROR: CheckBlock() : CheckBlockHeader failed
ERROR: ConnectTip() : ConnectBlock 7451cc25dd4fdfc6f441298e59dfc012d2dc078d687a120bf94a20d98beefd16 failed</p>

<blockchain><bitcoin-core-development><altcoin-development><genesis-block>
hash dosent match nbits
Fray Contreras
# hash dosent match nbits

(Asked by: username_0 on 2018-06-11)

Im trying to clone a coin and I created a genesis block but when I run the wallet, it dosent start.. When I go to the log file, I see this error and I honestly dont know how to solve the problem. How do I create the genesis block for the quark-hash algorithm.. I tried some generators and it didnt work. Any help would be appreciated.

This is from the debug.log file...

ERROR: CheckProofOfWork() : hash doesn't match nBits
ERROR: CheckBlockHeader() : proof of work failed
ERROR: CheckBlock() : CheckBlockHeader failed
ERROR: ConnectTip() : ConnectBlock 7451cc25dd4fdfc6f441298e59dfc012d2dc078d687a120bf94a20d98beefd16 failed

**Tags:** blockchain, bitcoin-core-development, altcoin-development, genesis-block


---

## 2 answers

### Answer by username_0 on 2018-06-21. Score: 1

Ok so im cloning BitcoinGreen... It uses Quark Algorithm. The way I generate the genesis block & MerkleRoot is by pasting the code on the chainparams.cpp which is this..

printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c\_str());

printf("Gensis Hash Merkle: %s\n", genesis.hashMerkleRoot.ToString().c\_str());

Even tho this gave me the code to the genesis block, it did not generate the correct code for the coin. I even use this special code, which generate the genesis block as well...

const int SCRYPT\_SCRATCHPAD\_SIZE = 131072 + 63;

```
      //if (true && genesis.GetHash() != hashGenesisBlock)
    if(true)
    {
        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(genesis.nBits).getuint256();
        uint256 thash;
        char scratchpad[SCRYPT_SCRATCHPAD_SIZE];

        while(true)
        {
            scrypt_1024_1_1_256_sp_generic(BEGIN(genesis.nVersion), BEGIN(thash), scratchpad);
            if (thash <= hashTarget)
                break;
            if ((genesis.nNonce & 0xFFF) == 0)
            {
                printf("nonce %08X: hash = %s (target = %s)\n", genesis.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
            }
            ++genesis.nNonce;
            if (genesis.nNonce == 0)
            {
                printf("NONCE WRAPPED, incrementing time\n");
                ++genesis.nTime;
            }
        }
        printf("block.nTime = %u \n", genesis.nTime);
        printf("block.nNonce = %u \n", genesis.nNonce);
        printf("block.GetHash = %s\n", genesis.GetHash().ToString().c_str());

        }

```

This also did not work. So thats pretty much it. I tried.

> **Comments:**
> **username_1**: Please update your original question next time instead of adding your update as an answer. I went to give your question an upvote for some research effort and gave it to your answer instead.  

---

### Answer by username_1 on 2018-06-13. Score: 0

Please provide more data. How did you generate your genesis block? (Specific parameters) Which coin are you cloning using what PoW algorithm? What steps have you taken relative to editing the source code?

EDIT:

Okay, so it looks like you're depending on the client to print the genesis hash into the debug log, which won't work if the client never successfully starts. It is either this, or some kind of checkpoint error based on the output of the debug log. Either way, I recommend using the genesis python script @ <https://github.com/lhartikk/GenesisH0/blob/master/genesis.py>

After successfully downloading all dependencies you can run the terminal command python genesis.py help in the directory you downloaded it to for a full list of available commands/flags. Essentially it asks for all required parameters (Unix timestamp, pzTimestamp, PubKey, PoW algorithm, nonce etc.) required to produce a valid genesis hash.

You will then need to replace all of these parameters in the source code as well as the actual genesis hash itself and make sure that there are NO references to ANY other block since we are in fact starting from the genesis block.

Please feel free to post updates for further assistance if required.


---

