Search code examples
blockchainbitcoincryptocurrencylitecoin

How to mine 1st blocks after genesis (PIVX fork)?


I have generated the genesis block and related hashes, daemon runs fine.

I'm trying to mine the 1st block (block 1) using 'setgenerate true 1'

I've changed related params in chainparams.cpp, any time I run the command I get segmentation fault.

debug log shows

2018-06-25 19:30:54 keypool reserve 2 2018-06-25 19:30:54 CreateNewBlock(): total size 1000

Using latest master branch.


Solution

  • First thing you need to do is check the debug.log from .pivx folder second thing what data you given in pivx.conf ?

    for mine ill add below

       rpcuser=user
       rpcpassword=password
       rpcallowip=127.0.0.1
       listen=1
       server=1
       daemon=1
       logtimestamps=1
       maxconnections=256
       staking=1
       txindex=1
    

    And your error segmentation fault. is because the miner.cpp . In src/miner.cpp there is line:

       uint256 hashBlockLastAccumulated = chainActive[nHeight - (nHeight % 10) - 10]->GetBlockHash();
    

    so, nHeight is blockchain last block number (which at empty blockchain is 0) + 1 = 1, and thus accessing negative index of array causes Segmentation Fault.

    So you need edit this code anyway to run the mining process.