22 #include <boost/algorithm/string/classification.hpp> 23 #include <boost/algorithm/string/split.hpp> 25 static CBlock CreateGenesisBlock(
const char* pszTimestamp,
const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion,
const CAmount& genesisReward)
31 txNew.
vin[0].scriptSig =
CScript() <<
CScriptNum(0) << 486604799 <<
CScriptNum(60) << std::vector<unsigned char>((
const unsigned char*)pszTimestamp, (
const unsigned char*)pszTimestamp + strlen(pszTimestamp));
32 txNew.
vout[0].nValue = genesisReward;
33 txNew.
vout[0].scriptPubKey = genesisOutputScript;
36 genesis.
nTime = nTime;
37 genesis.
nBits = nBits;
40 genesis.
vtx.push_back(MakeTransactionRef(std::move(txNew)));
57 static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion,
const CAmount& genesisReward)
59 const char* pszTimestamp =
"BBC News 20/Oct/2018 US Mega Millions lottery jackpot hits record $1.6bn";
60 const CScript genesisOutputScript =
CScript() <<
ParseHex(
"04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") <<
OP_CHECKSIG;
61 return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
106 genesis = CreateGenesisBlock(1540053565, 10226705, 0x1d00ffff, 4, 50 * COIN);
117 vSeeds.emplace_back(
"seeder.btcsha3.com");
136 { 1,
uint256S(
"0x00000000230768841f81a8b14b3899ce6b38c0e0e9d8f3a60245cf79c8bc756a")},
137 { 175,
uint256S(
"0x000000004571ee39c82eb143f15577808de9fbfd7f103e6f77d27c6855538aca")},
138 { 176,
uint256S(
"0x000000001adcdf818192b26b9ae9a3506e864f6669ed28fa7e509e2258a0b68c")},
139 { 250,
uint256S(
"0x000000003790c7a9797e9c7d4c6791b9b5051c250e6d5e0b7745f483eb65c4a3")},
140 { 1000,
uint256S(
"0x0000000052707bd216d8c74f4ad773529d063b2f6bcae6f0f9a6dc120647a330")},
141 { 4000,
uint256S(
"0x000000009697e163b20b9d5675d538f2f046972919f804e5c8130479ef6b19a3")}
197 genesis = CreateGenesisBlock(1542337888, 52660, 0x1f00ffff, 4, 50 * COIN);
281 genesis = CreateGenesisBlock(1296688602, 3, 0x207fffff, 1, 50 * COIN);
331 if (!args.
IsArgSet(
"-vbparams"))
return;
333 for (
const std::string& strDeployment : args.
GetArgs(
"-vbparams")) {
334 std::vector<std::string> vDeploymentParams;
335 boost::split(vDeploymentParams, strDeployment, boost::is_any_of(
":"));
336 if (vDeploymentParams.size() != 3) {
337 throw std::runtime_error(
"Version bits parameters malformed, expecting deployment:start:end");
339 int64_t nStartTime, nTimeout;
340 if (!
ParseInt64(vDeploymentParams[1], &nStartTime)) {
341 throw std::runtime_error(
strprintf(
"Invalid nStartTime (%s)", vDeploymentParams[1]));
343 if (!
ParseInt64(vDeploymentParams[2], &nTimeout)) {
344 throw std::runtime_error(
strprintf(
"Invalid nTimeout (%s)", vDeploymentParams[2]));
351 LogPrintf(
"Setting version bits activation parameters for %s to start=%ld, timeout=%ld\n", vDeploymentParams[0], nStartTime, nTimeout);
356 throw std::runtime_error(
strprintf(
"Invalid deployment (%s)", vDeploymentParams[0]));
361 static std::unique_ptr<const CChainParams> globalChainParams;
364 assert(globalChainParams);
365 return *globalChainParams;
371 return std::unique_ptr<CChainParams>(
new CMainParams());
376 throw std::runtime_error(
strprintf(
"%s: Unknown chain %s.", __func__, chain));
std::unique_ptr< const CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
void UpdateVersionBitsParametersFromArgs(const ArgsManager &args)
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
std::vector< unsigned char > base58Prefixes[MAX_BASE58_TYPES]
bool fPowAllowMinDifficultyBlocks
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
CMessageHeader::MessageStartChars pchMessageStart
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
int nSubsidyHalvingInterval
bool nBIP34Enabled
Block height and hash at which BIP34 becomes active.
int64_t CAmount
Amount in satoshis (Can be negative)
bool ParseInt64(const std::string &str, int64_t *out)
Convert string to signed 64-bit integer with strict parse error feedback.
uint256 powLimit
Proof of work parameters.
bool m_fallback_fee_enabled
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given BIP70 chain name.
CRegTestParams(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.
std::vector< std::string > vSeeds
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
Allows modifying the Version Bits regtest parameters.
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
uint32_t nMinerConfirmationWindow
std::vector< CTxOut > vout
int64_t nTimeout
Timeout/expiry MedianTime for the deployment attempt.
uint256 nMinimumChainWork
std::vector< CTransactionRef > vtx
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]
std::vector< SeedSpec6 > vFixedSeeds
uint256 defaultAssumeValid
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
Consensus::Params consensus
bool fMiningRequiresPeers
static const std::string TESTNET
A mutable version of CTransaction.
uint32_t nRuleChangeActivationThreshold
Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period...
uint64_t nPruneAfterHeight
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.
bool fDefaultConsistencyChecks
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
std::vector< unsigned char > ParseHex(const char *psz)