@@ -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" ));
0 commit comments