text: // Copyright (c) 2010 Satoshi Nakamoto
  // Copyright (c) 2009-2014 The Bitcoin Core developers
  // Copyright (c) 2014-2019 The Dash Core developers
  // Copyright (c) 2021 The HellenicCoin 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 "arith_uint256.h"
  
  #include <assert.h>
  
  #include <boost/assign/list_of.hpp>
  
  #include "chainparamsseeds.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<unsigned char>((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;
  }
  
  static CBlock CreateDevNetGenesisBlock(const uint256 &prevBlockHash, const std::string& devNetName, uint32_t nTime, uint32_t nNonce, uint32_t nBits, const CAmount& genesisReward)
  {
      assert(!devNetName.empty());
  
      CMutableTransaction txNew;
      txNew.nVersion = 1;
      txNew.vin.resize(1);
      txNew.vout.resize(1);
      // put height (BIP34) and devnet name into coinbase
      txNew.vin[0].scriptSig = CScript() << 1 << std::vector<unsigned char>(devNetName.begin(), devNetName.end());
      txNew.vout[0].nValue = genesisReward;
      txNew.vout[0].scriptPubKey = CScript() << OP_RETURN;
  
      CBlock genesis;
      genesis.nTime    = nTime;
      genesis.nBits    = nBits;
      genesis.nNonce   = nNonce;
      genesis.nVersion = 4;
      genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
      genesis.hashPrevBlock = prevBlockHash;
      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=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1615560009, nBits=1e0ffff0, nNonce=1615912, vtx=1)
   *   CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
   *     CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73)
   *     CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF)
   *   vMerkleTree: e0028e
   */
  static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
  {
      const char* pszTimestamp = "Same slogan as always but now with revolution HNC 2015 2021";
      const CScript genesisOutputScript = CScript() << ParseHex("043f9c96ac208f4644f74c8b150d0db8ceba45fe0686cd6696ee8f53bf0bb30781f041b3e1bcd6b2b719cc2c2d54d5d32dd28a39b883fbfe95f8bf95c1cb716765") << OP_CHECKSIG;
      return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
  }
  
  static CBlock FindDevNetGenesisBlock(const Consensus::Params& params, const CBlock &prevBlock, const CAmount& reward)
  {
      std::string devNetName = GetDevNetName();
      assert(!devNetName.empty());
  
      CBlock block = CreateDevNetGenesisBlock(prevBlock.GetHash(), devNetName.c_str(), prevBlock.nTime + 1, 0, prevBlock.nBits, reward);
  
      arith_uint256 bnTarget;
      bnTarget.SetCompact(block.nBits);
  
      for (uint32_t nNonce = 0; nNonce < UINT32_MAX; nNonce++) {
          block.nNonce = nNonce;
  
          uint256 hash = block.GetHash();
          if (UintToArith256(hash) <= bnTarget)
              return block;
      }
  
      // This is very unlikely to happen as we start the devnet with a very low difficulty. In many cases even the first
      // iteration of the above loop will give a result already
      error("FindDevNetGenesisBlock: could not find devnet genesis block for %s", devNetName);
      assert(false);
  }
  
  // this one is for testing only
  static Consensus::LLMQParams llmq5_60 = {
          .type = Consensus::LLMQ_5_60,
          .name = "llmq_5_60",
          .size = 5,
          .minSize = 3,
          .threshold = 3,
  
          .dkgInterval = 24, // one DKG per hour
          .dkgPhaseBlocks = 2,
          .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization
          .dkgMiningWindowEnd = 18,
          .dkgBadVotesThreshold = 8,
  
          .signingActiveQuorumCount = 2, // just a few ones to allow easier testing
  
          .keepOldConnections = 3,
  };
  
  static Consensus::LLMQParams llmq50_60 = {
          .type = Consensus::LLMQ_50_60,
          .name = "llmq_50_60",
          .size = 50,
          .minSize = 40,
          .threshold = 30,
  
          .dkgInterval = 24, // one DKG per hour
          .dkgPhaseBlocks = 2,
          .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization
          .dkgMiningWindowEnd = 18,
          .dkgBadVotesThreshold = 40,
  
          .signingActiveQuorumCount = 24, // a full day worth of LLMQs
  
          .keepOldConnections = 25,
  };
  
  static Consensus::LLMQParams llmq400_60 = {
          .type = Consensus::LLMQ_400_60,
          .name = "llmq_400_60",
          .size = 400,
          .minSize = 300,
          .threshold = 240,
  
          .dkgInterval = 24 * 12, // one DKG every 12 hours
          .dkgPhaseBlocks = 4,
          .dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization
          .dkgMiningWindowEnd = 28,
          .dkgBadVotesThreshold = 300,
  
          .signingActiveQuorumCount = 4, // two days worth of LLMQs
  
          .keepOldConnections = 5,
  };
  
  // Used for deployment and min-proto-version signalling, so it needs a higher threshold
  static Consensus::LLMQParams llmq400_85 = {
          .type = Consensus::LLMQ_400_85,
          .name = "llmq_400_85",
          .size = 400,
          .minSize = 350,
          .threshold = 340,
  
          .dkgInterval = 24 * 24, // one DKG every 24 hours
          .dkgPhaseBlocks = 4,
          .dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization
          .dkgMiningWindowEnd = 48, // give it a larger mining window to make sure it is mined
          .dkgBadVotesThreshold = 300,
  
          .signingActiveQuorumCount = 4, // two days worth of LLMQs
  
          .keepOldConnections = 5,
  };
  
  
  /**
   * 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 = 700000; 
          consensus.nMasternodePaymentsStartBlock = 1; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
          consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
          consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
          consensus.nInstantSendConfirmationsRequired = 6;
          consensus.nInstantSendKeepLock = 24;
          consensus.nInstantSendSigsRequired = 6;
          consensus.nInstantSendSigsTotal = 10;
          consensus.nBudgetPaymentsStartBlock = 1;
          consensus.nBudgetPaymentsCycleBlocks = 21900;
          consensus.nBudgetPaymentsWindowBlocks = 100;
          consensus.nSuperblockStartBlock = 2; 
          consensus.nSuperblockStartHash = uint256();
          consensus.nSuperblockCycle = 21900;
          consensus.nGovernanceMinQuorum = 10;
          consensus.nGovernanceFilterElements = 20000;
          consensus.nMasternodeMinimumConfirmations = 19;
          consensus.BIP34Height = 1;
          consensus.BIP34Hash = uint256();
          consensus.BIP65Height = 1; 
          consensus.BIP66Height = 1; 
          consensus.DIP0001Height = 2;
          consensus.DIP0003Height = 2;
          consensus.DIP0003EnforcementHeight = 2;
          consensus.DIP0003EnforcementHash = uint256();
          consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
          consensus.nPowTargetTimespan = 60 * 60;
          consensus.nPowTargetSpacing = 2 * 60;
          consensus.fPowAllowMinDifficultyBlocks = false;
          consensus.fPowNoRetargeting = false;
          consensus.nPowKGWHeight = 1;
          consensus.nPowDGWHeight = 1;
          consensus.nRuleChangeActivationThreshold = 29; // 95% of 30
          consensus.nMinerConfirmationWindow = 30; // 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 = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 999999999999ULL; 
  
          // Deployment of DIP0001
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 24; 
  
          // Deployment of BIP147
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nThreshold = 24; 
  
          // Deployment of DIP0003
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 24; 
  
          // Deployment of DIP0008
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].bit = 4;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 24; 
  
          // The best chain should have at least this much work.
          consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000100010"); 
  
          // By default assume that the signatures in ancestors of this block are valid.
          consensus.defaultAssumeValid = uint256S("0x00000e0c09c1e8168627358b3170fb343a5443e12d9443130234c45558d50383"); 
  
          /**
           * 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] = 0x58;
          pchMessageStart[1] = 0x42;
          pchMessageStart[2] = 0x96;
          pchMessageStart[3] = 0xf5;
          vAlertPubKey = ParseHex("0421909d507ea24cc928d1e5637629190a885fb63482049d4949bbabc6b79a3a710f24aa985f98dc076277e90f118bc94ba9e3128fe303a8c65cf559092274c0c1");
          nDefaultPort = 31052;
          nPruneAfterHeight = 100000;
  
          genesis = CreateGenesisBlock(1615560009, 1615912, 0x1e0ffff0, 1, 5 * COIN);
          consensus.hashGenesisBlock = genesis.GetHash();
          // calculate main genesis block
          //consensus.hashGenesisBlock = uint256S("0x00");
          if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
  		std::cout << std::string("Calculating main genesis block...\n");
              arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
              uint256 hash;
              genesis.nNonce = 0;
              while (UintToArith256(genesis.GetHash()) > hashTarget)
              {
                  ++genesis.nNonce;
                  if (genesis.nNonce == 0)
                  {
                      ++genesis.nTime;
                  }
              }
              std::cout << "Genesis block found!\n";
              std::cout << "nonce: " << genesis.nNonce << "\n";
              std::cout << "time: " << genesis.nTime << "\n";
              std::cout << "blockhash: " << genesis.GetHash().ToString().c_str() << "\n";
              std::cout << "merklehash: " << genesis.hashMerkleRoot.ToString().c_str() << "\n";
          }
          assert(consensus.hashGenesisBlock == uint256S("0x00000e0c09c1e8168627358b3170fb343a5443e12d9443130234c45558d50383"));
          assert(genesis.hashMerkleRoot == uint256S("0x69587449b6c60494903474468f7bf0423703e7ae0b4de58a2b8d41afe45dc486"));
  
  
          vSeeds.push_back(CDNSSeedData("helleniccoin.com", "node1.helleniccoin.com"));
          vSeeds.push_back(CDNSSeedData("n2.helleniccoin.com", "node2.helleniccoin.com"));
  
          base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,40);
          base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,41);
          base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,168);
          // HellenicCoin BIP32 pubkeys start with 'xpub' (Bitcoin defaults)
          base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
          // HellenicCoin BIP32 prvkeys start with 'xprv' (Bitcoin defaults)
          base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();
  
          // HellenicCoin BIP44 coin type is '5'
          nExtCoinType = 5;
  
          vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
  
          // long living quorum params
          consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
          consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
          consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
          consensus.llmqChainLocks = Consensus::LLMQ_400_60;
          consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
  
          fMiningRequiresPeers = true;
          fDefaultConsistencyChecks = false;
          fRequireStandard = true;
          fRequireRoutableExternalIP = true;
          fMineBlocksOnDemand = false;
          fAllowMultipleAddressesFromGroup = false;
          fAllowMultiplePorts = false;
  
          nPoolMinParticipants = 3;
          nPoolMaxParticipants = 5;
          nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour
  
          vSporkAddresses = {"HQ9BRXBJ4kucG5suhgcXAP65jiMbnSERhq"};
          nMinSporkKeys = 1;
          fBIP9CheckMasternodesUpgraded = true;
  
          checkpointData = (CCheckpointData) {
              boost::assign::map_list_of
              (  0, uint256S("0x00000e0c09c1e8168627358b3170fb343a5443e12d9443130234c45558d50383"))
          };
  
          chainTxData = ChainTxData{
              1615560009, // * UNIX timestamp of last known number of transactions (Block 1068571)
              0,   // * total number of transactions between genesis and that timestamp
                          //   (the tx=... number in the SetBestChain debug.log lines)
              0         // * estimated number of transactions per second after that timestamp
          };
      }
  };
  static CMainParams mainParams;
  
  /**
   * Testnet (v3)
   */
  class CTestNetParams : public CChainParams {
  public:
      CTestNetParams() {
          strNetworkID = "test";
          consensus.nSubsidyHalvingInterval = 700000;
          consensus.nMasternodePaymentsStartBlock = 1; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
          consensus.nMasternodePaymentsIncreaseBlock = 4030;
          consensus.nMasternodePaymentsIncreasePeriod = 10;
          consensus.nInstantSendConfirmationsRequired = 2;
          consensus.nInstantSendKeepLock = 6;
          consensus.nInstantSendSigsRequired = 6;
          consensus.nInstantSendSigsTotal = 10;
          consensus.nBudgetPaymentsStartBlock = 4100;
          consensus.nBudgetPaymentsCycleBlocks = 50;
          consensus.nBudgetPaymentsWindowBlocks = 10;
          consensus.nSuperblockStartBlock = 2; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
          consensus.nSuperblockStartHash = uint256(); // do not check this on testnet
          consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
          consensus.nGovernanceMinQuorum = 1;
          consensus.nGovernanceFilterElements = 500;
          consensus.nMasternodeMinimumConfirmations = 1;
          consensus.BIP34Height = 1;
          consensus.BIP34Hash = uint256();
          consensus.BIP65Height = 1; 
          consensus.BIP66Height = 1; 
          consensus.DIP0001Height = 2;
          consensus.DIP0003Height = 2;
          consensus.DIP0003EnforcementHeight = 2;
          consensus.DIP0003EnforcementHash = uint256();
          consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
          consensus.nPowTargetTimespan = 60 * 60;
          consensus.nPowTargetSpacing = 2 * 60;
          consensus.fPowAllowMinDifficultyBlocks = true;
          consensus.fPowNoRetargeting = false;
          consensus.nPowKGWHeight = 1; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
          consensus.nPowDGWHeight = 1;
          consensus.nRuleChangeActivationThreshold = 23; // 75% for testchains
          consensus.nMinerConfirmationWindow = 30; // 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 = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 999999999999ULL; 
  
          // Deployment of DIP0001
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 15; 
  
          // Deployment of BIP147
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nThreshold = 15; 
  
          // Deployment of DIP0003
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 15; 
  
          // Deployment of DIP0008
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].bit = 4;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 15; 
  
          // The best chain should have at least this much work.
          consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000100010"); 
  
          // By default assume that the signatures in ancestors of this block are valid.
          consensus.defaultAssumeValid = uint256S("0x000005e2d4cfe29bd3bfe07af45bd9639d284ce3b21ca79b629e7616c895e20a"); 
  
          pchMessageStart[0] = 0x9e;
          pchMessageStart[1] = 0xb0;
          pchMessageStart[2] = 0xa1;
          pchMessageStart[3] = 0x77;
          vAlertPubKey = ParseHex("046035ca716d089433f602a9dba3f609ea0ac8aec19ef7cf9bf97847c9dc42a71a22f82b4307edf058dfea198e135428d2a6802f89043fcfa6f8e30e080e95092b");
          nDefaultPort = 41052;
          nPruneAfterHeight = 1000;
  
          genesis = CreateGenesisBlock(1631514890UL, 1833960UL, 0x1e0ffff0, 1, 5 * COIN);
          consensus.hashGenesisBlock = genesis.GetHash();
          // calculate testnet genesis block
          //consensus.hashGenesisBlock = uint256S("0x00");
          if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
  		std::cout << std::string("Calculating testnet genesis block...\n");
              arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
              uint256 hash;
              genesis.nNonce = 0;
              while (UintToArith256(genesis.GetHash()) > hashTarget)
              {
                  ++genesis.nNonce;
                  if (genesis.nNonce == 0)
                  {
                      ++genesis.nTime;
                  }
              }
              std::cout << "Genesis block found!\n";
              std::cout << "nonce: " << genesis.nNonce << "\n";
              std::cout << "time: " << genesis.nTime << "\n";
              std::cout << "blockhash: " << genesis.GetHash().ToString().c_str() << "\n";
              std::cout << "merklehash: " << genesis.hashMerkleRoot.ToString().c_str() << "\n";
          }
          assert(consensus.hashGenesisBlock == uint256S("0x00000f2ba3274ffdfd0034d9eea21c7350c33debc276d0ce0b449f98ca3a2599"));
          assert(genesis.hashMerkleRoot == uint256S("0x69587449b6c60494903474468f7bf0423703e7ae0b4de58a2b8d41afe45dc486"));
  
          vFixedSeeds.clear();
          vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
  
          vSeeds.clear();
  
          base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,70);
          base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,71);
          // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
          base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,198);
          // Testnet HellenicCoin BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
          base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
          // Testnet HellenicCoin BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
          base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
  
          // Testnet HellenicCoin BIP44 coin type is '1' (All coin's testnet default)
          nExtCoinType = 1;
  
          // long living quorum params
          consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
          consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
          consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
          consensus.llmqChainLocks = Consensus::LLMQ_50_60;
          consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
  
          fMiningRequiresPeers = true;
          fDefaultConsistencyChecks = false;
          fRequireStandard = false;
          fRequireRoutableExternalIP = true;
          fMineBlocksOnDemand = false;
          fAllowMultipleAddressesFromGroup = false;
          fAllowMultiplePorts = true;
  
          nPoolMinParticipants = 3;
          nPoolMaxParticipants = 5;
          nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
  
          vSporkAddresses = {"VYizTEAvZzhoGP5o714K51DHZPgeouqg88"};
          nMinSporkKeys = 1;
          fBIP9CheckMasternodesUpgraded = true;
  
          checkpointData = (CCheckpointData) {
              boost::assign::map_list_of
              (    0, uint256S("0x000005e2d4cfe29bd3bfe07af45bd9639d284ce3b21ca79b629e7616c895e20a"))
          };
  
          chainTxData = ChainTxData{
              1615560014, // * UNIX timestamp of last known number of transactions (Block 96717)
              0,     // * total number of transactions between genesis and that timestamp
                          //   (the tx=... number in the SetBestChain debug.log lines)
              0        // * estimated number of transactions per second after that timestamp
          };
  
      }
  };
  static CTestNetParams testNetParams;
  
  /**
   * Devnet
   */
  class CDevNetParams : public CChainParams {
  public:
      CDevNetParams() {
          strNetworkID = "dev";
          consensus.nSubsidyHalvingInterval = 700000;
          consensus.nMasternodePaymentsStartBlock = 1; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
          consensus.nMasternodePaymentsIncreaseBlock = 4030;
          consensus.nMasternodePaymentsIncreasePeriod = 10;
          consensus.nInstantSendConfirmationsRequired = 2;
          consensus.nInstantSendKeepLock = 6;
          consensus.nInstantSendSigsRequired = 6;
          consensus.nInstantSendSigsTotal = 10;
          consensus.nBudgetPaymentsStartBlock = 4100;
          consensus.nBudgetPaymentsCycleBlocks = 50;
          consensus.nBudgetPaymentsWindowBlocks = 10;
          consensus.nSuperblockStartBlock = 2; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
          consensus.nSuperblockStartHash = uint256(); // do not check this on devnet
          consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on devnet
          consensus.nGovernanceMinQuorum = 1;
          consensus.nGovernanceFilterElements = 500;
          consensus.nMasternodeMinimumConfirmations = 1;
          consensus.BIP34Height = 1; // BIP34 activated immediately on devnet
          consensus.BIP65Height = 1; // BIP65 activated immediately on devnet
          consensus.BIP66Height = 1; // BIP66 activated immediately on devnet
          consensus.DIP0001Height = 2; // DIP0001 activated immediately on devnet
          consensus.DIP0003Height = 2; // DIP0003 activated immediately on devnet
          consensus.DIP0003EnforcementHeight = 2; // DIP0003 activated immediately on devnet
          consensus.DIP0003EnforcementHash = uint256();
          consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
          consensus.nPowTargetTimespan = 60 * 60;
          consensus.nPowTargetSpacing = 2 * 60;
          consensus.fPowAllowMinDifficultyBlocks = true;
          consensus.fPowNoRetargeting = false;
          consensus.nPowKGWHeight = 4001; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
          consensus.nPowDGWHeight = 4001;
          consensus.nRuleChangeActivationThreshold = 23; // 75% for testchains
          consensus.nMinerConfirmationWindow = 30; // 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 = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 999999999999ULL; 
  
          // Deployment of DIP0001
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 15; 
  
          // Deployment of BIP147
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nThreshold = 15; 
  
          // Deployment of DIP0003
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 1535752800; // Sep 1st, 2018
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = 1567288800; // Sep 1st, 2019
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 15; 
  
          // Deployment of DIP0008
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].bit = 4;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 0; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = 999999999999ULL; 
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 30;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 15; 
  
          // The best chain should have at least this much work.
          consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000000000000000");
  
          // By default assume that the signatures in ancestors of this block are valid.
          consensus.defaultAssumeValid = uint256S("0x000000000000000000000000000000000000000000000000000000000000000");
  
          pchMessageStart[0] = 0x4e;
          pchMessageStart[1] = 0x31;
          pchMessageStart[2] = 0x57;
          pchMessageStart[3] = 0x3e;
          vAlertPubKey = ParseHex("046035ca716d089433f602a9dba3f609ea0ac8aec19ef7cf9bf97847c9dc42a71a22f82b4307edf058dfea198e135428d2a6802f89043fcfa6f8e30e080e95092b");
          nDefaultPort = 41052;
          nPruneAfterHeight = 1000;
  
          genesis = CreateGenesisBlock(1615560019, 0, 0x207fffff, 1, 5 * COIN);
          consensus.hashGenesisBlock = genesis.GetHash();
          // calculate regression genesis block
          //consensus.hashGenesisBlock = uint256S("0x00");
          if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
                  std::cout << std::string("Calculating regression block...\n");
              arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
              uint256 hash;
              genesis.nNonce = 0;
              while (UintToArith256(genesis.GetHash()) > hashTarget)
              {
                  ++genesis.nNonce;
                  if (genesis.nNonce == 0)
                  {
                      ++genesis.nTime;
                  }
              }
              std::cout << "Genesis block found!\n";
              std::cout << "nonce: " << genesis.nNonce << "\n";
              std::cout << "time: " << genesis.nTime << "\n";
              std::cout << "blockhash: " << genesis.GetHash().ToString().c_str() << "\n";
              std::cout << "merklehash: "  << genesis.hashMerkleRoot.ToString().c_str() << "\n";
          }
          assert(consensus.hashGenesisBlock == uint256S("0x65d6bb7b6fcaac47bde82851fc826415238eddfdc8c49bdb00210649df85ec2a"));
          assert(genesis.hashMerkleRoot == uint256S("0x69587449b6c60494903474468f7bf0423703e7ae0b4de58a2b8d41afe45dc486"));
  
          devnetGenesis = FindDevNetGenesisBlock(consensus, genesis, 5 * COIN);
          consensus.hashDevnetGenesisBlock = devnetGenesis.GetHash();
  
          vFixedSeeds.clear();
          vSeeds.clear();
          //vSeeds.push_back(CDNSSeedData("helleniccoinevo.org",  "devnet-seed.helleniccoinevo.org"));
  
          base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,70);
          base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,71);
          // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
          base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,198);
          // Testnet HellenicCoin BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
          base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
          // Testnet HellenicCoin BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
          base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
  
          // Testnet HellenicCoin BIP44 coin type is '1' (All coin's testnet default)
          nExtCoinType = 1;
  
          // long living quorum params
          consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
          consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
          consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
          consensus.llmqChainLocks = Consensus::LLMQ_50_60;
          consensus.llmqForInstantSend = Consensus::LLMQ_50_60;
  
          fMiningRequiresPeers = true;
          fDefaultConsistencyChecks = false;
          fRequireStandard = false;
          fMineBlocksOnDemand = false;
          fAllowMultipleAddressesFromGroup = true;
          fAllowMultiplePorts = true;
  
          nPoolMinParticipants = 3;
          nPoolMaxParticipants = 5;
          nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
  
          vSporkAddresses = {"VYizTEAvZzhoGP5o714K51DHZPgeouqg88"};
          nMinSporkKeys = 1;
          // devnets are started with no blocks and no MN, so we can't check for upgraded MN (as there are none)
          fBIP9CheckMasternodesUpgraded = false;
  
          checkpointData = (CCheckpointData) {
              boost::assign::map_list_of
              (      0, uint256S("0x65d6bb7b6fcaac47bde82851fc826415238eddfdc8c49bdb00210649df85ec2a"))
              (      1, devnetGenesis.GetHash())
          };
  
          chainTxData = ChainTxData{
              devnetGenesis.GetBlockTime(), // * UNIX timestamp of devnet genesis block
              2,                            // * we only have 2 coinbase transactions when a devnet is started up
              0                          // * estimated number of transactions per second
          };
      }
  
      void UpdateSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor)
      {
          consensus.nMinimumDifficultyBlocks = nMinimumDifficultyBlocks;
          consensus.nHighSubsidyBlocks = nHighSubsidyBlocks;
          consensus.nHighSubsidyFactor = nHighSubsidyFactor;
      }
  
      void UpdateLLMQChainLocks(Consensus::LLMQType llmqType) {
          consensus.llmqChainLocks = llmqType;
      }
  };
  static CDevNetParams *devNetParams;
  
  
  /**
   * Regression test
   */
  class CRegTestParams : public CChainParams {
  public:
      CRegTestParams() {
          strNetworkID = "regtest";
          consensus.nSubsidyHalvingInterval = 150;
          consensus.nMasternodePaymentsStartBlock = 240;
          consensus.nMasternodePaymentsIncreaseBlock = 350;
          consensus.nMasternodePaymentsIncreasePeriod = 10;
          consensus.nInstantSendConfirmationsRequired = 2;
          consensus.nInstantSendKeepLock = 6;
          consensus.nInstantSendSigsRequired = 3;
          consensus.nInstantSendSigsTotal = 5;
          consensus.nBudgetPaymentsStartBlock = 1000;
          consensus.nBudgetPaymentsCycleBlocks = 50;
          consensus.nBudgetPaymentsWindowBlocks = 10;
          consensus.nSuperblockStartBlock = 1500;
          consensus.nSuperblockStartHash = uint256(); // do not check this on regtest
          consensus.nSuperblockCycle = 10;
          consensus.nGovernanceMinQuorum = 1;
          consensus.nGovernanceFilterElements = 100;
          consensus.nMasternodeMinimumConfirmations = 1;
          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.DIP0001Height = 2000;
          consensus.DIP0003Height = 432;
          consensus.DIP0003EnforcementHeight = 500;
          consensus.DIP0003EnforcementHash = uint256();
          consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
          consensus.nPowTargetTimespan = 60 * 60;
          consensus.nPowTargetSpacing = 2 * 60;
          consensus.fPowAllowMinDifficultyBlocks = true;
          consensus.fPowNoRetargeting = true;
          consensus.nPowKGWHeight = 1; // same as mainnet
          consensus.nPowDGWHeight = 1; // same as mainnet
          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_DIP0001].bit = 1;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 0;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 999999999999ULL;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 0;
          consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = 999999999999ULL;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 0;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = 999999999999ULL;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].bit = 4;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 0;
          consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].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] = 0xfc;
          pchMessageStart[1] = 0xc1;
          pchMessageStart[2] = 0xb7;
          pchMessageStart[3] = 0xdc;
          nDefaultPort = 19994;
          nPruneAfterHeight = 1000;
  
          genesis = CreateGenesisBlock(1615560019, 0, 0x207fffff, 1, 5 * COIN);
          consensus.hashGenesisBlock = genesis.GetHash();
          // calculate regression genesis block
          //consensus.hashGenesisBlock = uint256S("0x00");
          if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
                  std::cout << std::string("Calculating regression block...\n");
              arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
              uint256 hash;
              genesis.nNonce = 0;
              while (UintToArith256(genesis.GetHash()) > hashTarget)
              {
                  ++genesis.nNonce;
                  if (genesis.nNonce == 0)
                  {
                      ++genesis.nTime;
                  }
              }
              std::cout << "Genesis block found!\n";
              std::cout << "nonce: " << genesis.nNonce << "\n";
              std::cout << "time: " << genesis.nTime << "\n";
              std::cout << "blockhash: " << genesis.GetHash().ToString().c_str() << "\n";
              std::cout << "merklehash: "  << genesis.hashMerkleRoot.ToString().c_str() << "\n";
          }
          assert(consensus.hashGenesisBlock == uint256S("0x65d6bb7b6fcaac47bde82851fc826415238eddfdc8c49bdb00210649df85ec2a"));
          assert(genesis.hashMerkleRoot == uint256S("0x69587449b6c60494903474468f7bf0423703e7ae0b4de58a2b8d41afe45dc486"));
  
          vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
          vSeeds.clear();      //!< Regtest mode doesn't have any DNS seeds.
  
          fMiningRequiresPeers = false;
          fDefaultConsistencyChecks = true;
          fRequireStandard = false;
          fRequireRoutableExternalIP = false;
          fMineBlocksOnDemand = true;
          fAllowMultipleAddressesFromGroup = true;
          fAllowMultiplePorts = true;
  
          nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
  
          // privKey: 7eEwqifLvGtdWQkPrD1dTAcfXTEqJQVp7uvj4g3ezcWDRSdjqo1
          vSporkAddresses = {"VRJM34sRWakwv1Gd5FQQbRd5f6nrxX5cTU"};
          nMinSporkKeys = 1;
          // regtest usually has no masternodes in most tests, so don't check for upgraged MNs
          fBIP9CheckMasternodesUpgraded = false;
  
          checkpointData = (CCheckpointData){
              boost::assign::map_list_of
              ( 0, uint256S("0x65d6bb7b6fcaac47bde82851fc826415238eddfdc8c49bdb00210649df85ec2a"))
          };
  
          chainTxData = ChainTxData{
              0,
              0,
              0
          };
  
          // Regtest HellenicCoin addresses start with 'y'
          base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,70);
          // Regtest HellenicCoin script addresses start with '8' or '9'
          base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,71);
          // Regtest private keys start with '9' or 'c' (Bitcoin defaults)
          base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,198);
          // Regtest HellenicCoin BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
          base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
          // Regtest HellenicCoin BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
          base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
  
          // Regtest HellenicCoin BIP44 coin type is '1' (All coin's testnet default)
          nExtCoinType = 1;
  
          // long living quorum params
          consensus.llmqs[Consensus::LLMQ_5_60] = llmq5_60;
          consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
          consensus.llmqChainLocks = Consensus::LLMQ_5_60;
          consensus.llmqForInstantSend = Consensus::LLMQ_5_60;
      }
  
      void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
      {
          consensus.vDeployments[d].nStartTime = nStartTime;
          consensus.vDeployments[d].nTimeout = nTimeout;
          if (nWindowSize != -1) {
              consensus.vDeployments[d].nWindowSize = nWindowSize;
          }
          if (nThreshold != -1) {
              consensus.vDeployments[d].nThreshold = nThreshold;
          }
      }
  
      void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
      {
          consensus.DIP0003Height = nActivationHeight;
          consensus.DIP0003EnforcementHeight = nEnforcementHeight;
      }
  
      void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
      {
          consensus.nMasternodePaymentsStartBlock = nMasternodePaymentsStartBlock;
          consensus.nBudgetPaymentsStartBlock = nBudgetPaymentsStartBlock;
          consensus.nSuperblockStartBlock = nSuperblockStartBlock;
      }
  };
  static CRegTestParams regTestParams;
  
  static CChainParams *pCurrentParams = 0;
  
  const CChainParams &Params() {
      assert(pCurrentParams);
      return *pCurrentParams;
  }
  
  CChainParams& Params(const std::string& chain)
  {
      if (chain == CBaseChainParams::MAIN)
              return mainParams;
      else if (chain == CBaseChainParams::TESTNET)
              return testNetParams;
      else if (chain == CBaseChainParams::DEVNET) {
              assert(devNetParams);
              return *devNetParams;
      } else if (chain == CBaseChainParams::REGTEST)
              return regTestParams;
      else
          throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
  }
  
  void SelectParams(const std::string& network)
  {
      if (network == CBaseChainParams::DEVNET) {
          devNetParams = (CDevNetParams*)new uint8_t[sizeof(CDevNetParams)];
          memset(devNetParams, 0, sizeof(CDevNetParams));
          new (devNetParams) CDevNetParams();
      }
  
      SelectBaseParams(network);
      pCurrentParams = &Params(network);
  }
  
  void UpdateRegtestBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
  {
      regTestParams.UpdateBIP9Parameters(d, nStartTime, nTimeout, nWindowSize, nThreshold);
  }
  
  void UpdateRegtestDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
  {
      regTestParams.UpdateDIP3Parameters(nActivationHeight, nEnforcementHeight);
  }
  
  void UpdateRegtestBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
  {
      regTestParams.UpdateBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
  }
  
  void UpdateDevnetSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor)
  {
      assert(devNetParams);
      devNetParams->UpdateSubsidyAndDiffParams(nMinimumDifficultyBlocks, nHighSubsidyBlocks, nHighSubsidyFactor);
  }
  
  void UpdateDevnetLLMQChainLocks(Consensus::LLMQType llmqType)
  {
      assert(devNetParams);
      devNetParams->UpdateLLMQChainLocks(llmqType);
  }
  