Author

Topic: Error while forking bitcoin(2017) code (Read 182 times)

newbie
Activity: 10
Merit: 0
December 24, 2017, 01:05:18 PM
#1
 Hi,

First: I am a newbite to altcoin development, next to generate an altcoin from litecoin,

1- I have made a clone of litecoin using git clone https://githubcom/litecoin-project/lotecoin.git

2- I changed some of chain and coin parameters in chainparams.cpp as below:

Code:

// Copyright (c) 2010 Satoshi Nakamoto
 // Copyright (c) 2009-2015 The Bitcoin Core developers
 // Distributed under the MIT software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.

 #include "chainparams.h"
 #include "consensus/merkle.h"

 #include "tinyformat.h"
 #include "util.h"
 #include "utilstrencodings.h"

 #include

 #include "chainparamsseeds.h"
 #include "arith_uint256.h"

 static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
 {
     CMutableTransaction txNew;
     txNew.nVersion = 1;
     txNew.vin.resize(1);
     txNew.vout.resize(1);
     txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
     txNew.vout[0].nValue = genesisReward;
     txNew.vout[0].scriptPubKey = genesisOutputScript;

     CBlock genesis;
     genesis.nTime    = nTime;
     genesis.nBits    = nBits;
     genesis.nNonce   = nNonce;
     genesis.nVersion = nVersion;
     genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
     genesis.hashPrevBlock.SetNull();
     genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
     return genesis;
 }

 /**
  * Build the genesis block. Note that the output of its generation
  * transaction cannot be spent since it did not originally exist in the
  * database.
  *
  * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, *nNonce=2083236893, vtx=1)
  *   CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
  *     CTxIn(COutPoint(000000, -1), coinbase *04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420**666f722062616e6b73)
  *     CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
  *   vMerkleTree: 4a5e1e
  */

 static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
 {
     const char* pszTimestamp = "Tehran Times, Stonica wins finally";
     const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
     return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
 }

 void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
 {
     consensus.vDeployments[d].nStartTime = nStartTime;
     consensus.vDeployments[d].nTimeout = nTimeout;
 }

 /**
  * Main network
  */
 /**
  * What makes a good checkpoint block?
  * + Is surrounded by blocks with reasonable timestamps
  *   (no blocks before with a timestamp after, none after with
  *    timestamp before)
  * + Contains no strange transactions
  */

 class CMainParams : public CChainParams {
 public:
     CMainParams() {
         strNetworkID = "main";
         consensus.nSubsidyHalvingInterval = 840000;
         consensus.BIP34Height = 710000;
         consensus.BIP34Hash = uint256S("00000000b2c50d03d4d0bdd38681775ce522f137518145d6b3c913b7dd4423e5");
         consensus.BIP65Height = 918684; // bab3041e8977e0dc3eeff63fe707b92bde1dd449d8efafb248c27c8264cc311a
         consensus.BIP66Height = 811879; // 7aceee012833fa8952f8835d8b1b3ae233cd6ab08fdb27a771d2bd7bdc491894
         consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
         consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
         consensus.nPowTargetSpacing = 2.5 * 60;
         consensus.fPowAllowMinDifficultyBlocks = false;
         consensus.fPowNoRetargeting = false;
         consensus.nRuleChangeActivationThreshold = 6048; // 75% of 8064
         consensus.nMinerConfirmationWindow = 8064; // nPowTargetTimespan / nPowTargetSpacing * 4
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

         // Deployment of BIP68, BIP112, and BIP113.
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1485561600; // January 28, 2017
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1517356801; // January 31st, 2018

         // Deployment of SegWit (BIP141, BIP143, and BIP147)
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1485561600; // January 28, 2017
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1517356801; // January 31st, 2018

         // The best chain should have at least this much work.
         consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000ba50a60f8b56c7fe0");

         // By default assume that the signatures in ancestors of this block are valid.
         consensus.defaultAssumeValid = uint256S("0x29c8c00e1a5f446a6364a29633d3f1ee16428d87c8d3851a1c570be8170b04c2"); //1259849

         /**
          * The message start string is designed to be unlikely to occur in normal data.
          * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
          * a large 32-bit integer with any alignment.
          */
         pchMessageStart[0] = 0x0b;
         pchMessageStart[1] = 0xd0;
         pchMessageStart[2] = 0xb6;
         pchMessageStart[3] = 0xdb;
         nDefaultPort = 9335;
         nPruneAfterHeight = 100000;
 //static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
         genesis = CreateGenesisBlock(1511279793, 1251189192, 0x1d00ffff , 1, 50 * COIN);
         consensus.hashGenesisBlock = genesis.GetHash();

 /*        
         // calculate Genesis Block
         // Reset genesis
         consensus.hashGenesisBlock = uint256S("0x");
         std::cout << std::string("Begin calculating Mainnet Genesis Block:\n");
         if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
             LogPrintf("Calculating Mainnet Genesis Block:\n");
             arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
             uint256 hash;
             genesis.nNonce = 0;
             // This will figure out a valid hash and Nonce if you're
             // creating a different genesis block:
             // uint256 hashTarget = CBigNum().SetCompact(genesis.nBits).getuint256();
             // hashTarget.SetCompact(genesis.nBits, &fNegative, &fOverflow).getuint256();
             // while (genesis.GetHash() > hashTarget)
             while (UintToArith256(genesis.GetHash()) > hashTarget)
             {
                 ++genesis.nNonce;
                 if (genesis.nNonce == 0)
                 {
                     LogPrintf("NONCE WRAPPED, incrementing time");
                     std::cout << std::string("NONCE WRAPPED, incrementing time:\n");
                     ++genesis.nTime;
                 }
                 if (genesis.nNonce % 10000 == 0)
                 {
                     LogPrintf("Mainnet: nonce %08u: hash = %s \n", genesis.nNonce, genesis.GetHash().ToString().c_str());
                     // std::cout << strNetworkID << " nonce: " << genesis.nNonce << " time: " << genesis.nTime << " hash: " << genesis.GetHash().ToString().c_str() << "\n";
                 }
             }
             std::cout << "Mainnet ---\n";
             std::cout << "  nonce: " << genesis.nNonce <<  "\n";
             std::cout << "   time: " << genesis.nTime << "\n";
             std::cout << "   hash: " << genesis.GetHash().ToString().c_str() << "\n";
             std::cout << "   merklehash: "  << genesis.hashMerkleRoot.ToString().c_str() << "\n";
             // Mainnet --- nonce: 296277 time: 1390095618 hash: 000000bdd771b14e5a031806292305e563956ce2584278de414d9965f6ab54b0
         }
         std::cout << std::string("Finished calculating Mainnet Genesis Block:\n");


 */





 //printf("%s\n",consensus.hashGenesisBlock.Tostring().c_str());
  std::cout << std::string("ENTER:\n");
        assert(consensus.hashGenesisBlock == uint256S("0x00000000b2c50d03d4d0bdd38681775ce522f137518145d6b3c913b7dd4423e5"));
         assert(genesis.hashMerkleRoot == uint256S("0xf8621e34b0dcd43361fe589702e06aa79992229bfbca57d058d8561635c30fbe"));
     std::cout << std::string("PASSED:\n");

         printf("min nBit:  %08x\n", consensus.powLimit);

         // Note that of those with the service bits flag, most only support a subset of possible options
         //vSeeds.emplace_back("seed-a.stonicacoin.loshan.co.uk", true);
         //vSeeds.emplace_back("dnsseed.thrasher.io", true);
         //vSeeds.emplace_back("dnsseed.stonicacointools.com", true);
         //vSeeds.emplace_back("dnsseed.stonicacoinpool.org", true);
         //vSeeds.emplace_back("dnsseed.koin-project.com", false);

         base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,127);
         base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,65);
         base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,56);
         base58Prefixes[SECRET_KEY] =     std::vector(1,176);
         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};

         vFixedSeeds = std::vector(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));

         fDefaultConsistencyChecks = false;
         fRequireStandard = true;
         fMineBlocksOnDemand = false;

         checkpointData = (CCheckpointData) {
             {
                 {  0, uint256S("0x00000000b2c50d03d4d0bdd38681775ce522f137518145d6b3c913b7dd4423e5")},

             }
         };

         chainTxData = ChainTxData{
             // Data as of block db42d00d824950a125f9b08b6b6c282c484781562fa8b3bd29d6ce4a2627c348 (height 1259851).
             1502955334, // * UNIX timestamp of last known number of transactions
             1,  // * total number of transactions between genesis and that timestamp
                     //   (the tx=... number in the SetBestChain debug.log lines)
             0.00     // * estimated number of transactions per second after that timestamp
         };
     }
 };

 /**
  * Testnet (v3)
  */
 class CTestNetParams : public CChainParams {
 public:
     CTestNetParams() {
         strNetworkID = "test";
         consensus.nSubsidyHalvingInterval = 840000;
         consensus.BIP34Height = 76;
         consensus.BIP34Hash = uint256S("8075c771ed8b495ffd943980a95f702ab34fce3c8c54e379548bda33cc8c0573");
         consensus.BIP65Height = 76; // 8075c771ed8b495ffd943980a95f702ab34fce3c8c54e379548bda33cc8c0573
         consensus.BIP66Height = 76; // 8075c771ed8b495ffd943980a95f702ab34fce3c8c54e379548bda33cc8c0573
         consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
         consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
         consensus.nPowTargetSpacing = 2.5 * 60;
         consensus.fPowAllowMinDifficultyBlocks = true;
         consensus.fPowNoRetargeting = false;
         consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

         // Deployment of BIP68, BIP112, and BIP113.
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1483228800; // January 1, 2017
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1517356801; // January 31st, 2018

         // Deployment of SegWit (BIP141, BIP143, and BIP147)
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1483228800; // January 1, 2017
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1517356801; // January 31st, 2018

         // The best chain should have at least this much work.
         consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000364b0cbc3568");

         // By default assume that the signatures in ancestors of this block are valid.
         consensus.defaultAssumeValid = uint256S("0xad8ff6c2f5580d2b50bd881e11312425ea84fa99f322bf132beb722f97971bba"); //153490

         pchMessageStart[0] = 0xfd;
         pchMessageStart[1] = 0xd2;
         pchMessageStart[2] = 0xc8;
         pchMessageStart[3] = 0xf1;
         nDefaultPort = 19335;
         nPruneAfterHeight = 1000;

         genesis = CreateGenesisBlock(1511279793, 0, 0x1d00ffff , 1, 50 * COIN);
         consensus.hashGenesisBlock = genesis.GetHash();
         //assert(consensus.hashGenesisBlock == uint256S("0x"));
         //assert(genesis.hashMerkleRoot == uint256S("0x"));

         vFixedSeeds.clear();
         vSeeds.clear();
         // nodes with support for servicebits filtering should be at the top
         //vSeeds.emplace_back("testnet-seed.stonicacointools.com", true);
         //vSeeds.emplace_back("seed-b.stonicacoin.loshan.co.uk", true);
         //vSeeds.emplace_back("dnsseed-testnet.thrasher.io", true);

         base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111);
         base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,196);
         base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,58);
         base58Prefixes[SECRET_KEY] =     std::vector(1,239);
         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};

         vFixedSeeds = std::vector(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));

         fDefaultConsistencyChecks = false;
         fRequireStandard = false;
         fMineBlocksOnDemand = false;

         checkpointData = (CCheckpointData) {
             {
                 {0, uint256S("")},
             }
         };

         chainTxData = ChainTxData{
             // Data as of block 3351b6229da00b47ad7a8d7e1323b0e2874744b5296e3d6448293463ab758624 (height 153489)
             //1502953751,
             //382986,
             //0.01
         };

     }
 };

 /**
  * Regression test
  */
 class CRegTestParams : public CChainParams {
 public:
     CRegTestParams() {
         strNetworkID = "regtest";
         consensus.nSubsidyHalvingInterval = 150;
         consensus.BIP34Height = 100000000; // BIP34 has not activated on regtest (far in the future so block v1 are not rejected in tests)
         consensus.BIP34Hash = uint256();
         consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
         consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
         consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
         consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // two weeks
         consensus.nPowTargetSpacing = 2.5 * 60;
         consensus.fPowAllowMinDifficultyBlocks = true;
         consensus.fPowNoRetargeting = true;
         consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
         consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 999999999999ULL;
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0;
         consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 999999999999ULL;
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 0;
         consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 999999999999ULL;

         // The best chain should have at least this much work.
         consensus.nMinimumChainWork = uint256S("0x00");

         // By default assume that the signatures in ancestors of this block are valid.
         consensus.defaultAssumeValid = uint256S("0x00");

         pchMessageStart[0] = 0xfa;
         pchMessageStart[1] = 0xbf;
         pchMessageStart[2] = 0xb5;
         pchMessageStart[3] = 0xda;
         nDefaultPort = 19444;
         nPruneAfterHeight = 1000;

         genesis = CreateGenesisBlock(1511279793, 0, 0x1d00ffff , 1, 50 * COIN);
         consensus.hashGenesisBlock = genesis.GetHash();
         assert(consensus.hashGenesisBlock == uint256S("0x9"));
         assert(genesis.hashMerkleRoot == uint256S("0x"));

         vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
         vSeeds.clear();      //!< Regtest mode doesn't have any DNS seeds.

         fDefaultConsistencyChecks = true;
         fRequireStandard = false;
         fMineBlocksOnDemand = true;

         checkpointData = (CCheckpointData) {
             {
                 {0, uint256S("530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9")},
             }
         };

         chainTxData = ChainTxData{
             0,
             0,
             0
         };

         base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111);
         base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,196);
         base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1,58);
         base58Prefixes[SECRET_KEY] =     std::vector(1,239);
         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     }
 };

 static std::unique_ptr globalChainParams;

 const CChainParams &Params() {
     assert(globalChainParams);
     return *globalChainParams;
 }

 std::unique_ptr CreateChainParams(const std::string& chain)
 {
     if (chain == CBaseChainParams::MAIN)
         return std::unique_ptr(new CMainParams());
     else if (chain == CBaseChainParams::TESTNET)
         return std::unique_ptr(new CTestNetParams());
     else if (chain == CBaseChainParams::REGTEST)
         return std::unique_ptr(new CRegTestParams());
     throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
 }

 void SelectParams(const std::string& network)
 {
     SelectBaseParams(network);
     globalChainParams = CreateChainParams(network);
 }

 void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
 {
     globalChainParams->UpdateVersionBitsParameters(d, nStartTime, nTimeout);
 }


