Line data Source code
1 : // Copyright (c) 2010 Satoshi Nakamoto
2 : // Copyright (c) 2009-2015 The Bitcoin developers
3 : // Copyright (c) 2014-2015 The Dash developers
4 : // Copyright (c) 2015-2022 The PIVX Core developers
5 : // Distributed under the MIT software license, see the accompanying
6 : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 :
8 : #include "chainparams.h"
9 :
10 : #include "chainparamsseeds.h"
11 : #include "consensus/merkle.h"
12 : #include "tinyformat.h"
13 : #include "utilstrencodings.h"
14 :
15 : #include <assert.h>
16 :
17 1017 : static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
18 : {
19 1017 : CMutableTransaction txNew;
20 1017 : txNew.nVersion = 1;
21 1017 : txNew.vin.resize(1);
22 1017 : txNew.vout.resize(1);
23 2034 : txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
24 1017 : txNew.vout[0].nValue = genesisReward;
25 1017 : txNew.vout[0].scriptPubKey = genesisOutputScript;
26 :
27 1017 : CBlock genesis;
28 2034 : genesis.vtx.push_back(std::make_shared<const CTransaction>(std::move(txNew)));
29 1017 : genesis.hashPrevBlock.SetNull();
30 1017 : genesis.nVersion = nVersion;
31 1017 : genesis.nTime = nTime;
32 1017 : genesis.nBits = nBits;
33 1017 : genesis.nNonce = nNonce;
34 1017 : genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
35 1017 : return genesis;
36 : }
37 :
38 434 : void CChainParams::UpdateNetworkUpgradeParameters(Consensus::UpgradeIndex idx, int nActivationHeight)
39 : {
40 434 : assert(IsRegTestNet()); // only available for regtest
41 434 : assert(idx > Consensus::BASE_NETWORK && idx < Consensus::MAX_NETWORK_UPGRADES);
42 434 : consensus.vUpgrades[idx].nActivationHeight = nActivationHeight;
43 434 : }
44 :
45 : /**
46 : * Build the genesis block. Note that the output of the genesis coinbase cannot
47 : * be spent as it did not originally exist in the database.
48 : *
49 : * CBlock(hash=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1390095618, nBits=1e0ffff0, nNonce=28917698, vtx=1)
50 : * CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
51 : * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73)
52 : * CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF)
53 : * vMerkleTree: e0028e
54 : */
55 1017 : static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
56 : {
57 1017 : const char* pszTimestamp = "U.S. News & World Report Jan 28 2016 With His Absence, Trump Dominates Another Debate";
58 2034 : const CScript genesisOutputScript = CScript() << ParseHex("04c10e83b2703ccf322f7dbd62dd5855ac7c10bd055814ce121ba32607d573b8810c02c0582aed05b4deb9c4b77b26d92428c61256cd42774babea0a073b2ed0c9") << OP_CHECKSIG;
59 2034 : return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
60 : }
61 :
62 : // this one is for testing only
63 : static Consensus::LLMQParams llmq_test = {
64 : .type = Consensus::LLMQ_TEST,
65 : .name = "llmq_test",
66 : .size = 3,
67 : .minSize = 2,
68 : .threshold = 2,
69 :
70 : .dkgInterval = 20, // one every 20 minutes
71 : .dkgPhaseBlocks = 2,
72 : .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization
73 : .dkgMiningWindowEnd = 15,
74 : .dkgBadVotesThreshold = 2,
75 :
76 : .signingActiveQuorumCount = 2, // just a few ones to allow easier testing
77 :
78 : .keepOldConnections = 3,
79 : .recoveryMembers = 3,
80 :
81 : .cacheDkgInterval = 60,
82 : };
83 :
84 : static Consensus::LLMQParams llmq50_60 = {
85 : .type = Consensus::LLMQ_50_60,
86 : .name = "llmq_50_60",
87 : .size = 50,
88 : .minSize = 40,
89 : .threshold = 30,
90 :
91 : .dkgInterval = 60, // one DKG per hour
92 : .dkgPhaseBlocks = 6,
93 : .dkgMiningWindowStart = 30, // dkgPhaseBlocks * 5 = after finalization
94 : .dkgMiningWindowEnd = 40,
95 : .dkgBadVotesThreshold = 40,
96 :
97 : .signingActiveQuorumCount = 24, // a full day worth of LLMQs
98 :
99 : .keepOldConnections = 25,
100 : .recoveryMembers = 25,
101 :
102 : .cacheDkgInterval = 600,
103 : };
104 :
105 : static Consensus::LLMQParams llmq400_60 = {
106 : .type = Consensus::LLMQ_400_60,
107 : .name = "llmq_400_60",
108 : .size = 400,
109 : .minSize = 300,
110 : .threshold = 240,
111 :
112 : .dkgInterval = 60 * 12, // one DKG every 12 hours
113 : .dkgPhaseBlocks = 10,
114 : .dkgMiningWindowStart = 50, // dkgPhaseBlocks * 5 = after finalization
115 : .dkgMiningWindowEnd = 70,
116 : .dkgBadVotesThreshold = 300,
117 :
118 : .signingActiveQuorumCount = 4, // two days worth of LLMQs
119 :
120 : .keepOldConnections = 5,
121 : .recoveryMembers = 100,
122 :
123 : .cacheDkgInterval = 60 * 12 * 10, // dkgInterval * 10
124 : };
125 :
126 : // Used for deployment and min-proto-version signaling, so it needs a higher threshold
127 : static Consensus::LLMQParams llmq400_85 = {
128 : .type = Consensus::LLMQ_400_85,
129 : .name = "llmq_400_85",
130 : .size = 400,
131 : .minSize = 350,
132 : .threshold = 340,
133 :
134 : .dkgInterval = 60 * 24, // one DKG every 24 hours
135 : .dkgPhaseBlocks = 10,
136 : .dkgMiningWindowStart = 50, // dkgPhaseBlocks * 5 = after finalization
137 : .dkgMiningWindowEnd = 70, // give it a larger mining window to make sure it is mined
138 : .dkgBadVotesThreshold = 300,
139 :
140 : .signingActiveQuorumCount = 4, // four days worth of LLMQs
141 :
142 : .keepOldConnections = 5,
143 : .recoveryMembers = 100,
144 :
145 : .cacheDkgInterval = 60 * 24 * 10, // dkgInterval * 10
146 : };
147 :
148 : /**
149 : * Main network
150 : */
151 : /**
152 : * What makes a good checkpoint block?
153 : * + Is surrounded by blocks with reasonable timestamps
154 : * (no blocks before with a timestamp after, none after with
155 : * timestamp before)
156 : * + Contains no strange transactions
157 : */
158 : static MapCheckpoints mapCheckpoints = {
159 : { 259201, uint256S("1c9121bf9329a6234bfd1ea2d91515f19cd96990725265253f4b164283ade5dd")},
160 : { 424998, uint256S("f31e381eedb0ed3ed65fcc98cc71f36012bee32e8efd017c4f9fb0620fd35f6b")},
161 : { 616764, uint256S("29dd0bd1c59484f290896687b4ffb6a49afa5c498caf61967c69a541f8191557")}, //!< First block to use new modifierV1
162 : { 623933, uint256S("c7aafa648a0f1450157dc93bd4d7448913a85b7448f803b4ab970d91fc2a7da7")},
163 : { 791150, uint256S("8e76f462e4e82d1bd21cb72e1ce1567d4ddda2390f26074ffd1f5d9c270e5e50")},
164 : { 795000, uint256S("4423cceeb9fd574137a18733416275a70fdf95283cc79ad976ca399aa424a443")},
165 : { 863787, uint256S("5b2482eca24caf2a46bb22e0545db7b7037282733faa3a42ec20542509999a64")},
166 : { 863795, uint256S("2ad866818c4866e0d555181daccc628056216c0db431f88a825e84ed4f469067")},
167 : { 863805, uint256S("a755bd9a22b63c70d3db474f4b2b61a1f86c835b290a081bb3ec1ba2103eb4cb")},
168 : { 867733, uint256S("03b26296bf693de5782c76843d2fb649cb66d4b05550c6a79c047ff7e1c3ae15")},
169 : { 879650, uint256S("227e1d2b738b6cd83c46d1d64617934ec899d77cee34336a56e61b71acd10bb2")},
170 : { 895400, uint256S("7796a0274a608fac12d400198174e50beda992c1d522e52e5b95b884bc1beac6")}, //!< Block that serial# range is enforced
171 : { 895991, uint256S("d53013ed7ea5c325b9696c95e07667d6858f8ff7ee13fecfa90827bf3c9ae316")}, //!< Network split here
172 : { 908000, uint256S("202708f8c289b676fceb832a079ff6b308a28608339acbf7584de533619d014d")},
173 : {1142400, uint256S("98aff9d605bf123247f98b1e3a02567eb5799d208d78ec30fb89737b1c1f79c5")},
174 : {1679090, uint256S("f747ce055ba1b12e1f2e842bd480bc647210799359cb2e553ab292065e3419d6")}, //!< First block with a "wrapped" serial spend
175 : {1686229, uint256S("bb42bf1e886a7c23474634c90893dd3d68a6ccbfea4ac92a98da5cad0c6a6cb7")}, //!< Last block in the "wrapped" serial attack range
176 : {1778954, uint256S("0d3241268264a2908d6babf00d9cd1ffb83d93d7bb4e428820127fe227c2029c")}, //!< Network split here
177 : {1788528, uint256S("ea9243ff8fc079fdd7a04f11fac415de4d98e1bb0dc38db6f79f8f8bbfdbe496")}, //!< Network split here
178 : {2153200, uint256S("14e477e597d24549cac5e59d97d32155e6ec2861c1003b42d0566f9bf39b65d5")}, //!< First v7 block
179 : {2356049, uint256S("62e80d8e193bca84655fb78893b20f54a79f2d71124c4ea37b7ef51a0d5451c4")}, //!< Network split here
180 : {2365700, uint256S("b5d0beead57735539abc2db2b0b08cd65db3e5928efd3c3bf3182d5bf013f36c")}, //!< PIVX v4.1.1 enforced
181 : {2678402, uint256S("580a26ff0a45177a7a6f387f009c5b26140ea48b4790a857d9a796f8b3c25899")}, //!< Network split here
182 : {3014000, uint256S("78ad99b7225f73c42238bd7ca841ff700542b92bba75a0ef2ed351caa560f87f")}, //!< PIVX v5.3.0 enforced
183 : {3024000, uint256S("be4bc75afcfb9136924810f7483b2695089a366cc4ee27fd6dc3ecd5396e1f0f")}, //!< Superblock
184 : {3715200, uint256S("a676b9a598c393c82b949c37dd35013aeda55f5d18ab062349db6a8235972aaa")}, //!< Superblock for 5.5.0 mainnet rewards changeover
185 : };
186 :
187 : static const CCheckpointData data = {
188 : &mapCheckpoints,
189 : 1591401645, // * UNIX timestamp of last checkpoint block
190 : 5607713, // * total number of transactions between genesis and last checkpoint
191 : // (the tx=... number in the UpdateTip debug.log lines)
192 : 3000 // * estimated number of transactions per day after checkpoint
193 : };
194 :
195 : static MapCheckpoints mapCheckpointsTestnet = {
196 : {0, uint256S("0x001")},
197 : //{ 201, uint256S("6ae7d52092fd918c8ac8d9b1334400387d3057997e6e927a88e57186dc395231")}, // v5 activation (PoS/Sapling)
198 : };
199 :
200 : static const CCheckpointData dataTestnet = {
201 : &mapCheckpointsTestnet,
202 : 1454124731,
203 : 0,
204 : 3000};
205 :
206 : static MapCheckpoints mapCheckpointsRegtest = {{0, uint256S("0x001")}};
207 : static const CCheckpointData dataRegtest = {
208 : &mapCheckpointsRegtest,
209 : 1454124731,
210 : 0,
211 : 100};
212 :
213 : class CMainParams : public CChainParams
214 : {
215 : public:
216 532 : CMainParams()
217 532 : {
218 532 : strNetworkID = "main";
219 :
220 532 : genesis = CreateGenesisBlock(1454124731, 2402015, 0x1e0ffff0, 1, 250 * COIN);
221 532 : consensus.hashGenesisBlock = genesis.GetHash();
222 1064 : assert(consensus.hashGenesisBlock == uint256S("0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818"));
223 1064 : assert(genesis.hashMerkleRoot == uint256S("0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b"));
224 :
225 532 : consensus.fPowAllowMinDifficultyBlocks = false;
226 532 : consensus.fPowNoRetargeting = false;
227 532 : consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
228 532 : consensus.posLimitV1 = uint256S("0x000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
229 532 : consensus.posLimitV2 = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
230 532 : consensus.nBudgetCycleBlocks = 43200; // approx. 1 every 30 days
231 532 : consensus.nBudgetFeeConfirmations = 6; // Number of confirmations for the finalization fee
232 532 : consensus.nCoinbaseMaturity = 100;
233 532 : consensus.nFutureTimeDriftPoW = 7200;
234 532 : consensus.nFutureTimeDriftPoS = 180;
235 532 : consensus.nMaxMoneyOut = 21000000 * COIN;
236 532 : consensus.nMNCollateralAmt = 10000 * COIN;
237 532 : consensus.nMNBlockReward = 3 * COIN;
238 532 : consensus.nNewMNBlockReward = 6 * COIN;
239 532 : consensus.nMNCollateralMinConf = 15;
240 532 : consensus.nProposalEstablishmentTime = 60 * 60 * 24; // must be at least a day old to make it into a budget
241 532 : consensus.nStakeMinAge = 60 * 60;
242 532 : consensus.nStakeMinDepth = 600;
243 532 : consensus.nTargetTimespan = 40 * 60;
244 532 : consensus.nTargetTimespanV2 = 30 * 60;
245 532 : consensus.nTargetSpacing = 1 * 60;
246 532 : consensus.nTimeSlotLength = 15;
247 532 : consensus.nMaxProposalPayments = 6;
248 :
249 : // spork keys
250 532 : consensus.strSporkPubKey = "0410050aa740d280b134b40b40658781fc1116ba7700764e0ce27af3e1737586b3257d19232e0cb5084947f5107e44bcd577f126c9eb4a30ea2807b271d2145298";
251 532 : consensus.strSporkPubKeyOld = "040F129DE6546FE405995329A887329BED4321325B1A73B0A257423C05C1FCFE9E40EF0678AEF59036A22C42E61DFD29DF7EFB09F56CC73CADF64E05741880E3E7";
252 532 : consensus.nTime_EnforceNewSporkKey = 1608512400; //!> December 21, 2020 01:00:00 AM GMT
253 532 : consensus.nTime_RejectOldSporkKey = 1614560400; //!> March 1, 2021 01:00:00 AM GMT
254 :
255 : // height-based activations
256 532 : consensus.height_last_invalid_UTXO = 894538;
257 532 : consensus.height_last_ZC_AccumCheckpoint = 1686240;
258 532 : consensus.height_last_ZC_WrappedSerials = 1686229;
259 :
260 : // validation by-pass
261 532 : consensus.nPivxBadBlockTime = 1471401614; // Skip nBit validation of Block 259201 per PR #915
262 532 : consensus.nPivxBadBlockBits = 0x1c056dac; // Skip nBit validation of Block 259201 per PR #915
263 :
264 : // Zerocoin-related params
265 532 : consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
266 : "4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
267 : "6507761337985909570009733045974880842840179742910064245869181719511874612151517265463228221686998754918242243363"
268 : "7259085141865462043576798423387184774447920739934236584823824281198163815010674810451660377306056201619676256133"
269 : "8441436038339044149526344321901146575444541784240209246165157233507787077498171257724679629263863563732899121548"
270 532 : "31438167899885040445364023527381951378636564391212010397122822120720357";
271 532 : consensus.ZC_MaxPublicSpendsPerTx = 637; // Assume about 220 bytes each input
272 532 : consensus.ZC_MaxSpendsPerTx = 7; // Assume about 20kb each input
273 532 : consensus.ZC_MinMintConfirmations = 20;
274 532 : consensus.ZC_MinMintFee = 1 * CENT;
275 532 : consensus.ZC_MinStakeDepth = 200;
276 532 : consensus.ZC_TimeStart = 1508214600; // October 17, 2017 4:30:00 AM
277 532 : consensus.ZC_HeightStart = 863735;
278 :
279 : // Network upgrades
280 532 : consensus.vUpgrades[Consensus::BASE_NETWORK].nActivationHeight =
281 : Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
282 532 : consensus.vUpgrades[Consensus::UPGRADE_TESTDUMMY].nActivationHeight =
283 : Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
284 532 : consensus.vUpgrades[Consensus::UPGRADE_POS].nActivationHeight = 259201;
285 532 : consensus.vUpgrades[Consensus::UPGRADE_POS_V2].nActivationHeight = 615800;
286 532 : consensus.vUpgrades[Consensus::UPGRADE_ZC].nActivationHeight = 863787;
287 532 : consensus.vUpgrades[Consensus::UPGRADE_ZC_V2].nActivationHeight = 1153160;
288 532 : consensus.vUpgrades[Consensus::UPGRADE_BIP65].nActivationHeight = 1808634;
289 532 : consensus.vUpgrades[Consensus::UPGRADE_ZC_PUBLIC].nActivationHeight = 1880000;
290 532 : consensus.vUpgrades[Consensus::UPGRADE_V3_4].nActivationHeight = 1967000;
291 532 : consensus.vUpgrades[Consensus::UPGRADE_V4_0].nActivationHeight = 2153200;
292 532 : consensus.vUpgrades[Consensus::UPGRADE_V5_0].nActivationHeight = 2700500;
293 532 : consensus.vUpgrades[Consensus::UPGRADE_V5_2].nActivationHeight = 2927000;
294 532 : consensus.vUpgrades[Consensus::UPGRADE_V5_3].nActivationHeight = 3014000;
295 532 : consensus.vUpgrades[Consensus::UPGRADE_V5_5].nActivationHeight = 3715200;
296 532 : consensus.vUpgrades[Consensus::UPGRADE_V5_6].nActivationHeight = 4281680; // Estimate Feb 29th 12:00 UTC
297 532 : consensus.vUpgrades[Consensus::UPGRADE_V6_0].nActivationHeight =
298 : Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
299 :
300 532 : consensus.vUpgrades[Consensus::UPGRADE_ZC].hashActivationBlock =
301 532 : uint256S("0x5b2482eca24caf2a46bb22e0545db7b7037282733faa3a42ec20542509999a64");
302 532 : consensus.vUpgrades[Consensus::UPGRADE_ZC_V2].hashActivationBlock =
303 532 : uint256S("0x37ea75fe1c9314171cff429a91b25b9f11331076d1c9de50ee4054d61877f8af");
304 532 : consensus.vUpgrades[Consensus::UPGRADE_BIP65].hashActivationBlock =
305 532 : uint256S("0x82629b7a9978f5c7ea3f70a12db92633a7d2e436711500db28b97efd48b1e527");
306 532 : consensus.vUpgrades[Consensus::UPGRADE_ZC_PUBLIC].hashActivationBlock =
307 532 : uint256S("0xe2448b76d88d37aba4194ffed1041b680d779919157ddf5cbf423373d7f8078e");
308 532 : consensus.vUpgrades[Consensus::UPGRADE_V3_4].hashActivationBlock =
309 532 : uint256S("0x0ef2556e40f3b9f6e02ce611b832e0bbfe7734a8ea751c7b555310ee49b61456");
310 532 : consensus.vUpgrades[Consensus::UPGRADE_V4_0].hashActivationBlock =
311 532 : uint256S("0x14e477e597d24549cac5e59d97d32155e6ec2861c1003b42d0566f9bf39b65d5");
312 :
313 : /**
314 : * The message start string is designed to be unlikely to occur in normal data.
315 : * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
316 : * a large 4-byte int at any alignment.
317 : */
318 532 : pchMessageStart[0] = 0x90;
319 532 : pchMessageStart[1] = 0xc4;
320 532 : pchMessageStart[2] = 0xfd;
321 532 : pchMessageStart[3] = 0xe9;
322 532 : nDefaultPort = 51472;
323 :
324 : // Note that of those with the service bits flag, most only support a subset of possible options
325 532 : vSeeds.emplace_back("pivx.seed.fuzzbawls.pw", true); // Primary DNS Seeder from Fuzzbawls
326 532 : vSeeds.emplace_back("pivx.seed2.fuzzbawls.pw", true); // Secondary DNS Seeder from Fuzzbawls
327 532 : vSeeds.emplace_back("dnsseed.liquid369.wtf", true); // Primary DNS Seeder from Liquid369
328 :
329 532 : base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 30);
330 532 : base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 13);
331 532 : base58Prefixes[STAKING_ADDRESS] = std::vector<unsigned char>(1, 63); // starting with 'S'
332 532 : base58Prefixes[EXCHANGE_ADDRESS] = {0x01, 0xb9, 0xa2}; // starts with EXM
333 532 : base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 212);
334 532 : base58Prefixes[EXT_PUBLIC_KEY] = {0x02, 0x2D, 0x25, 0x33};
335 532 : base58Prefixes[EXT_SECRET_KEY] = {0x02, 0x21, 0x31, 0x2B};
336 : // BIP44 coin type is from https://github.com/satoshilabs/slips/blob/master/slip-0044.md
337 532 : base58Prefixes[EXT_COIN_TYPE] = {0x80, 0x00, 0x00, 0x77};
338 :
339 532 : vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));
340 :
341 : // Reject non-standard transactions by default
342 532 : fRequireStandard = true;
343 :
344 : // Sapling
345 532 : bech32HRPs[SAPLING_PAYMENT_ADDRESS] = "ps";
346 532 : bech32HRPs[SAPLING_FULL_VIEWING_KEY] = "pviews";
347 532 : bech32HRPs[SAPLING_INCOMING_VIEWING_KEY] = "pivks";
348 532 : bech32HRPs[SAPLING_EXTENDED_SPEND_KEY] = "p-secret-spending-key-main";
349 532 : bech32HRPs[SAPLING_EXTENDED_FVK] = "pxviews";
350 :
351 532 : bech32HRPs[BLS_SECRET_KEY] = "bls-sk";
352 532 : bech32HRPs[BLS_PUBLIC_KEY] = "bls-pk";
353 :
354 : // long living quorum params
355 532 : consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
356 532 : consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
357 532 : consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
358 :
359 532 : nLLMQConnectionRetryTimeout = 60;
360 :
361 532 : consensus.llmqTypeChainLocks = Consensus::LLMQ_400_60;
362 :
363 : // Tier two
364 532 : nFulfilledRequestExpireTime = 60 * 60; // fulfilled requests expire in 1 hour
365 532 : }
366 :
367 2317 : const CCheckpointData& Checkpoints() const
368 : {
369 2317 : return data;
370 : }
371 :
372 : };
373 :
374 : /**
375 : * Testnet (v5)
376 : */
377 : class CTestNetParams : public CChainParams
378 : {
379 : public:
380 52 : CTestNetParams()
381 52 : {
382 52 : strNetworkID = "test";
383 :
384 52 : genesis = CreateGenesisBlock(1454124731, 2402015, 0x1e0ffff0, 1, 250 * COIN);
385 52 : consensus.hashGenesisBlock = genesis.GetHash();
386 104 : assert(consensus.hashGenesisBlock == uint256S("0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818"));
387 104 : assert(genesis.hashMerkleRoot == uint256S("0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b"));
388 :
389 52 : consensus.fPowAllowMinDifficultyBlocks = true;
390 52 : consensus.fPowNoRetargeting = false;
391 52 : consensus.powLimit = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
392 52 : consensus.posLimitV1 = uint256S("0x000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
393 52 : consensus.posLimitV2 = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
394 52 : consensus.nBudgetCycleBlocks = 144; // approx 10 cycles per day
395 52 : consensus.nBudgetFeeConfirmations = 3; // (only 8-blocks window for finalization on testnet)
396 52 : consensus.nCoinbaseMaturity = 15;
397 52 : consensus.nFutureTimeDriftPoW = 7200;
398 52 : consensus.nFutureTimeDriftPoS = 180;
399 52 : consensus.nMaxMoneyOut = 21000000 * COIN;
400 52 : consensus.nMNCollateralAmt = 10000 * COIN;
401 52 : consensus.nMNBlockReward = 3 * COIN;
402 52 : consensus.nNewMNBlockReward = 6 * COIN;
403 52 : consensus.nMNCollateralMinConf = 15;
404 52 : consensus.nProposalEstablishmentTime = 60 * 5; // at least 5 min old to make it into a budget
405 52 : consensus.nStakeMinAge = 60 * 60;
406 52 : consensus.nStakeMinDepth = 100;
407 52 : consensus.nTargetTimespan = 40 * 60;
408 52 : consensus.nTargetTimespanV2 = 30 * 60;
409 52 : consensus.nTargetSpacing = 1 * 60;
410 52 : consensus.nTimeSlotLength = 15;
411 52 : consensus.nMaxProposalPayments = 20;
412 :
413 : // spork keys
414 52 : consensus.strSporkPubKey = "04677c34726c491117265f4b1c83cef085684f36c8df5a97a3a42fc499316d0c4e63959c9eca0dba239d9aaaf72011afffeb3ef9f51b9017811dec686e412eb504";
415 52 : consensus.strSporkPubKeyOld = "04E88BB455E2A04E65FCC41D88CD367E9CCE1F5A409BE94D8C2B4B35D223DED9C8E2F4E061349BA3A38839282508066B6DC4DB72DD432AC4067991E6BF20176127";
416 52 : consensus.nTime_EnforceNewSporkKey = 1608512400; //!> December 21, 2020 01:00:00 AM GMT
417 52 : consensus.nTime_RejectOldSporkKey = 1614560400; //!> March 1, 2021 01:00:00 AM GMT
418 :
419 : // height based activations
420 52 : consensus.height_last_invalid_UTXO = -1;
421 52 : consensus.height_last_ZC_AccumCheckpoint = -1;
422 52 : consensus.height_last_ZC_WrappedSerials = -1;
423 52 : consensus.ZC_HeightStart = 0;
424 :
425 : // Zerocoin-related params
426 52 : consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
427 : "4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
428 : "6507761337985909570009733045974880842840179742910064245869181719511874612151517265463228221686998754918242243363"
429 : "7259085141865462043576798423387184774447920739934236584823824281198163815010674810451660377306056201619676256133"
430 : "8441436038339044149526344321901146575444541784240209246165157233507787077498171257724679629263863563732899121548"
431 52 : "31438167899885040445364023527381951378636564391212010397122822120720357";
432 52 : consensus.ZC_MaxPublicSpendsPerTx = 637; // Assume about 220 bytes each input
433 52 : consensus.ZC_MaxSpendsPerTx = 7; // Assume about 20kb each input
434 52 : consensus.ZC_MinMintConfirmations = 20;
435 52 : consensus.ZC_MinMintFee = 1 * CENT;
436 52 : consensus.ZC_MinStakeDepth = 200;
437 52 : consensus.ZC_TimeStart = 1508214600; // October 17, 2017 4:30:00 AM
438 :
439 : // Network upgrades
440 52 : consensus.vUpgrades[Consensus::BASE_NETWORK].nActivationHeight =
441 : Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
442 52 : consensus.vUpgrades[Consensus::UPGRADE_TESTDUMMY].nActivationHeight =
443 : Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
444 52 : consensus.vUpgrades[Consensus::UPGRADE_POS].nActivationHeight = 201;
445 52 : consensus.vUpgrades[Consensus::UPGRADE_POS_V2].nActivationHeight = 201;
446 52 : consensus.vUpgrades[Consensus::UPGRADE_ZC].nActivationHeight = 201;
447 52 : consensus.vUpgrades[Consensus::UPGRADE_ZC_V2].nActivationHeight = 201;
448 52 : consensus.vUpgrades[Consensus::UPGRADE_BIP65].nActivationHeight = 201;
449 52 : consensus.vUpgrades[Consensus::UPGRADE_ZC_PUBLIC].nActivationHeight = 201;
450 52 : consensus.vUpgrades[Consensus::UPGRADE_V3_4].nActivationHeight = 201;
451 52 : consensus.vUpgrades[Consensus::UPGRADE_V4_0].nActivationHeight = 201;
452 52 : consensus.vUpgrades[Consensus::UPGRADE_V5_0].nActivationHeight = 201;
453 52 : consensus.vUpgrades[Consensus::UPGRADE_V5_2].nActivationHeight = 262525;
454 52 : consensus.vUpgrades[Consensus::UPGRADE_V5_3].nActivationHeight = 332300;
455 52 : consensus.vUpgrades[Consensus::UPGRADE_V5_5].nActivationHeight = 925056;
456 52 : consensus.vUpgrades[Consensus::UPGRADE_V5_6].nActivationHeight = 1624280; // Estimate Feb 23 Midnight UTC
457 52 : consensus.vUpgrades[Consensus::UPGRADE_V6_0].nActivationHeight =
458 : Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
459 :
460 : /**
461 : * The message start string is designed to be unlikely to occur in normal data.
462 : * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
463 : * a large 4-byte int at any alignment.
464 : */
465 52 : pchMessageStart[0] = 0xf5;
466 52 : pchMessageStart[1] = 0xe6;
467 52 : pchMessageStart[2] = 0xd5;
468 52 : pchMessageStart[3] = 0xca;
469 52 : nDefaultPort = 51474;
470 :
471 : // nodes with support for servicebits filtering should be at the top
472 52 : vSeeds.emplace_back("pivx-testnet.seed.fuzzbawls.pw", true);
473 52 : vSeeds.emplace_back("pivx-testnet.seed2.fuzzbawls.pw", true);
474 :
475 52 : base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 139); // Testnet pivx addresses start with 'x' or 'y'
476 52 : base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 19); // Testnet pivx script addresses start with '8' or '9'
477 52 : base58Prefixes[STAKING_ADDRESS] = std::vector<unsigned char>(1, 73); // starting with 'W'
478 52 : base58Prefixes[EXCHANGE_ADDRESS] = {0x01, 0xb9, 0xb1}; // EXT prefix for the address
479 52 : base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 239); // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
480 : // Testnet pivx BIP32 pubkeys start with 'DRKV'
481 52 : base58Prefixes[EXT_PUBLIC_KEY] = {0x3a, 0x80, 0x61, 0xa0};
482 : // Testnet pivx BIP32 prvkeys start with 'DRKP'
483 52 : base58Prefixes[EXT_SECRET_KEY] = {0x3a, 0x80, 0x58, 0x37};
484 : // Testnet pivx BIP44 coin type is '1' (All coin's testnet default)
485 52 : base58Prefixes[EXT_COIN_TYPE] = {0x80, 0x00, 0x00, 0x01};
486 :
487 52 : vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));
488 :
489 52 : fRequireStandard = false;
490 :
491 : // Sapling
492 52 : bech32HRPs[SAPLING_PAYMENT_ADDRESS] = "ptestsapling";
493 52 : bech32HRPs[SAPLING_FULL_VIEWING_KEY] = "pviewtestsapling";
494 52 : bech32HRPs[SAPLING_INCOMING_VIEWING_KEY] = "pivktestsapling";
495 52 : bech32HRPs[SAPLING_EXTENDED_SPEND_KEY] = "p-secret-spending-key-test";
496 52 : bech32HRPs[SAPLING_EXTENDED_FVK] = "pxviewtestsapling";
497 :
498 52 : bech32HRPs[BLS_SECRET_KEY] = "bls-sk-test";
499 52 : bech32HRPs[BLS_PUBLIC_KEY] = "bls-pk-test";
500 :
501 : // long living quorum params
502 52 : consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
503 52 : consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
504 52 : consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
505 :
506 52 : nLLMQConnectionRetryTimeout = 60;
507 :
508 52 : consensus.llmqTypeChainLocks = Consensus::LLMQ_400_60;
509 :
510 : // Tier two
511 52 : nFulfilledRequestExpireTime = 60 * 60; // fulfilled requests expire in 1 hour
512 52 : }
513 :
514 4 : const CCheckpointData& Checkpoints() const
515 : {
516 4 : return dataTestnet;
517 : }
518 : };
519 :
520 : /**
521 : * Regression test
522 : */
523 : class CRegTestParams : public CChainParams
524 : {
525 : public:
526 433 : CRegTestParams()
527 433 : {
528 433 : strNetworkID = "regtest";
529 :
530 433 : genesis = CreateGenesisBlock(1454124731, 1, 0x207fffff, 1, 250 * COIN);
531 433 : consensus.hashGenesisBlock = genesis.GetHash();
532 866 : assert(consensus.hashGenesisBlock == uint256S("0x7445589c4c8e52b105247b13373e5ee325856aa05d53f429e59ea46b7149ae3f"));
533 866 : assert(genesis.hashMerkleRoot == uint256S("0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b"));
534 :
535 433 : consensus.fPowAllowMinDifficultyBlocks = true;
536 433 : consensus.fPowNoRetargeting = true;
537 433 : consensus.powLimit = uint256S("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
538 433 : consensus.posLimitV1 = uint256S("0x000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
539 433 : consensus.posLimitV2 = uint256S("0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
540 433 : consensus.nBudgetCycleBlocks = 144; // approx 10 cycles per day
541 433 : consensus.nBudgetFeeConfirmations = 3; // (only 8-blocks window for finalization on regtest)
542 433 : consensus.nCoinbaseMaturity = 100;
543 433 : consensus.nFutureTimeDriftPoW = 7200;
544 433 : consensus.nFutureTimeDriftPoS = 180;
545 433 : consensus.nMaxMoneyOut = 43199500 * COIN;
546 433 : consensus.nMNCollateralAmt = 100 * COIN;
547 433 : consensus.nMNBlockReward = 3 * COIN;
548 433 : consensus.nNewMNBlockReward = 6 * COIN;
549 433 : consensus.nMNCollateralMinConf = 1;
550 433 : consensus.nProposalEstablishmentTime = 60 * 5; // at least 5 min old to make it into a budget
551 433 : consensus.nStakeMinAge = 0;
552 433 : consensus.nStakeMinDepth = 20;
553 433 : consensus.nTargetTimespan = 40 * 60;
554 433 : consensus.nTargetTimespanV2 = 30 * 60;
555 433 : consensus.nTargetSpacing = 1 * 60;
556 433 : consensus.nTimeSlotLength = 15;
557 433 : consensus.nMaxProposalPayments = 20;
558 :
559 : /* Spork Key for RegTest:
560 : WIF private key: 932HEevBSujW2ud7RfB1YF91AFygbBRQj3de3LyaCRqNzKKgWXi
561 : private key hex: bd4960dcbd9e7f2223f24e7164ecb6f1fe96fc3a416f5d3a830ba5720c84b8ca
562 : Address: yCvUVd72w7xpimf981m114FSFbmAmne7j9
563 : */
564 433 : consensus.strSporkPubKey = "043969b1b0e6f327de37f297a015d37e2235eaaeeb3933deecd8162c075cee0207b13537618bde640879606001a8136091c62ec272dd0133424a178704e6e75bb7";
565 433 : consensus.strSporkPubKeyOld = "";
566 433 : consensus.nTime_EnforceNewSporkKey = 0;
567 433 : consensus.nTime_RejectOldSporkKey = 0;
568 :
569 : // height based activations
570 433 : consensus.height_last_invalid_UTXO = -1;
571 433 : consensus.height_last_ZC_AccumCheckpoint = 310; // no checkpoints on regtest
572 433 : consensus.height_last_ZC_WrappedSerials = -1;
573 :
574 : // Zerocoin-related params
575 433 : consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
576 : "4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
577 : "6507761337985909570009733045974880842840179742910064245869181719511874612151517265463228221686998754918242243363"
578 : "7259085141865462043576798423387184774447920739934236584823824281198163815010674810451660377306056201619676256133"
579 : "8441436038339044149526344321901146575444541784240209246165157233507787077498171257724679629263863563732899121548"
580 433 : "31438167899885040445364023527381951378636564391212010397122822120720357";
581 433 : consensus.ZC_MaxPublicSpendsPerTx = 637; // Assume about 220 bytes each input
582 433 : consensus.ZC_MaxSpendsPerTx = 7; // Assume about 20kb each input
583 433 : consensus.ZC_MinMintConfirmations = 10;
584 433 : consensus.ZC_MinMintFee = 1 * CENT;
585 433 : consensus.ZC_MinStakeDepth = 10;
586 433 : consensus.ZC_TimeStart = 0; // not implemented on regtest
587 433 : consensus.ZC_HeightStart = 0;
588 :
589 : // Network upgrades
590 433 : consensus.vUpgrades[Consensus::BASE_NETWORK].nActivationHeight =
591 : Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
592 433 : consensus.vUpgrades[Consensus::UPGRADE_TESTDUMMY].nActivationHeight =
593 : Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
594 433 : consensus.vUpgrades[Consensus::UPGRADE_POS].nActivationHeight = 251;
595 433 : consensus.vUpgrades[Consensus::UPGRADE_POS_V2].nActivationHeight = 251;
596 433 : consensus.vUpgrades[Consensus::UPGRADE_ZC].nActivationHeight = 300;
597 433 : consensus.vUpgrades[Consensus::UPGRADE_ZC_V2].nActivationHeight = 300;
598 433 : consensus.vUpgrades[Consensus::UPGRADE_BIP65].nActivationHeight =
599 : Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
600 433 : consensus.vUpgrades[Consensus::UPGRADE_ZC_PUBLIC].nActivationHeight = 400;
601 433 : consensus.vUpgrades[Consensus::UPGRADE_V3_4].nActivationHeight = 251;
602 433 : consensus.vUpgrades[Consensus::UPGRADE_V4_0].nActivationHeight =
603 : Consensus::NetworkUpgrade::ALWAYS_ACTIVE;
604 433 : consensus.vUpgrades[Consensus::UPGRADE_V5_0].nActivationHeight = 300;
605 433 : consensus.vUpgrades[Consensus::UPGRADE_V5_2].nActivationHeight = 300;
606 433 : consensus.vUpgrades[Consensus::UPGRADE_V5_3].nActivationHeight = 251;
607 433 : consensus.vUpgrades[Consensus::UPGRADE_V5_5].nActivationHeight = 576;
608 433 : consensus.vUpgrades[Consensus::UPGRADE_V5_6].nActivationHeight = 1000;
609 433 : consensus.vUpgrades[Consensus::UPGRADE_V6_0].nActivationHeight =
610 : Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
611 :
612 : /**
613 : * The message start string is designed to be unlikely to occur in normal data.
614 : * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
615 : * a large 4-byte int at any alignment.
616 : */
617 433 : pchMessageStart[0] = 0xa1;
618 433 : pchMessageStart[1] = 0xcf;
619 433 : pchMessageStart[2] = 0x7e;
620 433 : pchMessageStart[3] = 0xac;
621 433 : nDefaultPort = 51476;
622 :
623 433 : base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 139); // Testnet pivx addresses start with 'x' or 'y'
624 433 : base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 19); // Testnet pivx script addresses start with '8' or '9'
625 433 : base58Prefixes[STAKING_ADDRESS] = std::vector<unsigned char>(1, 73); // starting with 'W'
626 433 : base58Prefixes[EXCHANGE_ADDRESS] = {0x01, 0xb9, 0xb1}; // EXT prefix for the address
627 433 : base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 239); // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
628 : // Testnet pivx BIP32 pubkeys start with 'DRKV'
629 433 : base58Prefixes[EXT_PUBLIC_KEY] = {0x3a, 0x80, 0x61, 0xa0};
630 : // Testnet pivx BIP32 prvkeys start with 'DRKP'
631 433 : base58Prefixes[EXT_SECRET_KEY] = {0x3a, 0x80, 0x58, 0x37};
632 : // Testnet pivx BIP44 coin type is '1' (All coin's testnet default)
633 433 : base58Prefixes[EXT_COIN_TYPE] = {0x80, 0x00, 0x00, 0x01};
634 :
635 : // Reject non-standard transactions by default
636 433 : fRequireStandard = true;
637 :
638 : // Sapling
639 433 : bech32HRPs[SAPLING_PAYMENT_ADDRESS] = "ptestsapling";
640 433 : bech32HRPs[SAPLING_FULL_VIEWING_KEY] = "pviewtestsapling";
641 433 : bech32HRPs[SAPLING_INCOMING_VIEWING_KEY] = "pivktestsapling";
642 433 : bech32HRPs[SAPLING_EXTENDED_SPEND_KEY] = "p-secret-spending-key-test";
643 433 : bech32HRPs[SAPLING_EXTENDED_FVK] = "pxviewtestsapling";
644 :
645 433 : bech32HRPs[BLS_SECRET_KEY] = "bls-sk-test";
646 433 : bech32HRPs[BLS_PUBLIC_KEY] = "bls-pk-test";
647 :
648 : // long living quorum params
649 433 : consensus.llmqs[Consensus::LLMQ_TEST] = llmq_test;
650 433 : nLLMQConnectionRetryTimeout = 10;
651 :
652 433 : consensus.llmqTypeChainLocks = Consensus::LLMQ_TEST;
653 :
654 : // Tier two
655 433 : nFulfilledRequestExpireTime = 60 * 60; // fulfilled requests expire in 1 hour
656 433 : }
657 :
658 495815 : const CCheckpointData& Checkpoints() const
659 : {
660 495815 : return dataRegtest;
661 : }
662 : };
663 :
664 : static std::unique_ptr<CChainParams> globalChainParams;
665 :
666 19548930 : const CChainParams &Params()
667 : {
668 19548930 : assert(globalChainParams);
669 19548930 : return *globalChainParams;
670 : }
671 :
672 1017 : std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain)
673 : {
674 1017 : if (chain == CBaseChainParams::MAIN)
675 532 : return std::unique_ptr<CChainParams>(new CMainParams());
676 485 : else if (chain == CBaseChainParams::TESTNET)
677 52 : return std::unique_ptr<CChainParams>(new CTestNetParams());
678 433 : else if (chain == CBaseChainParams::REGTEST)
679 1450 : return std::unique_ptr<CChainParams>(new CRegTestParams());
680 0 : throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
681 : }
682 :
683 942 : void SelectParams(const std::string& network)
684 : {
685 942 : SelectBaseParams(network);
686 1391 : globalChainParams = CreateChainParams(network);
687 942 : }
688 :
689 434 : void UpdateNetworkUpgradeParameters(Consensus::UpgradeIndex idx, int nActivationHeight)
690 : {
691 434 : globalChainParams->UpdateNetworkUpgradeParameters(idx, nActivationHeight);
692 434 : }
|