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