1717#include < boost/assign/list_of.hpp>
1818#include < limits>
1919
20+ #include " chainparamsseeds.h"
2021
21- struct SeedSpec6 {
22- uint8_t addr[16 ];
23- uint16_t port;
24- };
22+ static CBlock CreateGenesisBlock (const char * pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
23+ {
24+ CMutableTransaction txNew;
25+ txNew.nVersion = 1 ;
26+ txNew.vin .resize (1 );
27+ txNew.vout .resize (1 );
28+ txNew.vin [0 ].scriptSig = CScript () << 486604799 << CScriptNum (4 ) << std::vector<unsigned char >((const unsigned char *)pszTimestamp, (const unsigned char *)pszTimestamp + strlen (pszTimestamp));
29+ txNew.vout [0 ].nValue = genesisReward;
30+ txNew.vout [0 ].scriptPubKey = genesisOutputScript;
31+
32+ CBlock genesis;
33+ genesis.vtx .push_back (txNew);
34+ genesis.hashPrevBlock = 0 ;
35+ genesis.nVersion = nVersion;
36+ genesis.nTime = nTime;
37+ genesis.nBits = nBits;
38+ genesis.nNonce = nNonce;
39+ genesis.hashMerkleRoot = BlockMerkleRoot (genesis);
40+ return genesis;
41+ }
2542
26- #include " chainparamsseeds.h"
43+ /* *
44+ * Build the genesis block. Note that the output of the genesis coinbase cannot
45+ * be spent as it did not originally exist in the database.
46+ *
47+ * CBlock(hash=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1390095618, nBits=1e0ffff0, nNonce=28917698, vtx=1)
48+ * CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
49+ * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73)
50+ * CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF)
51+ * vMerkleTree: e0028e
52+ */
53+ static CBlock CreateGenesisBlock (uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
54+ {
55+ const char * pszTimestamp = " U.S. News & World Report Jan 28 2016 With His Absence, Trump Dominates Another Debate" ;
56+ const CScript genesisOutputScript = CScript () << ParseHex (" 04c10e83b2703ccf322f7dbd62dd5855ac7c10bd055814ce121ba32607d573b8810c02c0582aed05b4deb9c4b77b26d92428c61256cd42774babea0a073b2ed0c9" ) << OP_CHECKSIG;
57+ return CreateGenesisBlock (pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
58+ }
2759
2860/* *
2961 * Main network
@@ -159,6 +191,23 @@ class CMainParams : public CChainParams
159191 {
160192 networkID = CBaseChainParams::MAIN;
161193 strNetworkID = " main" ;
194+
195+ consensus.BIP65Height = 1808634 ; // 82629b7a9978f5c7ea3f70a12db92633a7d2e436711500db28b97efd48b1e527
196+ consensus.powLimit = uint256S (" 00000ffff0000000000000000000000000000000000000000000000000000000" );
197+ consensus.posLimitv1 = uint256S (" 000000ffff000000000000000000000000000000000000000000000000000000" );
198+ consensus.posLimitv2 = uint256S (" 00000ffff0000000000000000000000000000000000000000000000000000000" );
199+ consensus.nCoinbaseMaturity = 100 ;
200+ consensus.nTargetTimespan = 40 * 60 ;
201+ consensus.nTargetSpacing = 1 * 60 ;
202+ consensus.fPowAllowMinDifficultyBlocks = false ;
203+ consensus.fPowNoRetargeting = false ;
204+
205+ // The best chain should have at least this much work.
206+ consensus.nMinimumChainWork = uint256S (" 0000000000000000000000000000000000000000000000000000000000000000" );
207+
208+ // By default assume that the signatures in ancestors of this block are valid.
209+ consensus.defaultAssumeValid = uint256S (" 0000000000000000000000000000000000000000000000000000000000000000" );
210+
162211 /* *
163212 * The message start string is designed to be unlikely to occur in normal data.
164213 * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
@@ -173,8 +222,13 @@ class CMainParams : public CChainParams
173222 bnProofOfWorkLimit = ~uint256 (0 ) >> 20 ; // PIVX starting difficulty is 1 / 2^12
174223 bnProofOfStakeLimit = ~uint256 (0 ) >> 24 ;
175224 bnProofOfStakeLimit_V2 = ~uint256 (0 ) >> 20 ; // 60/4 = 15 ==> use 2**4 higher limit
176- nSubsidyHalvingInterval = 210000 ;
177225 nMaxReorganizationDepth = 100 ;
226+
227+ genesis = CreateGenesisBlock (1454124731 , 2402015 , 0x1e0ffff0 , 1 , 250 * COIN);
228+ consensus.hashGenesisBlock = genesis.GetHash ();
229+ assert (consensus.hashGenesisBlock == uint256 (" 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818" ));
230+ assert (genesis.hashMerkleRoot == uint256 (" 0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b" ));
231+
178232 nEnforceBlockUpgradeMajority = 8100 ; // 75%
179233 nRejectBlockOutdatedMajority = 10260 ; // 95%
180234 nToCheckBlockUpgradeMajority = 10800 ; // Approximate expected amount of blocks in 7 days (1440*7.5)
@@ -183,7 +237,6 @@ class CMainParams : public CChainParams
183237 nTargetTimespan = 40 * 60 ; // 40 minutes
184238 nTimeSlotLength = 15 ; // 15 seconds
185239 nTargetTimespan_V2 = 2 * nTimeSlotLength * 60 ; // 30 minutes
186- nMaturity = 100 ;
187240 nStakeMinAge = 60 * 60 ; // 1 hour
188241 nStakeMinDepth = 600 ;
189242 nFutureTimeDriftPoW = 7200 ;
@@ -209,7 +262,6 @@ class CMainParams : public CChainParams
209262 nEnforceNewSporkKey = 1566860400 ; // !> Sporks signed after Monday, August 26, 2019 11:00:00 PM GMT must use the new spork key
210263 nRejectOldSporkKey = 1569538800 ; // !> Fully reject old spork key after Thursday, September 26, 2019 11:00:00 PM GMT
211264 nBlockStakeModifierlV2 = 1967000 ;
212- nBIP65ActivationHeight = 1808634 ;
213265 // Activation height for TimeProtocolV2, Blocks V7 and newMessageSignatures
214266 nBlockTimeProtocolV2 = 2153200 ;
215267
@@ -227,35 +279,7 @@ class CMainParams : public CChainParams
227279 nFakeSerialBlockheightEnd = 1686229 ;
228280 nSupplyBeforeFakeSerial = 4131563 * COIN; // zerocoin supply at block nFakeSerialBlockheightEnd
229281
230- /* *
231- * Build the genesis block. Note that the output of the genesis coinbase cannot
232- * be spent as it did not originally exist in the database.
233- *
234- * CBlock(hash=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1390095618, nBits=1e0ffff0, nNonce=28917698, vtx=1)
235- * CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
236- * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73)
237- * CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF)
238- * vMerkleTree: e0028e
239- */
240- const char * pszTimestamp = " U.S. News & World Report Jan 28 2016 With His Absence, Trump Dominates Another Debate" ;
241- CMutableTransaction txNew;
242- txNew.vin .resize (1 );
243- txNew.vout .resize (1 );
244- txNew.vin [0 ].scriptSig = CScript () << 486604799 << CScriptNum (4 ) << std::vector<unsigned char >((const unsigned char *)pszTimestamp, (const unsigned char *)pszTimestamp + strlen (pszTimestamp));
245- txNew.vout [0 ].nValue = 250 * COIN;
246- txNew.vout [0 ].scriptPubKey = CScript () << ParseHex (" 04c10e83b2703ccf322f7dbd62dd5855ac7c10bd055814ce121ba32607d573b8810c02c0582aed05b4deb9c4b77b26d92428c61256cd42774babea0a073b2ed0c9" ) << OP_CHECKSIG;
247- genesis.vtx .push_back (txNew);
248- genesis.hashPrevBlock = 0 ;
249- genesis.hashMerkleRoot = BlockMerkleRoot (genesis);
250- genesis.nVersion = 1 ;
251- genesis.nTime = 1454124731 ;
252- genesis.nBits = 0x1e0ffff0 ;
253- genesis.nNonce = 2402015 ;
254-
255- hashGenesisBlock = genesis.GetHash ();
256- assert (hashGenesisBlock == uint256 (" 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818" ));
257- assert (genesis.hashMerkleRoot == uint256 (" 0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b" ));
258-
282+ // Note that of those with the service bits flag, most only support a subset of possible options
259283 vSeeds.push_back (CDNSSeedData (" fuzzbawls.pw" , " pivx.seed.fuzzbawls.pw" )); // Primary DNS Seeder from Fuzzbawls
260284 vSeeds.push_back (CDNSSeedData (" fuzzbawls.pw" , " pivx.seed2.fuzzbawls.pw" )); // Secondary DNS Seeder from Fuzzbawls
261285 vSeeds.push_back (CDNSSeedData (" warrows.dev" , " dnsseed.pivx.warrows.dev" )); // Primery DNS Seeder from warrows
@@ -325,20 +349,48 @@ class CTestNetParams : public CMainParams
325349 {
326350 networkID = CBaseChainParams::TESTNET;
327351 strNetworkID = " test" ;
352+
353+ consensus.BIP65Height = 851019 ;
354+ consensus.powLimit = uint256S (" 00000ffff0000000000000000000000000000000000000000000000000000000" );
355+ consensus.posLimitv1 = uint256S (" 000000ffff000000000000000000000000000000000000000000000000000000" );
356+ consensus.posLimitv2 = uint256S (" 00000ffff0000000000000000000000000000000000000000000000000000000" );
357+ consensus.nCoinbaseMaturity = 15 ;
358+ consensus.nTargetTimespan = 40 * 60 ;
359+ consensus.nTargetSpacing = 1 * 60 ;
360+ consensus.fPowAllowMinDifficultyBlocks = false ;
361+ consensus.fPowNoRetargeting = false ;
362+
363+ // The best chain should have at least this much work.
364+ consensus.nMinimumChainWork = uint256S (" 0000000000000000000000000000000000000000000000000000000000000000" );
365+
366+ // By default assume that the signatures in ancestors of this block are valid.
367+ consensus.defaultAssumeValid = uint256S (" 0000000000000000000000000000000000000000000000000000000000000000" );
368+
369+ /* *
370+ * The message start string is designed to be unlikely to occur in normal data.
371+ * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
372+ * a large 4-byte int at any alignment.
373+ */
374+
328375 pchMessageStart[0 ] = 0x45 ;
329376 pchMessageStart[1 ] = 0x76 ;
330377 pchMessageStart[2 ] = 0x65 ;
331378 pchMessageStart[3 ] = 0xba ;
332379 vAlertPubKey = ParseHex (" 000010e83b2703ccf322f7dbd62dd5855ac7c10bd055814ce121ba32607d573b8810c02c0582aed05b4deb9c4b77b26d92428c61256cd42774babea0a073b2ed0c9" );
333380 nDefaultPort = 51474 ;
381+
382+ genesis = CreateGenesisBlock (1454124731 , 2402015 , 0x1e0ffff0 , 1 , 250 * COIN);
383+ consensus.hashGenesisBlock = genesis.GetHash ();
384+ assert (consensus.hashGenesisBlock == uint256 (" 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818" ));
385+ assert (genesis.hashMerkleRoot == uint256 (" 0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b" ));
386+
334387 nEnforceBlockUpgradeMajority = 4320 ; // 75%
335388 nRejectBlockOutdatedMajority = 5472 ; // 95%
336389 nToCheckBlockUpgradeMajority = 5760 ; // 4 days
337390 nMinerThreads = 0 ;
338391 nLastPOWBlock = 200 ;
339392 nPivxBadBlockTime = 1489001494 ; // Skip nBit validation of Block 259201 per PR #915
340393 nPivxBadBlocknBits = 0x1e0a20bd ; // Skip nBit validation of Block 201 per PR #915
341- nMaturity = 15 ;
342394 nStakeMinDepth = 100 ;
343395 nMasternodeCountDrift = 4 ;
344396 nModifierUpdateBlock = 51197 ; // approx Mon, 17 Apr 2017 04:00:00 GMT
@@ -354,7 +406,6 @@ class CTestNetParams : public CMainParams
354406 nEnforceNewSporkKey = 1566860400 ; // !> Sporks signed after Monday, August 26, 2019 11:00:00 PM GMT must use the new spork key
355407 nRejectOldSporkKey = 1569538800 ; // !> Reject old spork key after Thursday, September 26, 2019 11:00:00 PM GMT
356408 nBlockStakeModifierlV2 = 1214000 ;
357- nBIP65ActivationHeight = 851019 ;
358409 // Activation height for TimeProtocolV2, Blocks V7 and newMessageSignatures
359410 nBlockTimeProtocolV2 = 1347000 ;
360411
@@ -372,13 +423,6 @@ class CTestNetParams : public CMainParams
372423 nFakeSerialBlockheightEnd = -1 ;
373424 nSupplyBeforeFakeSerial = 0 ;
374425
375- // ! Modify the testnet genesis block so the timestamp is valid for a later start.
376- genesis.nTime = 1454124731 ;
377- genesis.nNonce = 2402015 ;
378-
379- hashGenesisBlock = genesis.GetHash ();
380- assert (hashGenesisBlock == uint256 (" 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818" ));
381-
382426 vFixedSeeds.clear ();
383427 vSeeds.clear ();
384428 vSeeds.push_back (CDNSSeedData (" fuzzbawls.pw" , " pivx-testnet.seed.fuzzbawls.pw" ));
@@ -433,19 +477,45 @@ class CRegTestParams : public CTestNetParams
433477 {
434478 networkID = CBaseChainParams::REGTEST;
435479 strNetworkID = " regtest" ;
480+
481+ consensus.BIP65Height = 1808634 ; // 82629b7a9978f5c7ea3f70a12db92633a7d2e436711500db28b97efd48b1e527
482+ consensus.powLimit = uint256S (" ffff000000000000000000000000000000000000000000000000000000000000" );
483+ consensus.posLimitv1 = uint256S (" 000000ffff000000000000000000000000000000000000000000000000000000" );
484+ consensus.posLimitv2 = uint256S (" 00000ffff0000000000000000000000000000000000000000000000000000000" );
485+ consensus.nCoinbaseMaturity = 100 ;
486+ consensus.nTargetTimespan = 40 * 60 ;
487+ consensus.nTargetSpacing = 1 * 60 ;
488+ consensus.fPowAllowMinDifficultyBlocks = true ;
489+ consensus.fPowNoRetargeting = true ;
490+
491+ // The best chain should have at least this much work.
492+ consensus.nMinimumChainWork = uint256S (" 0000000000000000000000000000000000000000000000000000000000000000" );
493+
494+ // By default assume that the signatures in ancestors of this block are valid.
495+ consensus.defaultAssumeValid = uint256S (" 0000000000000000000000000000000000000000000000000000000000000000" );
496+
497+ /* *
498+ * The message start string is designed to be unlikely to occur in normal data.
499+ * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
500+ * a large 4-byte int at any alignment.
501+ */
502+
436503 pchMessageStart[0 ] = 0xa1 ;
437504 pchMessageStart[1 ] = 0xcf ;
438505 pchMessageStart[2 ] = 0x7e ;
439506 pchMessageStart[3 ] = 0xac ;
440507 nDefaultPort = 51476 ;
441- nSubsidyHalvingInterval = 150 ;
508+
509+ genesis = CreateGenesisBlock (1454124731 , 2402015 , 0x1e0ffff0 , 1 , 250 * COIN);
510+ consensus.hashGenesisBlock = genesis.GetHash ();
511+ assert (consensus.hashGenesisBlock == uint256 (" 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818" ));
512+ assert (genesis.hashMerkleRoot == uint256 (" 0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b" ));
513+
442514 nEnforceBlockUpgradeMajority = 750 ;
443515 nRejectBlockOutdatedMajority = 950 ;
444516 nToCheckBlockUpgradeMajority = 1000 ;
445517 nMinerThreads = 1 ;
446- bnProofOfWorkLimit = ~uint256 (0 ) >> 1 ;
447518 nLastPOWBlock = 250 ;
448- nMaturity = 100 ;
449519 nStakeMinAge = 0 ;
450520 nStakeMinDepth = 0 ;
451521 nMasternodeCountDrift = 4 ;
@@ -476,14 +546,6 @@ class CRegTestParams : public CTestNetParams
476546 // Fake Serial Attack
477547 nFakeSerialBlockheightEnd = -1 ;
478548
479- // ! Modify the regtest genesis block so the timestamp is valid for a later start.
480- genesis.nTime = 1454124731 ;
481- genesis.nNonce = 2402015 ;
482-
483- hashGenesisBlock = genesis.GetHash ();
484- assert (hashGenesisBlock == uint256 (" 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818" ));
485- // assert(hashGenesisBlock == uint256("0x4f023a2120d9127b21bbad01724fdb79b519f593f2a85b60d3d79160ec5f29df"));
486-
487549 vFixedSeeds.clear (); // ! Testnet mode doesn't have any fixed seeds.
488550 vSeeds.clear (); // ! Testnet mode doesn't have any DNS seeds.
489551
0 commit comments