18 #include <boost/algorithm/string/classification.hpp> 19 #include <boost/algorithm/string/split.hpp> 27 txNew.
vin[0].scriptSig =
CScript() << 486604799 <<
CScriptNum(4) << std::vector<unsigned char>((
const unsigned char*)pszTimestamp, (
const unsigned char*)pszTimestamp + strlen(pszTimestamp));
28 txNew.
vout[0].nValue = genesisReward;
29 txNew.
vout[0].scriptPubKey = genesisOutputScript;
32 genesis.
nTime = nTime;
33 genesis.
nBits = nBits;
55 const char* pszTimestamp =
"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
56 const CScript genesisOutputScript =
CScript() <<
ParseHex(
"04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") <<
OP_CHECKSIG;
57 return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
123 vSeeds.emplace_back(
"seed.bitcoin.sipa.be");
124 vSeeds.emplace_back(
"dnsseed.bluematt.me");
125 vSeeds.emplace_back(
"dnsseed.bitcoin.dashjr.org");
126 vSeeds.emplace_back(
"seed.bitcoinstats.com");
127 vSeeds.emplace_back(
"seed.bitcoin.jonasschnelli.ch");
128 vSeeds.emplace_back(
"seed.btc.petertodd.org");
129 vSeeds.emplace_back(
"seed.bitcoin.sprovoost.nl");
130 vSeeds.emplace_back(
"dnsseed.emzy.de");
131 vSeeds.emplace_back(
"seed.bitcoin.wiz.biz");
150 { 11111,
uint256S(
"0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")},
151 { 33333,
uint256S(
"0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")},
152 { 74000,
uint256S(
"0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")},
153 {105000,
uint256S(
"0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")},
154 {134444,
uint256S(
"0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")},
155 {168000,
uint256S(
"0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")},
156 {193000,
uint256S(
"0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")},
157 {210000,
uint256S(
"0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")},
158 {216116,
uint256S(
"0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")},
159 {225430,
uint256S(
"0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")},
160 {250000,
uint256S(
"0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")},
161 {279000,
uint256S(
"0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")},
162 {295000,
uint256S(
"0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")},
231 vSeeds.emplace_back(
"testnet-seed.bitcoin.jonasschnelli.ch");
232 vSeeds.emplace_back(
"seed.tbtc.petertodd.org");
233 vSeeds.emplace_back(
"seed.testnet.bitcoin.sprovoost.nl");
234 vSeeds.emplace_back(
"testnet-seed.bluematt.me");
253 {546,
uint256S(
"000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")},
272 std::vector<uint8_t> bin;
275 if (!args.
IsArgSet(
"-signetchallenge")) {
276 bin =
ParseHex(
"512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae");
277 vSeeds.emplace_back(
"178.128.221.177");
278 vSeeds.emplace_back(
"2a01:7c8:d005:390::5");
279 vSeeds.emplace_back(
"v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333");
292 const auto signet_challenge = args.
GetArgs(
"-signetchallenge");
293 if (signet_challenge.size() != 1) {
294 throw std::runtime_error(
strprintf(
"%s: -signetchallenge cannot be multiple values.", __func__));
296 bin =
ParseHex(signet_challenge[0]);
307 LogPrintf(
"Signet with challenge %s\n", signet_challenge[0]);
310 if (args.
IsArgSet(
"-signetseednode")) {
440 {0,
uint256S(
"0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")},
473 if (args.
IsArgSet(
"-segwitheight")) {
475 if (height < -1 || height >= std::numeric_limits<int>::max()) {
476 throw std::runtime_error(
strprintf(
"Activation height %ld for segwit is out of valid range. Use -1 to disable segwit.", height));
477 }
else if (height == -1) {
478 LogPrintf(
"Segwit disabled for testing\n");
479 height = std::numeric_limits<int>::max();
484 if (!args.
IsArgSet(
"-vbparams"))
return;
486 for (
const std::string& strDeployment : args.
GetArgs(
"-vbparams")) {
487 std::vector<std::string> vDeploymentParams;
488 boost::split(vDeploymentParams, strDeployment, boost::is_any_of(
":"));
489 if (vDeploymentParams.size() < 3 || 4 < vDeploymentParams.size()) {
490 throw std::runtime_error(
"Version bits parameters malformed, expecting deployment:start:end[:min_activation_height]");
492 int64_t nStartTime, nTimeout;
493 int min_activation_height = 0;
494 if (!
ParseInt64(vDeploymentParams[1], &nStartTime)) {
495 throw std::runtime_error(
strprintf(
"Invalid nStartTime (%s)", vDeploymentParams[1]));
497 if (!
ParseInt64(vDeploymentParams[2], &nTimeout)) {
498 throw std::runtime_error(
strprintf(
"Invalid nTimeout (%s)", vDeploymentParams[2]));
500 if (vDeploymentParams.size() >= 4 && !
ParseInt32(vDeploymentParams[3], &min_activation_height)) {
501 throw std::runtime_error(
strprintf(
"Invalid min_activation_height (%s)", vDeploymentParams[3]));
508 LogPrintf(
"Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d\n", vDeploymentParams[0], nStartTime, nTimeout, min_activation_height);
513 throw std::runtime_error(
strprintf(
"Invalid deployment (%s)", vDeploymentParams[0]));
528 return std::unique_ptr<CChainParams>(
new CMainParams());
532 return std::unique_ptr<CChainParams>(
new SigNetParams(args));
536 throw std::runtime_error(
strprintf(
"%s: Unknown chain %s.", __func__, chain));
static constexpr int64_t NO_TIMEOUT
Constant for nTimeout very far in the future.
int min_activation_height
If lock in occurs, delay activation until at least this block height.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
int64_t nPowTargetTimespan
static const std::string REGTEST
void UpdateActivationParametersFromArgs(const ArgsManager &args)
std::vector< unsigned char > base58Prefixes[MAX_BASE58_TYPES]
static const CAmount COIN
#define ARRAYLEN(array)
Utilities for converting data from/to strings.
std::vector< unsigned char > ParseHex(const char *psz)
static CTransactionRef MakeTransactionRef()
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int min_activation_height)
Allows modifying the Version Bits regtest parameters.
bool fPowAllowMinDifficultyBlocks
static constexpr int64_t ALWAYS_ACTIVE
Special value for nStartTime indicating that the deployment is always active.
int BIP66Height
Block height at which BIP66 becomes active.
uint64_t m_assumed_chain_state_size
static void LogPrintf(const char *fmt, const Args &... args)
static SeedSpec6 pnSeed6_test[]
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
int CSVHeight
Block height at which CSV (BIP68, BIP112 and BIP113) becomes active.
CMessageHeader::MessageStartChars pchMessageStart
bool ParseInt64(const std::string &str, int64_t *out)
Convert string to signed 64-bit integer with strict parse error feedback.
static const std::string MAIN
Chain name strings.
uint64_t m_assumed_blockchain_size
int nSubsidyHalvingInterval
int64_t CAmount
Amount in satoshis (Can be negative)
uint256 powLimit
Proof of work parameters.
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given chain name.
int BIP34Height
Block height and hash at which BIP34 becomes active.
CRegTestParams(const ArgsManager &args)
SigNetParams(const ArgsManager &args)
uint256 uint256S(const char *str)
int64_t nStartTime
Start MedianTime for version bits miner confirmation.
int64_t nPowTargetSpacing
Holds various statistics on transactions within a chain.
bool ParseInt32(const std::string &str, int32_t *out)
Convert string to signed 32-bit integer with strict parse error feedback.
std::vector< std::string > vSeeds
bool signet_blocks
If true, witness commitments contain a payload equal to a Bitcoin Script solution to the signet chall...
static std::unique_ptr< const CChainParams > globalChainParams
static constexpr int64_t NEVER_ACTIVE
Special value for nStartTime indicating that the deployment is never active.
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
uint32_t nMinerConfirmationWindow
std::vector< CTxOut > vout
int BIP65Height
Block height at which BIP65 becomes active.
uint256 GetHash()
Compute the double-SHA256 hash of all data written to this object.
int64_t nTimeout
Timeout/expiry MedianTime for the deployment attempt.
uint256 nMinimumChainWork
The best chain should have at least this much work.
std::vector< CTransactionRef > vtx
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]
std::vector< SeedSpec6 > vFixedSeeds
uint256 defaultAssumeValid
By default assume that the signatures in ancestors of this block are valid.
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
void * memcpy(void *a, const void *b, size_t c)
Consensus::Params consensus
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
std::vector< uint8_t > signet_challenge
int MinBIP9WarningHeight
Don't warn about unknown BIP 9 activations below this height.
static const std::string TESTNET
A mutable version of CTransaction.
A writer stream (for serialization) that computes a 256-bit hash.
uint32_t nRuleChangeActivationThreshold
Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period...
uint64_t nPruneAfterHeight
int SegwitHeight
Block height at which Segwit (BIP141, BIP143 and BIP147) becomes active.
int bit
Bit position to select the particular bit in nVersion.
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
CCheckpointData checkpointData
void SelectBaseParams(const std::string &chain)
Sets the params returned by Params() to those for the given network.
static SeedSpec6 pnSeed6_main[]
List of fixed seed nodes for the bitcoin network AUTOGENERATED by contrib/seeds/generate-seeds.py.
static const std::string SIGNET
bool fDefaultConsistencyChecks
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
static CBlock CreateGenesisBlock(const char *pszTimestamp, const CScript &genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount &genesisReward)
std::unique_ptr< const CChainParams > CreateChainParams(const ArgsManager &args, const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.