hash dosent match nbits


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

Fray Contreras

Posted 2018-06-11T23:05:26.917

Reputation: 23



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)
        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];

            scrypt_1024_1_1_256_sp_generic(BEGIN(genesis.nVersion), BEGIN(thash), scratchpad);
            if (thash <= hashTarget)
            if ((genesis.nNonce & 0xFFF) == 0)
                printf("nonce %08X: hash = %s (target = %s)\n", genesis.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
            if (genesis.nNonce == 0)
                printf("NONCE WRAPPED, incrementing time\n");
        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.

Fray Contreras

Posted 2018-06-11T23:05:26.917

Reputation: 23

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 – 2018-06-22T23:57:33.483


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?


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.


Posted 2018-06-11T23:05:26.917

Reputation: 303