- // 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 <chainparamsseeds.h>
- #include <consensus/merkle.h>
- #include <hash.h> // for signet block challenge hash
- #include <util/system.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 = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
- const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
- return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
- }
- /**
- * Main network
- */
- class CMainParams : public CChainParams {
- public:
- CMainParams() {
- strNetworkID = CBaseChainParams::MAIN;
- consensus.signet_blocks = false;
- consensus.signet_challenge.clear();
- consensus.nSubsidyHalvingInterval = 210000;
- consensus.BIP16Exception = uint256();
- consensus.BIP34Height = 0;
- consensus.BIP34Hash = uint256S();
- consensus.BIP65Height = 0;
- consensus.BIP66Height = 0;
- consensus.CSVHeight = 419328; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5
- consensus.SegwitHeight = 481824; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893
- consensus.MinBIP9WarningHeight = 483840; // segwit activation height + miner confirmation window
- consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
- consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
- consensus.nPowTargetSpacing = 10 * 60;
- consensus.fPowAllowMinDifficultyBlocks = false;
- consensus.fPowNoRetargeting = false;
- consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
- 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 Taproot (BIPs 340-342)
- consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
- consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1199145601; // January 1, 2008
- consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1230767999; // December 31, 2008
- // Deployment of BIP68, BIP112, and BIP113.
- consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
- consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
- consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
- // Deployment of SegWit (BIP141, BIP143, and BIP147)
- consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
- consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
- consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
- consensus.nMinimumChainWork = consensus.powLimit;
- consensus.defaultAssumeValid = uint256();
- /**
- * 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] = 0xbb;
- pchMessageStart[1] = 0xd7;
- pchMessageStart[2] = 0xcd;
- pchMessageStart[3] = 0xae;
- nDefaultPort = 8433;
- nPruneAfterHeight = 100000;
- m_assumed_blockchain_size = 350;
- m_assumed_chain_state_size = 6;
- genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
- consensus.hashGenesisBlock = genesis.GetHash();
- assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
- assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
- // 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.
- vSeeds.emplace_back("seed.testcoin.sipa.be"); // Pieter Wuille, only supports x1, x5, x9, and xd
- vSeeds.emplace_back("dnsseed.bluematt.me"); // Matt Corallo, only supports x9
- vSeeds.emplace_back("dnsseed.testcoin.dashjr.org"); // Luke Dashjr
- vSeeds.emplace_back("seed.testcoinstats.com"); // Christian Decker, supports x1 - xf
- vSeeds.emplace_back("seed.testcoin.jonasschnelli.ch"); // Jonas Schnelli, only supports x1, x5, x9, and xd
- vSeeds.emplace_back("seed.btc.petertodd.org"); // Peter Todd, only supports x1, x5, x9, and xd
- vSeeds.emplace_back("seed.testcoin.sprovoost.nl"); // Sjors Provoost
- vSeeds.emplace_back("dnsseed.emzy.de"); // Stephan Oeste
- vSeeds.emplace_back("seed.testcoin.wiz.biz"); // Jason Maurice
- base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,45);
- base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,48);
- base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
- base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
- base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
- bech32_hrp = "ac";
- vFixedSeeds = std::vector<SeedSpec6>(std::begin(pnSeed6_main), std::end(pnSeed6_main));
- fDefaultConsistencyChecks = false;
- fRequireStandard = true;
- m_is_test_chain = false;
- m_is_mockable_chain = false;
- checkpointData = {
- {
- }
- };
- m_assumeutxo_data = MapAssumeutxo{
- // TODO to be specified in a future patch.
- };
- chainTxData = ChainTxData{
- // Data from rpc: getchaintxstats 4096 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8
- /* nTime */ 0,//1532884444,
- /* nTxCount */ 0,//331282217,
- /* dTxRate */ 0,//2.4
- };
- }
- };
- /**
- * Testnet (v3)
- */
- class CTestNetParams : public CChainParams {
- public:
- CTestNetParams() {
- strNetworkID = CBaseChainParams::TESTNET;
- consensus.signet_blocks = false;
- consensus.signet_challenge.clear();
- consensus.nSubsidyHalvingInterval = 210000;
- consensus.BIP16Exception = uint256();
- consensus.BIP34Height = ;
- consensus.BIP34Hash = uint256S();
- consensus.BIP65Height = 0;
- consensus.BIP66Height = 0;
- consensus.CSVHeight = 770112; // 00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb
- consensus.SegwitHeight = 834624; // 00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca
- consensus.MinBIP9WarningHeight = 836640; // segwit activation height + miner confirmation window
- consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
- consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
- consensus.nPowTargetSpacing = 10 * 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 Taproot (BIPs 340-342)
- consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
- consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1199145601; // January 1, 2008
- consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1230767999; // December 31, 2008
- // Deployment of BIP68, BIP112, and BIP113.
- consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
- consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
- consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
- // Deployment of SegWit (BIP141, BIP143, and BIP147)
- consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
- consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
- consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
- consensus.nMinimumChainWork = consensus.powLimit;
- consensus.defaultAssumeValid = uint256S();
- pchMessageStart[0] = 0xc0;
- pchMessageStart[1] = 0xeb;
- pchMessageStart[2] = 0xce;
- pchMessageStart[3] = 0xad;
- nDefaultPort = 18433;
- nPruneAfterHeight = 1000;
- m_assumed_blockchain_size = 40;
- m_assumed_chain_state_size = 2;
- genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN);
- consensus.hashGenesisBlock = genesis.GetHash();
- assert(consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
- assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
- vFixedSeeds.clear();
- vSeeds.clear();
- // nodes with support for servicebits filtering should be at the top
- vSeeds.emplace_back("testnet-seed.testcoin.jonasschnelli.ch");
- vSeeds.emplace_back("seed.tbtc.petertodd.org");
- vSeeds.emplace_back("seed.testnet.testcoin.sprovoost.nl");
- vSeeds.emplace_back("testnet-seed.bluematt.me"); // Just a static list of stable node(s), only supports x9
- base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,107);
- base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,65);
- 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 = "tb";
- vFixedSeeds = std::vector<SeedSpec6>(std::begin(pnSeed6_test), std::end(pnSeed6_test));
- fDefaultConsistencyChecks = false;
- fRequireStandard = false;
- m_is_test_chain = true;
- m_is_mockable_chain = false;
- checkpointData = {
- {
- }
- };
- m_assumeutxo_data = MapAssumeutxo{
- // TODO to be specified in a future patch.
- };
- chainTxData = ChainTxData{
- // Data from RPC: getchaintxstats 4096 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75
- /* nTime */ 0,//1531929919,
- /* nTxCount */ 0,//19438708,
- /* dTxRate */ 0,//0.626
- };
- }
- };
- /**
- * Signet
- */
- class SigNetParams : public CChainParams {
- public:
- explicit SigNetParams(const ArgsManager& args) {
- std::vector<uint8_t> bin;
- vSeeds.clear();
- if (!args.IsArgSet("-signetchallenge")) {
- bin = ParseHex("512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae");
- vSeeds.emplace_back("178.128.221.177");
- vSeeds.emplace_back("2a01:7c8:d005:390::5");
- vSeeds.emplace_back("v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333");
- consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000000000019fd16269a");
- consensus.defaultAssumeValid = uint256S("0x0000002a1de0f46379358c1fd09906f7ac59adf3712323ed90eb59e4c183c020"); // 9434
- m_assumed_blockchain_size = 1;
- m_assumed_chain_state_size = 0;
- chainTxData = ChainTxData{
- // Data from RPC: getchaintxstats 4096 0000002a1de0f46379358c1fd09906f7ac59adf3712323ed90eb59e4c183c020
- /* nTime */ 1603986000,
- /* nTxCount */ 9582,
- /* dTxRate */ 0.00159272030651341,
- };
- } else {
- const auto signet_challenge = args.GetArgs("-signetchallenge");
- if (signet_challenge.size() != 1) {
- throw std::runtime_error(strprintf("%s: -signetchallenge cannot be multiple values.", __func__));
- }
- bin = ParseHex(signet_challenge[0]);
- consensus.nMinimumChainWork = uint256{};
- consensus.defaultAssumeValid = uint256{};
- m_assumed_blockchain_size = 0;
- m_assumed_chain_state_size = 0;
- chainTxData = ChainTxData{
- 0,
- 0,
- 0,
- };
- LogPrintf("Signet with challenge %s\n", signet_challenge[0]);
- }
- if (args.IsArgSet("-signetseednode")) {
- vSeeds = args.GetArgs("-signetseednode");
- }
- strNetworkID = CBaseChainParams::SIGNET;
- consensus.signet_blocks = true;
- consensus.signet_challenge.assign(bin.begin(), bin.end());
- consensus.nSubsidyHalvingInterval = 210000;
- consensus.BIP16Exception = uint256{};
- consensus.BIP34Height = 1;
- consensus.BIP34Hash = uint256{};
- consensus.BIP65Height = 1;
- consensus.BIP66Height = 1;
- consensus.CSVHeight = 1;
- consensus.SegwitHeight = 1;
- consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
- consensus.nPowTargetSpacing = 10 * 60;
- consensus.fPowAllowMinDifficultyBlocks = false;
- consensus.fPowNoRetargeting = false;
- consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
- consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
- consensus.MinBIP9WarningHeight = 0;
- consensus.powLimit = uint256S("00000377ae000000000000000000000000000000000000000000000000000000");
- 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
- // Activation of Taproot (BIPs 340-342)
- 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;
- // message start is defined as the first 4 bytes of the sha256d of the block script
- CHashWriter h(SER_DISK, 0);
- h << consensus.signet_challenge;
- uint256 hash = h.GetHash();
- memcpy(pchMessageStart, hash.begin(), 4);
- nDefaultPort = 38333;
- nPruneAfterHeight = 1000;
- genesis = CreateGenesisBlock(1598918400, 52613770, 0x1e0377ae, 1, 50 * COIN);
- consensus.hashGenesisBlock = genesis.GetHash();
- assert(consensus.hashGenesisBlock == uint256S("0x00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6"));
- assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
- vFixedSeeds.clear();
- base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,107);
- base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,65);
- 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 = "ta";
- fDefaultConsistencyChecks = false;
- fRequireStandard = true;
- m_is_test_chain = true;
- m_is_mockable_chain = false;
- }
- };
- /**
- * Regression test
- */
- class CRegTestParams : public CChainParams {
- public:
- explicit CRegTestParams(const ArgsManager& args) {
- strNetworkID = CBaseChainParams::REGTEST;
- consensus.signet_blocks = false;
- consensus.signet_challenge.clear();
- consensus.nSubsidyHalvingInterval = 150;
- consensus.BIP16Exception = uint256();
- 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 = 14 * 24 * 60 * 60; // two weeks
- consensus.nPowTargetSpacing = 10 * 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 = 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;
- consensus.nMinimumChainWork = uint256{};
- consensus.defaultAssumeValid = uint256{};
- pchMessageStart[0] = 0xd4;
- pchMessageStart[1] = 0xbf;
- pchMessageStart[2] = 0xf8;
- pchMessageStart[3] = 0xdf;
- nDefaultPort = 18544;
- nPruneAfterHeight = gArgs.GetBoolArg("-fastprune", false) ? 100 : 1000;
- m_assumed_blockchain_size = 0;
- m_assumed_chain_state_size = 0;
- UpdateActivationParametersFromArgs(args);
- genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
- consensus.hashGenesisBlock = genesis.GetHash();
- assert(consensus.hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
- assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
- 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, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")},
- }
- };
- m_assumeutxo_data = MapAssumeutxo{
- {
- 110,
- {uint256S("0x76fd7334ac7c1baf57ddc0c626f073a655a35d98a4258cd1382c8cc2b8392e10"), 110},
- },
- {
- 210,
- {uint256S("0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2"), 210},
- },
- };
- chainTxData = ChainTxData{
- 0,
- 0,
- 0
- };
- base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,107);
- base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,65);
- 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 = "acrt";
- }
- /**
- * Allows modifying the Version Bits regtest parameters.
- */
- void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
- {
- consensus.vDeployments[d].nStartTime = nStartTime;
- consensus.vDeployments[d].nTimeout = nTimeout;
- }
- 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) {
- throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end");
- }
- int64_t nStartTime, nTimeout;
- 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]));
- }
- 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);
- found = true;
- LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld\n", vDeploymentParams[0], nStartTime, nTimeout);
- 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 SigNetParams(args));
- } 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);
- }
- std::ostream& operator<<(std::ostream& o, const AssumeutxoData& aud)
- {
- o << strprintf("AssumeutxoData(%s, %s)", aud.hash_serialized.ToString(), aud.nChainTx);
- return o;
- }
[text] testcoinhelpforum
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: