Permalink
Cannot retrieve contributors at this time
// Copyright (c) 2010 Satoshi Nakamoto | |
// Copyright (c) 2009-2017 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 <consensus/merkle.h> | |
#include <tinyformat.h> | |
#include <util.h> | |
#include <utilstrencodings.h> | |
#include <assert.h> | |
#include <memory> | |
#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; | |
} | |
/** | |
* 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 = "La tercera, 11/09/2017: EE.UU. y Corea del Norte alarman al mundo"; | |
const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG; | |
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); | |
} | |
void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout) | |
{ | |
consensus.vDeployments[d].nStartTime = nStartTime; | |
consensus.vDeployments[d].nTimeout = nTimeout; | |
} | |
/** | |
* 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 = 2628000; | |
consensus.BIP16Height = 0; | |
consensus.BIP34Height = 0; | |
consensus.BIP34Hash = uint256S("6e27bffd2a104bea1c870be76aab1cce13bebb0db40606773827517da9528174"); | |
consensus.BIP65Height = 0; | |
consensus.BIP66Height = 0; | |
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); | |
consensus.nPowTargetTimespan = 30 * 60; // 3.5 days | |
consensus.nPowTargetSpacing = 1 * 60; | |
consensus.fPowAllowMinDifficultyBlocks = false; | |
consensus.fPowNoRetargeting = false; | |
consensus.nRuleChangeActivationThreshold = 6048; // 75% of 8064 | |
consensus.nMinerConfirmationWindow = 8064; // nPowTargetTimespan / nPowTargetSpacing * 4 | |
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 = 2; | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0; // January 28, 2017 | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 0; // January 31st, 2018 | |
/** DarkGravityWell v3 Fork Params - Humwerthuz @ 30/12/2017 **/ | |
consensus.nPowDGWHeight = 147000; //DGW on starting from block 147.000 | |
// Propuestas de Mejora para Chaucha (PMC) | |
consensus.PMC1 = 220000; | |
consensus.PMC2 = 1000000; // 1 millon mientras se decide | |
// The best chain should have at least this much work. | |
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000003f646daaf5be6b64"); | |
// By default assume that the signatures in ancestors of this block are valid. | |
consensus.defaultAssumeValid = uint256S("0x86b223e8e49f05d16ce5ef9b12b2b4f5a09926f6ad2dbf97f8965830d1b45312"); //600,000 | |
/** | |
* 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] = 0xaa; | |
pchMessageStart[1] = 0xa2; | |
pchMessageStart[2] = 0x26; | |
pchMessageStart[3] = 0xa9; | |
nDefaultPort = 21663; | |
nPruneAfterHeight = 100000; | |
genesis = CreateGenesisBlock(1502438055, 638445, 0x1e0ffff0, 1, 50 * COIN); | |
consensus.hashGenesisBlock = genesis.GetHash(); | |
assert(consensus.hashGenesisBlock == uint256S("0x6e27bffd2a104bea1c870be76aab1cce13bebb0db40606773827517da9528174")); | |
assert(genesis.hashMerkleRoot == uint256S("0x1b54ad13e84ece043533beb59d6b666047ffc77a4496034a101791601d711998")); | |
// Note that of those with the service bits flag, most only support a subset of possible options | |
vSeeds.emplace_back("condor420.chaucha.cl"); // Por la razon | |
vSeeds.emplace_back("huemul69.chaucha.cl");// O la fuerza | |
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,88); | |
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5); | |
base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,50); | |
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,216); | |
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E}; | |
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4}; | |
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); | |
fDefaultConsistencyChecks = false; | |
fRequireStandard = true; | |
fMineBlocksOnDemand = false; | |
checkpointData = { | |
{ | |
{ 0, uint256S("0x6e27bffd2a104bea1c870be76aab1cce13bebb0db40606773827517da9528174")}, //GENESIS | |
{ 1, uint256S("0xeadcbcb3f8960778b1c39415d1447a5cb45981ac15b269e31924f5f4701ea0e8")}, //PREMINE | |
{ 2833, uint256S("0xe281b0a49fd63613fd9ceffc758cd2044f72278cc9606fc7c7f86422d977e44f")}, //POOL | |
{ 50000, uint256S("0x1f676ba037561706283a5cdac53d20c4d81576faffb4940ea3f0ddaa3a91f04b")}, //BLOCK 50.000 | |
{ 80000, uint256S("0x36813083a53ef7dc73037a92b245fbdced69f091bb8549da520331f159fdbf6b")}, //BLOCK 80.000 | |
{ 144875, uint256S("0xbb0eb7a10ba79bfa10a15e59c3cca0963087a349a2063266b2dc91997ef9d192")}, //BLOCK 144.875 PRE-RELEASE CHAUCHERA 2.0 | |
{ 220000, uint256S("0x00a2c535a27da237b60a50db41a9309b9c7afd06bfcb948aed2d06c2e3241aec")}, // PMC 1 | |
{ 300000, uint256S("0xeeea1dcbe84fc64a0ec1cddf8fa3e403e10fdc77c202233342091f2af7c44646")}, // BLOCK 300.000 | |
{ 327000, uint256S("0xb4eb1c952656e75eaa93e1033f4e675f083196cc90a14ca63e865164debb8dd4")}, // OP_HODL TESTING | |
{ 400000, uint256S("0xa754fc389835d8e375cb9fb22a8d3b852c376e2d4ec7b978e08761faf9814d18")}, // BLOCK 400.000 | |
{ 500000, uint256S("0xcd01a0a68e367cf7dd33598c58ba81b7e0ef4c938e313a3fbfff2db3df4e3e71")}, // BLOCK 500.000 | |
{ 600000, uint256S("0x86b223e8e49f05d16ce5ef9b12b2b4f5a09926f6ad2dbf97f8965830d1b45312")}, // BLOCK 600.000 | |
{ 793000, uint256S("0x88f8e2a81dff68682df62d50388bf5b700255669ad81ef9b05a6ba7bcf6bd121")}, // BLOCK 793.000 PRE-RELEASE CHAUCHERA 3.0 | |
} | |
}; | |
chainTxData = ChainTxData{ | |
1558030232, // * UNIX timestamp of last checkpoint block | |
881324, // * total number of transactions between genesis and last checkpoint | |
// (the tx=... number in the SetBestChain debug.log lines) | |
1440.0 // * estimated number of transactions per day after checkpoint | |
}; | |
} | |
}; | |
/** | |
* Testnet (v4) | |
*/ | |
class CTestNetParams : public CChainParams { | |
public: | |
CTestNetParams() { | |
strNetworkID = "test"; | |
consensus.nSubsidyHalvingInterval = 250; | |
consensus.BIP16Height = 0; // always enforce P2SH BIP16 on regtest | |
consensus.BIP34Height = 0; | |
consensus.BIP34Hash = uint256S("f0a673496ca33e8d84df16f2ad99eba0732ee41971658be4d927f30c8f27aa65"); | |
consensus.BIP65Height = 0; | |
consensus.BIP66Height = 0; | |
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); | |
consensus.nPowTargetTimespan = 30 * 60; // 3.5 days | |
consensus.nPowTargetSpacing = 1 * 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 BIP68, BIP112, and BIP113. | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 2; | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0; // January 1, 2017 | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 0; // January 31st, 2018 | |
// The best chain should have at least this much work. | |
consensus.nMinimumChainWork = uint256S(""); | |
// By default assume that the signatures in ancestors of this block are valid. | |
consensus.defaultAssumeValid = uint256S("0x1efb29c8187d5a496a33377941d1df415169c3ce5d8c05d055f25b683ec3f9a3"); //612653 | |
/** DarkGravityWell v3 Fork Params - Humwerthuz @ 30/12/2017 **/ | |
consensus.nPowDGWHeight = 200; //DGW always on | |
// Propuestas de Mejora para Chaucha (PMC) | |
consensus.PMC1 = 235; | |
consensus.PMC2 = 500; | |
pchMessageStart[0] = 0xfc; | |
pchMessageStart[1] = 0xd1; | |
pchMessageStart[2] = 0xb7; | |
pchMessageStart[3] = 0xdc; | |
nDefaultPort = 19335; | |
nPruneAfterHeight = 100000; | |
genesis = CreateGenesisBlock(1514919398, 304091, 0x1e0ffff0, 1, 50 * COIN); | |
consensus.hashGenesisBlock = genesis.GetHash(); | |
assert(consensus.hashGenesisBlock == uint256S("0xf0a673496ca33e8d84df16f2ad99eba0732ee41971658be4d927f30c8f27aa65")); | |
assert(genesis.hashMerkleRoot == uint256S("0x1b54ad13e84ece043533beb59d6b666047ffc77a4496034a101791601d711998")); | |
vFixedSeeds.clear(); | |
vSeeds.clear(); | |
// nodes with support for servicebits filtering should be at the top | |
vSeeds.emplace_back("fn1.cha.harc.cl"); | |
vSeeds.emplace_back("fn2.cha.harc.cl"); | |
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,65); | |
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}; | |
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); | |
fDefaultConsistencyChecks = false; | |
fRequireStandard = false; | |
fMineBlocksOnDemand = false; | |
checkpointData = (CCheckpointData) { | |
{ | |
{0, consensus.hashGenesisBlock}, | |
} | |
}; | |
chainTxData = ChainTxData{ | |
// Data as of block a0afbded94d4be233e191525dc2d467af5c7eab3143c852c3cd549831022aad6 (height 343833) | |
0, | |
0, | |
0 | |
}; | |
} | |
}; | |
/** | |
* Regression test | |
*/ | |
class CRegTestParams : public CChainParams { | |
public: | |
CRegTestParams() { | |
strNetworkID = "regtest"; | |
consensus.nSubsidyHalvingInterval = 200; | |
consensus.BIP16Height = 0; // always enforce P2SH BIP16 on regtest | |
consensus.BIP34Height = 0; // BIP34 has not activated on regtest (far in the future so block v1 are not rejected in tests) | |
consensus.BIP34Hash = uint256(); | |
consensus.BIP65Height = 0; // BIP65 activated on regtest (Used in rpc activation tests) | |
consensus.BIP66Height = 0; // BIP66 activated on regtest (Used in rpc activation tests) | |
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); | |
consensus.nPowTargetTimespan = 30 * 60; // two weeks | |
consensus.nPowTargetSpacing = 1 * 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 = 0; | |
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0; | |
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 0; | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0; | |
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 0; | |
// 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"); | |
/** DarkGravityWell v3 Fork Params - Humwerthuz @ 30/12/2017 **/ | |
consensus.nPowDGWHeight = 0; //DGW always on | |
// Propuestas de Mejora para Chaucha (PMC) | |
consensus.PMC1 = 1; // 1.5 CHA | |
consensus.PMC2 = 20; | |
pchMessageStart[0] = 0xfa; | |
pchMessageStart[1] = 0xbf; | |
pchMessageStart[2] = 0xb5; | |
pchMessageStart[3] = 0xda; | |
nDefaultPort = 19444; | |
nPruneAfterHeight = 1000; | |
genesis = CreateGenesisBlock(1530840480, 3462792, 0x1e0ffff0, 1, 50 * COIN); | |
consensus.hashGenesisBlock = genesis.GetHash(); | |
assert(consensus.hashGenesisBlock == uint256S("0x75d057806094af24532e9489f8ced2f935a658c42e074963ee984e09e51a8a45")); | |
assert(genesis.hashMerkleRoot == uint256S("0x1b54ad13e84ece043533beb59d6b666047ffc77a4496034a101791601d711998")); | |
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds. | |
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds. | |
fDefaultConsistencyChecks = true; | |
fRequireStandard = false; | |
fMineBlocksOnDemand = true; | |
checkpointData = { | |
{ | |
{0, consensus.hashGenesisBlock}, | |
} | |
}; | |
chainTxData = ChainTxData{ | |
0, | |
0, | |
0 | |
}; | |
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,28); | |
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,35); | |
base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,40); | |
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}; | |
} | |
}; | |
static std::unique_ptr<CChainParams> globalChainParams; | |
const CChainParams &Params() { | |
assert(globalChainParams); | |
return *globalChainParams; | |
} | |
std::unique_ptr<CChainParams> CreateChainParams(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::REGTEST) | |
return std::unique_ptr<CChainParams>(new CRegTestParams()); | |
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain)); | |
} | |
void SelectParams(const std::string& network) | |
{ | |
SelectBaseParams(network); | |
globalChainParams = CreateChainParams(network); | |
} | |
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout) | |
{ | |
globalChainParams->UpdateVersionBitsParameters(d, nStartTime, nTimeout); | |
} |