@@ -16,6 +16,45 @@ using namespace std;
16
16
17
17
#include " chainparamsseeds.h"
18
18
19
+ static CBlock CreateGenesisBlock (const char * pszTimestamp, CScript genesisOutputScript, uint32_t nTime=1231006505 , uint32_t nNonce=2083236893 , uint32_t nBits=0x1d00ffff , int32_t nVersion=1 , const CAmount& genesisReward=50 * COIN)
20
+ {
21
+ CMutableTransaction txNew;
22
+ txNew.nVersion = 1 ;
23
+ txNew.vin .resize (1 );
24
+ txNew.vout .resize (1 );
25
+ txNew.vin [0 ].scriptSig = CScript () << 486604799 << CScriptNum (4 ) << vector<unsigned char >((const unsigned char *)pszTimestamp, (const unsigned char *)pszTimestamp + strlen (pszTimestamp));
26
+ txNew.vout [0 ].nValue = genesisReward;
27
+ txNew.vout [0 ].scriptPubKey = genesisOutputScript;
28
+
29
+ CBlock genesis;
30
+ genesis.nTime = nTime;
31
+ genesis.nBits = nBits;
32
+ genesis.nNonce = nNonce;
33
+ genesis.nVersion = nVersion;
34
+ genesis.vtx .push_back (txNew);
35
+ genesis.hashPrevBlock .SetNull ();
36
+ genesis.hashMerkleRoot = genesis.BuildMerkleTree ();
37
+ return genesis;
38
+ }
39
+
40
+ /* *
41
+ * Build the genesis block. Note that the output of its generation
42
+ * transaction cannot be spent since it did not originally exist in the
43
+ * database.
44
+ *
45
+ * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
46
+ * CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
47
+ * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
48
+ * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
49
+ * vMerkleTree: 4a5e1e
50
+ */
51
+ static CBlock CreateGenesisBlock (uint32_t nTime=1231006505 , uint32_t nNonce=2083236893 , uint32_t nBits=0x1d00ffff , int32_t nVersion=1 , const CAmount& genesisReward=50 * COIN)
52
+ {
53
+ const char * pszTimestamp = " The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" ;
54
+ CScript genesisOutputScript = CScript () << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f" ) << OP_CHECKSIG;
55
+ return CreateGenesisBlock (pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
56
+ }
57
+
19
58
/* *
20
59
* Main network
21
60
*/
@@ -52,33 +91,7 @@ class CMainParams : public CChainParams {
52
91
nDefaultPort = 8333 ;
53
92
nPruneAfterHeight = 100000 ;
54
93
55
- /* *
56
- * Build the genesis block. Note that the output of its generation
57
- * transaction cannot be spent since it did not originally exist in the
58
- * database.
59
- *
60
- * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
61
- * CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
62
- * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
63
- * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
64
- * vMerkleTree: 4a5e1e
65
- */
66
- const char * pszTimestamp = " The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" ;
67
- CMutableTransaction txNew;
68
- txNew.nVersion = 1 ;
69
- txNew.vin .resize (1 );
70
- txNew.vout .resize (1 );
71
- txNew.vin [0 ].scriptSig = CScript () << 486604799 << CScriptNum (4 ) << vector<unsigned char >((const unsigned char *)pszTimestamp, (const unsigned char *)pszTimestamp + strlen (pszTimestamp));
72
- txNew.vout [0 ].nValue = 50 * COIN;
73
- txNew.vout [0 ].scriptPubKey = CScript () << ParseHex (" 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f" ) << OP_CHECKSIG;
74
- genesis.vtx .push_back (txNew);
75
- genesis.hashPrevBlock .SetNull ();
76
- genesis.hashMerkleRoot = genesis.BuildMerkleTree ();
77
- genesis.nVersion = 1 ;
78
- genesis.nTime = 1231006505 ;
79
- genesis.nBits = 0x1d00ffff ;
80
- genesis.nNonce = 2083236893 ;
81
-
94
+ genesis = CreateGenesisBlock ();
82
95
consensus.hashGenesisBlock = genesis.GetHash ();
83
96
assert (consensus.hashGenesisBlock == uint256S (" 0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" ));
84
97
assert (genesis.hashMerkleRoot == uint256S (" 0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" ));
@@ -131,13 +144,17 @@ static CMainParams mainParams;
131
144
/* *
132
145
* Testnet (v3)
133
146
*/
134
- class CTestNetParams : public CMainParams {
147
+ class CTestNetParams : public CChainParams {
135
148
public:
136
149
CTestNetParams () {
137
150
strNetworkID = " test" ;
151
+ consensus.nSubsidyHalvingInterval = 210000 ;
138
152
consensus.nMajorityEnforceBlockUpgrade = 51 ;
139
153
consensus.nMajorityRejectBlockOutdated = 75 ;
140
154
consensus.nMajorityWindow = 100 ;
155
+ consensus.powLimit = uint256S (" 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
156
+ consensus.nPowTargetTimespan = 14 * 24 * 60 * 60 ; // two weeks
157
+ consensus.nPowTargetSpacing = 10 * 60 ;
141
158
consensus.fPowAllowMinDifficultyBlocks = true ;
142
159
pchMessageStart[0 ] = 0x0b ;
143
160
pchMessageStart[1 ] = 0x11 ;
@@ -147,9 +164,7 @@ class CTestNetParams : public CMainParams {
147
164
nDefaultPort = 18333 ;
148
165
nPruneAfterHeight = 1000 ;
149
166
150
- // ! Modify the testnet genesis block so the timestamp is valid for a later start.
151
- genesis.nTime = 1296688602 ;
152
- genesis.nNonce = 414098458 ;
167
+ genesis = CreateGenesisBlock (1296688602 , 414098458 );
153
168
consensus.hashGenesisBlock = genesis.GetHash ();
154
169
assert (consensus.hashGenesisBlock == uint256S (" 0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" ));
155
170
@@ -189,7 +204,7 @@ static CTestNetParams testNetParams;
189
204
/* *
190
205
* Regression test
191
206
*/
192
- class CRegTestParams : public CTestNetParams {
207
+ class CRegTestParams : public CChainParams {
193
208
public:
194
209
CRegTestParams () {
195
210
strNetworkID = " regtest" ;
@@ -198,13 +213,14 @@ class CRegTestParams : public CTestNetParams {
198
213
consensus.nMajorityRejectBlockOutdated = 950 ;
199
214
consensus.nMajorityWindow = 1000 ;
200
215
consensus.powLimit = uint256S (" 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
216
+ consensus.nPowTargetTimespan = 14 * 24 * 60 * 60 ; // two weeks
217
+ consensus.nPowTargetSpacing = 10 * 60 ;
218
+ consensus.fPowAllowMinDifficultyBlocks = true ;
201
219
pchMessageStart[0 ] = 0xfa ;
202
220
pchMessageStart[1 ] = 0xbf ;
203
221
pchMessageStart[2 ] = 0xb5 ;
204
222
pchMessageStart[3 ] = 0xda ;
205
- genesis.nTime = 1296688602 ;
206
- genesis.nBits = 0x207fffff ;
207
- genesis.nNonce = 2 ;
223
+ genesis = CreateGenesisBlock (1296688602 , 2 , 0x207fffff );
208
224
consensus.hashGenesisBlock = genesis.GetHash ();
209
225
nDefaultPort = 18444 ;
210
226
assert (consensus.hashGenesisBlock == uint256S (" 0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206" ));
@@ -226,6 +242,11 @@ class CRegTestParams : public CTestNetParams {
226
242
0 ,
227
243
0
228
244
};
245
+ base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char >(1 ,111 );
246
+ base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char >(1 ,196 );
247
+ base58Prefixes[SECRET_KEY] = std::vector<unsigned char >(1 ,239 );
248
+ base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of (0x04 )(0x35 )(0x87 )(0xCF ).convert_to_container <std::vector<unsigned char > >();
249
+ base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of (0x04 )(0x35 )(0x83 )(0x94 ).convert_to_container <std::vector<unsigned char > >();
229
250
}
230
251
};
231
252
static CRegTestParams regTestParams;
0 commit comments