git / moonbite-core / src/chainparams.cpp · raw

// Copyright (c) 2010 Satoshi Nakamoto// Copyright (c) 2009-2020 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 <arith_uint256.h>#include <chainparamsseeds.h>#include <consensus/merkle.h>#include <hash.h> // for signet block challenge hash#include <tinyformat.h>#include <util/system.h>#include <util/strencodings.h>#include <versionbitsinfo.h>#include <assert.h>#include <boost/algorithm/string/classification.hpp>#include <boost/algorithm/string/split.hpp>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;}/** * 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 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) *     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 = "MoonBite: fair launch, no premine, every coin mined from zero";    const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);}static std::vector<uint256> GetFrozenMWEBOutputIDs(){    // The output frozen upstream was a Litecoin-mainnet incident artifact.    // That output cannot exist on this chain, so nothing is frozen.    return {};}/** * Main network */class CMainParams : public CChainParams {public:    CMainParams() {        strNetworkID = CBaseChainParams::MAIN;        consensus.signet_blocks = false;        consensus.signet_challenge.clear();        consensus.nSubsidyHalvingInterval = 1650000;        // MoonBite takes NO protocol revenue. There is no treasury, no dev        // tail, no fee split and no team allocation: 100% of every block        // subsidy plus 100% of every transaction fee goes to the miner who        // found the block. The mechanism below is left inert (rate 0, empty        // script) rather than ripped out, so the zero is explicit and        // auditable in consensus code rather than merely absent.        consensus.nTreasuryRateBps = 0;        consensus.nTreasurySunsetHeight = 0;        consensus.treasuryScript.clear();        // MoonBite launches in 2026 from a fresh genesis, so every soft fork is        // active from block 1. The inherited Litecoin heights left P2SH unenforced        // for ~4 years and segwit inactive for ~23 - which would have made the        // moon1... bech32 addresses this wallet already issues anyone-can-spend.        // There is no legacy chain here to stay compatible with.        consensus.BIP16Height = 1;        consensus.BIP34Height = 1;        consensus.BIP34Hash = uint256();        consensus.BIP65Height = 1;        consensus.BIP66Height = 1;        consensus.CSVHeight = 1;        consensus.SegwitHeight = 1;        consensus.MinBIP9WarningHeight = 2017; // segwit height + miner confirmation window        consensus.powLimit = uint256S("000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // MoonBite: 0x1f0fffff, bootstrap floor (genesis nBits 0x1f0ffff0)        consensus.nPowTargetTimespan = 2 * 60 * 60; // 2 hours (60 blocks x 2 min)        consensus.nPowTargetSpacing = 2 * 60; // MoonBite: 2-minute blocks        consensus.fPowAllowMinDifficultyBlocks = false;        consensus.fPowNoRetargeting = false;        consensus.nRuleChangeActivationThreshold = 45; // 75% of 60        consensus.nMinerConfirmationWindow = 60; // nPowTargetTimespan / nPowTargetSpacing        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;        // Deployment of Taproot (BIPs 340-342)        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartHeight = 1;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeoutHeight = 2016;        // Deployment of MWEB (LIP-0002, LIP-0003, and LIP-0004)        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].bit = 4;        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nStartHeight = 1;        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nTimeoutHeight = 2016;        // MoonBite (bug-bounty #6, 2026-10-09): pin a minimum-chain-work floor and        // an assumevalid block so a node in initial sync rejects low-work attacker        // header chains immediately instead of downloading/validating them (IBD        // resource-exhaustion + weakened eclipse resistance on a fresh node).        // Values are taken from buried, final blocks of the live mainnet, far        // below the tip, so a node can never stall below them.        consensus.nMinimumChainWork = uint256{}; // fresh chain reset 2026-10: no buried work yet        consensus.defaultAssumeValid = uint256{}; // fresh chain reset 2026-10: no assumed-valid block yet        consensus.mweb_input_metadata_grandfather_blockhash = uint256(); // no grandfathered block on a fresh chain        consensus.frozen_mweb_output_ids = GetFrozenMWEBOutputIDs();        /**         * 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] = 0xe2;        pchMessageStart[1] = 0x9b;        pchMessageStart[2] = 0x4d;        pchMessageStart[3] = 0x4d;        nDefaultPort = 9444;        nPruneAfterHeight = 100000;        m_assumed_blockchain_size = 1;        m_assumed_chain_state_size = 2;        // MoonBite (ADR-001/ADR-002 rev): mainnet genesis re-mined for RandomX PoW        // (fixed 32-byte MBITE_RX_SEED cache key) with the 10 MBITE coinbase and        // the 0x1f0ffff0 bootstrap floor. Merkle root changed with the reward.        // Public launch: genesis nTime is 2026-10-17 09:00 CEST (1792220400).        // A block must be timestamped after its parent and no more than 2 h        // ahead of every node's clock, so no valid block 1 can exist before        // 07:00 CEST, the announced launch. Nobody, the founder included, can        // mine earlier.        genesis = CreateGenesisBlock(1792220400, 4036, 0x1f0ffff0, 1, 10 * COIN);        consensus.hashGenesisBlock = genesis.GetHash();    consensus.hashGenesisBlock = genesis.GetHash();        assert(consensus.hashGenesisBlock == uint256S("0xffe25d9248b7f56d8934719ed5c7357f7595451c4b9d391d9b8377e62a83e39c"));        assert(genesis.hashMerkleRoot == uint256S("0x967b739fb4d866f2edcfb027987d46d59265e49a25d76bc5ebb9e22484ab48d6"));        // Note that of those which support the service bits prefix, most only support a subset of        // possible options.        // This is fine at runtime as we'll fall back to using them as an addrfetch if they don't support the        // service bits we want, but we should get them updated to support all service bits wanted by any        // release ASAP to avoid it where possible.        // MoonBite (MBITE) base58 identity: P2PKH addresses lead with 'M'        // (version 50) for the MoonBite brand; P2SH uses the legacy '3'        // (version 5) so it no longer collides with the P2PKH 'M' prefix.        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,50);        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);        base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,5);        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,176);        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};        bech32_hrp = "moon";        mweb_hrp = "moonmweb";        vFixedSeeds.clear(); // fresh chain reset 2026-10: no fixed seeds until new infra exists        fDefaultConsistencyChecks = false;        fRequireStandard = true;        m_is_test_chain = false;        m_is_mockable_chain = false;        checkpointData = {            {                {0, consensus.hashGenesisBlock},            }        };        chainTxData = ChainTxData{            // Fresh chain: no history to estimate sync progress from. The            // inherited Litecoin figures (283M transactions) pinned the            // progress display near zero forever.            /* nTime    */ 0,            /* nTxCount */ 0,            /* dTxRate  */ 0        };    }};/** * Testnet (v3) */class CTestNetParams : public CChainParams {public:    CTestNetParams() {        strNetworkID = CBaseChainParams::TESTNET;        consensus.signet_blocks = false;        consensus.signet_challenge.clear();        consensus.nSubsidyHalvingInterval = 1650000;        // MoonBite takes NO protocol revenue. There is no treasury, no dev        // tail, no fee split and no team allocation: 100% of every block        // subsidy plus 100% of every transaction fee goes to the miner who        // found the block. The mechanism below is left inert (rate 0, empty        // script) rather than ripped out, so the zero is explicit and        // auditable in consensus code rather than merely absent.        consensus.nTreasuryRateBps = 0;        consensus.nTreasurySunsetHeight = 0;        consensus.treasuryScript.clear();        consensus.BIP16Height = 0; // always enforce P2SH BIP16 on testnet        consensus.BIP34Height = 1;        consensus.BIP34Hash = uint256();        consensus.BIP65Height = 1; // 8075c771ed8b495ffd943980a95f702ab34fce3c8c54e379548bda33cc8c0573        consensus.BIP66Height = 1; // 8075c771ed8b495ffd943980a95f702ab34fce3c8c54e379548bda33cc8c0573        consensus.CSVHeight = 1;        consensus.SegwitHeight = 1;        consensus.MinBIP9WarningHeight = 2017;        consensus.powLimit = uint256S("000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // MoonBite: 0x1f0fffff, bootstrap floor (genesis nBits 0x1f0ffff0)        consensus.nPowTargetTimespan = 2 * 60 * 60; // 2 hours (60 blocks x 2 min)        consensus.nPowTargetSpacing = 2 * 60; // MoonBite: 2-minute blocks        consensus.fPowAllowMinDifficultyBlocks = true;        consensus.fPowNoRetargeting = false;        consensus.nRuleChangeActivationThreshold = 45; // 75% of 60 for testchains        consensus.nMinerConfirmationWindow = 60; // nPowTargetTimespan / nPowTargetSpacing        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;        // Deployment of Taproot (BIPs 340-342)        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartHeight = 1;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeoutHeight = 2016;        // Deployment of MWEB (LIP-0002, LIP-0003, and LIP-0004)        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].bit = 4;        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nStartHeight = 1;        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nTimeoutHeight = 2016;        // Inherited from Litecoin testnet and meaningless here: MoonBite testnet        // starts at height 0, so a node would never accumulate that chain work        // and would reject its own chain as insufficient. Zeroed to match        // mainnet and regtest, which were already corrected.        consensus.nMinimumChainWork = uint256{};        consensus.defaultAssumeValid = uint256{};        pchMessageStart[0] = 0xe2;        pchMessageStart[1] = 0x9b;        pchMessageStart[2] = 0x4d;        pchMessageStart[3] = 0x74;        nDefaultPort = 19555;        nPruneAfterHeight = 1000;        m_assumed_blockchain_size = 4;        m_assumed_chain_state_size = 1;        // MoonBite (ADR-001/ADR-002 rev): testnet genesis re-mined for RandomX PoW        // (fixed 32-byte MBITE_RX_SEED cache key) with the 10 MBITE coinbase and        // the 0x1f0ffff0 bootstrap floor. Merkle root changed with the reward.        genesis = CreateGenesisBlock(1792000060, 4200, 0x1f0ffff0, 1, 10 * COIN);        consensus.hashGenesisBlock = genesis.GetHash();    consensus.hashGenesisBlock = genesis.GetHash();        assert(consensus.hashGenesisBlock == uint256S("0x5c2a77cdb0cab1697ca99b770dd0c6acc28baa241b98403587a0355ed58356bc"));        assert(genesis.hashMerkleRoot == uint256S("0x967b739fb4d866f2edcfb027987d46d59265e49a25d76bc5ebb9e22484ab48d6"));        vSeeds.clear();        // MoonBite testnet: the inherited Litecoin DNS seeds        // (testnet-seed.litecointools.com, seed-b.litecoin.loshan.co.uk,        // dnsseed-testnet.thrasher.io) were removed — they resolve to Litecoin        // nodes that reject MoonBite's magic bytes. No public MoonBite testnet        // DNS seed exists yet; discover testnet peers with -addnode/-connect.        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);        base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,58);        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};        bech32_hrp = "tmoon";        mweb_hrp = "tmoonmweb";        // Seeded from Litecoin/Bitcoin testnet hosts on ports 19335/18333, none        // of which speak MoonBite. Cleared until real MoonBite testnet seeds exist.        vFixedSeeds.clear();        fDefaultConsistencyChecks = false;        fRequireStandard = false;        m_is_test_chain = true;        m_is_mockable_chain = false;        // Litecoin testnet checkpoints removed: MoonBite testnet has its own        // genesis, so block 300 could never match and the chain would refuse to        // sync past it. Genesis is the only fixed point on a new chain.        checkpointData = {            {                {0, consensus.hashGenesisBlock},            }        };        chainTxData = ChainTxData{            /* nTime    */ 0,            /* nTxCount */ 0,            /* dTxRate  */ 0,        };    }};/** * Regression test */class CRegTestParams : public CChainParams {public:    explicit CRegTestParams(const ArgsManager& args) {        strNetworkID =  CBaseChainParams::REGTEST;        consensus.signet_blocks = false;        consensus.signet_challenge.clear();        // MoonBite: regtest mirrors the mainnet halving/sunset schedule so that        // short dev/test chains never straddle a subsidy transition. Reorg-style        // tests reuse the same block at different heights; with a fast (150-block)        // regtest halving those reused blocks would fail the height-exact treasury        // check (ADR-005). The halving/treasury-sunset transition maths itself is        // still covered directly by validation_tests (330000/660000 params).        consensus.nSubsidyHalvingInterval = 1650000;        // MoonBite takes NO protocol revenue. There is no treasury, no dev        // tail, no fee split and no team allocation: 100% of every block        // subsidy plus 100% of every transaction fee goes to the miner who        // found the block. The mechanism below is left inert (rate 0, empty        // script) rather than ripped out, so the zero is explicit and        // auditable in consensus code rather than merely absent.        consensus.nTreasuryRateBps = 0;        consensus.nTreasurySunsetHeight = 0;        consensus.treasuryScript.clear();        consensus.BIP16Height = 0;        consensus.BIP34Height = 500; // BIP34 activated on regtest (Used in functional tests)        consensus.BIP34Hash = uint256();        consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in functional tests)        consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in functional tests)        consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)        consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden        consensus.MinBIP9WarningHeight = 0;        consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");        consensus.nPowTargetTimespan = 2 * 60 * 60; // 2 hours (60 blocks x 2 min)        consensus.nPowTargetSpacing = 2 * 60; // MoonBite: 2-minute blocks        consensus.fPowAllowMinDifficultyBlocks = true;        consensus.fPowNoRetargeting = true;        consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains        consensus.nMinerConfirmationWindow = 144; // regtest keeps the 144-block window (mainnet/testnet use 60)        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;        // Deployment of MWEB (LIP-0002 and LIP-0003)        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].bit = 4;        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nStartTime = 1601450001; // September 30, 2020        consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;        consensus.nMinimumChainWork = uint256{};        consensus.defaultAssumeValid = uint256{};        consensus.frozen_mweb_output_ids = GetFrozenMWEBOutputIDs();        pchMessageStart[0] = 0xfa;        pchMessageStart[1] = 0xbf;        pchMessageStart[2] = 0xb5;        pchMessageStart[3] = 0xda;        nDefaultPort = 19444;        nPruneAfterHeight = 1000;        m_assumed_blockchain_size = 0;        m_assumed_chain_state_size = 0;        UpdateActivationParametersFromArgs(args);        // MoonBite (ADR-001/ADR-002 rev): regtest genesis re-mined for RandomX PoW        // with the 10 MBITE coinbase. nNonce ground so RandomX(header) < the        // 0x207fffff target.        genesis = CreateGenesisBlock(1792000120, 0, 0x207fffff, 1, 10 * COIN);        consensus.hashGenesisBlock = genesis.GetHash();    consensus.hashGenesisBlock = genesis.GetHash();        assert(consensus.hashGenesisBlock == uint256S("0x61dc2ef13c0f0f26a9a90c7f34d09578f10e8490687d1314f97233e525f2fe99"));        assert(genesis.hashMerkleRoot == uint256S("0x967b739fb4d866f2edcfb027987d46d59265e49a25d76bc5ebb9e22484ab48d6"));        vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.        vSeeds.clear();      //!< Regtest mode doesn't have any DNS seeds.        fDefaultConsistencyChecks = true;        fRequireStandard = true;        m_is_test_chain = true;        m_is_mockable_chain = true;        checkpointData = {            {                {0, consensus.hashGenesisBlock},            }        };        chainTxData = ChainTxData{            0,            0,            0        };        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);        base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,58);        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};        bech32_hrp = "rmoon";        mweb_hrp = "rmoonmweb";    }    /**     * Allows modifying the Version Bits regtest parameters.     */    void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nStartHeight, int64_t nTimeoutHeight)    {        consensus.vDeployments[d].nStartTime = nStartTime;        consensus.vDeployments[d].nTimeout = nTimeout;        consensus.vDeployments[d].nStartHeight = nStartHeight;        consensus.vDeployments[d].nTimeoutHeight = nTimeoutHeight;    }    void UpdateActivationParametersFromArgs(const ArgsManager& args);};void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args){    if (args.IsArgSet("-segwitheight")) {        int64_t height = args.GetArg("-segwitheight", consensus.SegwitHeight);        if (height < -1 || height >= std::numeric_limits<int>::max()) {            throw std::runtime_error(strprintf("Activation height %ld for segwit is out of valid range. Use -1 to disable segwit.", height));        } else if (height == -1) {            LogPrintf("Segwit disabled for testing\n");            height = std::numeric_limits<int>::max();        }        consensus.SegwitHeight = static_cast<int>(height);    }    if (!args.IsArgSet("-vbparams")) return;    for (const std::string& strDeployment : args.GetArgs("-vbparams")) {        std::vector<std::string> vDeploymentParams;        boost::split(vDeploymentParams, strDeployment, boost::is_any_of(":"));        if (vDeploymentParams.size() < 3 || 5 < vDeploymentParams.size()) {            throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end[:heightstart:heightend]");        }        int64_t nStartTime, nTimeout, nStartHeight, nTimeoutHeight;        if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {            throw std::runtime_error(strprintf("Invalid nStartTime (%s)", vDeploymentParams[1]));        }        if (!ParseInt64(vDeploymentParams[2], &nTimeout)) {            throw std::runtime_error(strprintf("Invalid nTimeout (%s)", vDeploymentParams[2]));        }        if (vDeploymentParams.size() > 3 && !ParseInt64(vDeploymentParams[3], &nStartHeight)) {            throw std::runtime_error(strprintf("Invalid nStartHeight (%s)", vDeploymentParams[3]));        }        if (vDeploymentParams.size() > 4 && !ParseInt64(vDeploymentParams[4], &nTimeoutHeight)) {            throw std::runtime_error(strprintf("Invalid nTimeoutHeight (%s)", vDeploymentParams[4]));        }        bool found = false;        for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {            if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {                UpdateVersionBitsParameters(Consensus::DeploymentPos(j), nStartTime, nTimeout, nStartHeight, nTimeoutHeight);                found = true;                LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, start_height=%d, timeout_height=%d\n", vDeploymentParams[0], nStartTime, nTimeout, nStartHeight, nTimeoutHeight);                break;            }        }        if (!found) {            throw std::runtime_error(strprintf("Invalid deployment (%s)", vDeploymentParams[0]));        }    }}static std::unique_ptr<const CChainParams> globalChainParams;const CChainParams &Params() {    assert(globalChainParams);    return *globalChainParams;}std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, const std::string& chain){    if (chain == CBaseChainParams::MAIN) {        return std::unique_ptr<CChainParams>(new CMainParams());    } else if (chain == CBaseChainParams::TESTNET) {        return std::unique_ptr<CChainParams>(new CTestNetParams());    } else if (chain == CBaseChainParams::SIGNET) {        return std::unique_ptr<CChainParams>(new CTestNetParams()); // TODO: Support SigNet    } else if (chain == CBaseChainParams::REGTEST) {        return std::unique_ptr<CChainParams>(new CRegTestParams(args));    }    throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));}void SelectParams(const std::string& network){    SelectBaseParams(network);    globalChainParams = CreateChainParams(gArgs, network);}