-1

I've cloned PIVX(basically a DASH fork) and modified basic parameters. It compiles fine. When I'm trying to run it the server starts and the debug log file shows following errors:

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

To generate my genesis block I've changed the following parameters:

  • pszTimestamp : Used a random latest news.
  • vAlertPubKey : Used the alert key from generation commands mentioned in this pastebin link.
  • scriptPubKey : Used the genesis hex from generation commands mentioned in this pastebin link.

  • genesis.nTime : Got the latest unix timestamp.

  • genesis.nNonce : Obtained it from genesis block creation algorithm mentioned in this pastebin link.

I was able to successfully generate new genesis hash as well as merkle root. But after compiling it and I get the above error.

I've tried looking for the solution on the web but most of them had no concrete answers or no answers at all except this one.

It explains that the hash of my genesis block is greater than the target hash which is obtained using nBits variable. So my question is how do I make sure that my genesis hash is less than the target hash to get rid of the errors mentioned?

1 Answer 1

1

I found the answer. However please correct me if there's I'm wrong in explaining this.

Basically, once we have inputs for the block, we hash the data. This hashing can be achieved using multiple techniques viz. SHA256, scrypt, X11, etc.

The issue with generating a hash for the genesis was I used scrypt algorithm to generate the hash. You may come across paste bin links with this method scrypt_1024_1_1_256_sp_sse2.

So in my case, I replaced this with the method offered by uint256 class. You can find this genesis creation logic at this pastebin.

Feel free to add anything or correct me if I'm wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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