As you may know the bitcoin developers has omitted the genesis block mining code from source code published in github, but I fortunately found some piece of code in related blogs and it worked, then I have calculated the new Genesis hash, Merkelroot hash and Nonce and put into code as you can see above. The code was compiled correctly and I have not received Assertion failed message for Genesis block but I received another error which you can see in debug.log as below:

Code:

2017-12-15 07:31:33



















 2017-12-15 07:31:33 Stonicacoin version v0.15.0.1-gba8ed3a93be
 2017-12-15 07:31:33 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
 2017-12-15 07:31:33 Assuming ancestors of block 29c8c00e1a5f446a6364a29633d3f1ee16428d87c8d3851a1c570be8170b04c2 have valid signatures.
 2017-12-15 07:31:33 Using the 'standard' SHA256 implementation
 2017-12-15 07:31:33 Using RdRand as an additional entropy source
 2017-12-15 07:31:33 Default data directory /home/kevin/.stonicacoin
 2017-12-15 07:31:33 Using data directory /home/kevin/.stonicacoin
 2017-12-15 07:31:33 Using config file /home/kevin/.stonicacoin/stonicacoin.conf
 2017-12-15 07:31:33 Using at most 125 automatic connections (1024 file descriptors available)
 2017-12-15 07:31:33 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
 2017-12-15 07:31:33 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
 2017-12-15 07:31:33 Using 8 threads for script verification
 2017-12-15 07:31:33 scheduler thread start
 2017-12-15 07:31:33 HTTP: creating work queue of depth 16
 2017-12-15 07:31:33 No rpcpassword set - using random cookie authentication
 2017-12-15 07:31:33 Generated RPC authentication cookie /home/kevin/.stonicacoin/.cookie
 2017-12-15 07:31:33 HTTP: starting 4 worker threads
 2017-12-15 07:31:33 Cache configuration:
 2017-12-15 07:31:33 * Using 2.0MiB for block index database
 2017-12-15 07:31:33 * Using 8.0MiB for chain state database
 2017-12-15 07:31:33 * Using 440.0MiB for in-memory UTXO set (plus up to 4.8MiB of unused mempool space)
 2017-12-15 07:31:33 init message: Loading block index...
 2017-12-15 07:31:33 Opening LevelDB in /home/kevin/.stonicacoin/blocks/index
 2017-12-15 07:31:33 Opened LevelDB successfully
 2017-12-15 07:31:33 Using obfuscation key for /home/kevin/.stonicacoin/blocks/index: 0000000000000000
 2017-12-15 07:31:33 LoadBlockIndexDB: last block file = 0
 2017-12-15 07:31:33 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
 2017-12-15 07:31:33 Checking all blk files are present...
 2017-12-15 07:31:33 LoadBlockIndexDB: transaction index disabled
 2017-12-15 07:31:33 Initializing databases...
 2017-12-15 07:31:33 Pre-allocating up to position 0x1000000 in blk00000.dat
 2017-12-15 07:31:33 Opening LevelDB in /home/kevin/.stonicacoin/chainstate
 2017-12-15 07:31:33 Opened LevelDB successfully
 2017-12-15 07:31:33 Wrote new obfuscate key for /home/kevin/.stonicacoin/chainstate: 77f259e28117a4e1
 2017-12-15 07:31:33 Using obfuscation key for /home/kevin/.stonicacoin/chainstate: 77f259e28117a4e1
 2017-12-15 07:31:33 init message: Rewinding blocks...
 2017-12-15 07:31:33  block index              11ms
 2017-12-15 07:31:33 No wallet support compiled in!
 2017-12-15 07:31:33 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
 2017-12-15 07:31:33 *** Failed to read block
 2017-12-15 07:31:33 Error: Error: A fatal internal error occurred, see debug.log for details


I found that this error(eg. ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8) ) occur in CheckProofOfWork function which is in pow.cpp, Any recommendation is appreciated.
Jump to: