]>
Commit | Line | Data |
---|---|---|
0e4b3175 | 1 | // Copyright (c) 2010 Satoshi Nakamoto |
f914f1a7 | 2 | // Copyright (c) 2009-2014 The Bitcoin Core developers |
f2e03ffa | 3 | // Distributed under the MIT software license, see the accompanying |
0e4b3175 MH |
4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
5 | ||
c6a7e897 DH |
6 | #include "main.h" |
7 | #include "crypto/equihash.h" | |
51ed9ec9 | 8 | |
0e4b3175 | 9 | #include "util.h" |
85c579e3 | 10 | #include "utilstrencodings.h" |
0e4b3175 | 11 | |
187115c0 PK |
12 | #include <assert.h> |
13 | ||
8388289e PW |
14 | #include <boost/assign/list_of.hpp> |
15 | ||
db0f9315 S |
16 | #include "base58.h" |
17 | ||
09eb201b | 18 | using namespace std; |
8388289e | 19 | |
a60120e9 WL |
20 | #include "chainparamsseeds.h" |
21 | ||
f2e03ffa MF |
22 | /** |
23 | * Main network | |
24 | */ | |
f2e03ffa MF |
25 | /** |
26 | * What makes a good checkpoint block? | |
27 | * + Is surrounded by blocks with reasonable timestamps | |
28 | * (no blocks before with a timestamp after, none after with | |
29 | * timestamp before) | |
30 | * + Contains no strange transactions | |
31 | */ | |
e11712df | 32 | |
3e24a533 JG |
33 | const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); |
34 | ||
0e4b3175 MH |
35 | class CMainParams : public CChainParams { |
36 | public: | |
37 | CMainParams() { | |
f5ae6c98 | 38 | strNetworkID = "main"; |
a180d0a6 | 39 | consensus.fCoinbaseMustBeProtected = true; |
45e3deea JG |
40 | consensus.nSubsidySlowStartInterval = 20000; |
41 | consensus.nSubsidyHalvingInterval = 840000; | |
bd006110 JT |
42 | consensus.nMajorityEnforceBlockUpgrade = 750; |
43 | consensus.nMajorityRejectBlockOutdated = 950; | |
45e3deea | 44 | consensus.nMajorityWindow = 4000; |
b82dccaa JG |
45 | // TODO generate harder genesis block |
46 | //consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); | |
3e24a533 | 47 | consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f"); |
f2c48e15 | 48 | consensus.nPowAveragingWindow = 17; |
3e24a533 | 49 | assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow); |
8f3ec042 JG |
50 | consensus.nPowMaxAdjustDown = 32; // 32% adjustment down |
51 | consensus.nPowMaxAdjustUp = 16; // 16% adjustment up | |
45e3deea | 52 | consensus.nPowTargetSpacing = 2.5 * 60; |
bd006110 | 53 | consensus.fPowAllowMinDifficultyBlocks = false; |
f2e03ffa MF |
54 | /** |
55 | * The message start string is designed to be unlikely to occur in normal data. | |
56 | * The characters are rarely used upper ASCII, not valid as UTF-8, and produce | |
b05a89b2 | 57 | * a large 32-bit integer with any alignment. |
f2e03ffa | 58 | */ |
62fdd8d0 SB |
59 | pchMessageStart[0] = 0x9f; |
60 | pchMessageStart[1] = 0xee; | |
61 | pchMessageStart[2] = 0x4e; | |
62 | pchMessageStart[3] = 0xd8; | |
174a68b3 | 63 | vAlertPubKey = ParseHex("04b7ecf0baa90495ceb4e4090f6b2fd37eec1e9c85fac68a487f3ce11589692e4a317479316ee814e066638e1db54e37a10689b70286e6315b1087b6615d179264"); |
3985a40d | 64 | nDefaultPort = 8233; |
2595b9ac | 65 | nMinerThreads = 0; |
33d6825c | 66 | nMaxTipAge = 24 * 60 * 60; |
f9ec3f0f | 67 | nPruneAfterHeight = 100000; |
c6a7e897 DH |
68 | const size_t N = 200, K = 9; |
69 | BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K)); | |
70 | nEquihashN = N; | |
71 | nEquihashK = K; | |
0e4b3175 | 72 | |
f2e03ffa | 73 | /** |
b05a89b2 LD |
74 | * Build the genesis block. Note that the output of its generation |
75 | * transaction cannot be spent since it did not originally exist in the | |
76 | * database. | |
77 | * | |
f2e03ffa MF |
78 | * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1) |
79 | * CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0) | |
80 | * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) | |
81 | * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) | |
82 | * vMerkleTree: 4a5e1e | |
83 | */ | |
0e4b3175 | 84 | const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; |
4949004d | 85 | CMutableTransaction txNew; |
0e4b3175 MH |
86 | txNew.vin.resize(1); |
87 | txNew.vout.resize(1); | |
4f497cd9 | 88 | txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); |
0e4b3175 MH |
89 | txNew.vout[0].nValue = 50 * COIN; |
90 | txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; | |
91 | genesis.vtx.push_back(txNew); | |
4f152496 | 92 | genesis.hashPrevBlock.SetNull(); |
0e4b3175 MH |
93 | genesis.hashMerkleRoot = genesis.BuildMerkleTree(); |
94 | genesis.nVersion = 1; | |
95 | genesis.nTime = 1231006505; | |
b82dccaa JG |
96 | // TODO generate harder genesis block |
97 | //genesis.nBits = 0x1d00ffff; | |
66f07f5d JG |
98 | genesis.nBits = 0x200f0f0f; |
99 | genesis.nNonce = uint256S("0x000000000000000000000000000000000000000000000000000000000000000b"); | |
100 | genesis.nSolution = ParseHex("000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2"); | |
0e4b3175 | 101 | |
bd006110 | 102 | consensus.hashGenesisBlock = genesis.GetHash(); |
66f07f5d | 103 | assert(consensus.hashGenesisBlock == uint256S("0x027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71")); |
0ccb650b | 104 | assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); |
0e4b3175 | 105 | |
57466ea6 JG |
106 | vFixedSeeds.clear(); |
107 | vSeeds.clear(); | |
88188dc2 | 108 | // TODO: set up bootstrapping for mainnet |
57466ea6 JG |
109 | //vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be")); // Pieter Wuille |
110 | //vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me")); // Matt Corallo | |
111 | //vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); // Luke Dashjr | |
112 | //vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com")); // Christian Decker | |
113 | //vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org")); // Jeff Garzik | |
114 | //vSeeds.push_back(CDNSSeedData("bitcoin.jonasschnelli.ch", "seed.bitcoin.jonasschnelli.ch")); // Jonas Schnelli | |
0e4b3175 | 115 | |
a2b04ddf CF |
116 | base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0); |
117 | base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5); | |
118 | base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128); | |
119 | base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >(); | |
120 | base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >(); | |
e104fcdd SB |
121 | // guarantees the first two characters, when base58 encoded, are "zc" |
122 | base58Prefixes[ZCPAYMENT_ADDRRESS] = {22,154}; | |
d5d2fb71 SB |
123 | // guarantees the first two characters, when base58 encoded, are "SK" |
124 | base58Prefixes[ZCSPENDING_KEY] = {171,54}; | |
0e4b3175 | 125 | |
739d6155 | 126 | vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); |
0e4b3175 | 127 | |
c8c52de3 | 128 | fRequireRPCPassword = true; |
129 | fMiningRequiresPeers = true; | |
3fcfbc8a | 130 | fDefaultConsistencyChecks = false; |
c8c52de3 | 131 | fRequireStandard = true; |
c8c52de3 | 132 | fMineBlocksOnDemand = false; |
cc972107 | 133 | fTestnetToBeDeprecatedFieldRPC = false; |
e11712df | 134 | |
69968230 CF |
135 | checkpointData = (Checkpoints::CCheckpointData) { |
136 | boost::assign::map_list_of | |
3cb92766 | 137 | ( 0, consensus.hashGenesisBlock), |
57466ea6 | 138 | genesis.nTime, // * UNIX timestamp of last checkpoint block |
3cb92766 SB |
139 | 0, // * total number of transactions between genesis and last checkpoint |
140 | // (the tx=... number in the SetBestChain debug.log lines) | |
141 | 0 // * estimated number of transactions per day after checkpoint | |
69968230 | 142 | }; |
db0f9315 S |
143 | |
144 | // Founders reward script expects a vector of 2-of-3 multisig addresses | |
145 | vFoundersRewardAddress = { | |
146 | "ADDRESS1", "ADDRESS2", "ADDRESS3", "ADDRESS4", | |
147 | "ADDRESS5", "ADDRESS6", "ADDRESS7", "ADDRESS8", | |
148 | "ADDRESS9", "ADDRESS10", "ADDRESS11", "ADDRESS12", | |
149 | "ADDRESS13", "ADDRESS14", "ADDRESS15", "ADDRESS16", | |
150 | "ADDRESS17", "ADDRESS18", "ADDRESS19", "ADDRESS20", | |
151 | "ADDRESS21", "ADDRESS22", "ADDRESS23", "ADDRESS24", | |
152 | "ADDRESS25", "ADDRESS26", "ADDRESS27", "ADDRESS28", | |
153 | "ADDRESS29", "ADDRESS30", "ADDRESS31", "ADDRESS32", | |
154 | "ADDRESS33", "ADDRESS34", "ADDRESS35", "ADDRESS36", | |
155 | "ADDRESS37", "ADDRESS38", "ADDRESS39", "ADDRESS40", | |
156 | "ADDRESS41", "ADDRESS42", "ADDRESS43", "ADDRESS44", | |
157 | "ADDRESS45", "ADDRESS46", "ADDRESS47", "ADDRESS48", | |
158 | }; | |
159 | assert(vFoundersRewardAddress.size() < consensus.nSubsidyHalvingInterval + consensus.SubsidySlowStartShift()); | |
e11712df | 160 | } |
0e4b3175 MH |
161 | }; |
162 | static CMainParams mainParams; | |
163 | ||
f2e03ffa MF |
164 | /** |
165 | * Testnet (v3) | |
166 | */ | |
0e4b3175 MH |
167 | class CTestNetParams : public CMainParams { |
168 | public: | |
169 | CTestNetParams() { | |
f5ae6c98 | 170 | strNetworkID = "test"; |
bd006110 JT |
171 | consensus.nMajorityEnforceBlockUpgrade = 51; |
172 | consensus.nMajorityRejectBlockOutdated = 75; | |
45e3deea | 173 | consensus.nMajorityWindow = 400; |
3e24a533 JG |
174 | consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f"); |
175 | assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow); | |
bd006110 | 176 | consensus.fPowAllowMinDifficultyBlocks = true; |
88188dc2 SB |
177 | pchMessageStart[0] = 0xA5; |
178 | pchMessageStart[1] = 0xF1; | |
179 | pchMessageStart[2] = 0xE7; | |
180 | pchMessageStart[3] = 0x26; | |
174a68b3 | 181 | vAlertPubKey = ParseHex("044e7a1553392325c871c5ace5d6ad73501c66f4c185d6b0453cf45dec5a1322e705c672ac1a27ef7cdaf588c10effdf50ed5f95f85f2f54a5f6159fca394ed0c6"); |
3985a40d | 182 | nDefaultPort = 18233; |
fd704c7b | 183 | nMinerThreads = 0; |
33d6825c | 184 | nMaxTipAge = 0x7fffffff; |
f9ec3f0f | 185 | nPruneAfterHeight = 1000; |
0e4b3175 | 186 | |
f2e03ffa | 187 | //! Modify the testnet genesis block so the timestamp is valid for a later start. |
0e4b3175 | 188 | genesis.nTime = 1296688602; |
66f07f5d JG |
189 | genesis.nBits = 0x200f0f0f; |
190 | genesis.nNonce = uint256S("0x0000000000000000000000000000000000000000000000000000000000000009"); | |
191 | genesis.nSolution = ParseHex("003423da3e41f916bf3ff0ee770eb844a240361abe08a8c9d46bd30226e2ad411a4047b6ddc230d173c60537e470e24f764120f5a2778b2a1285b0727bf79a0b085ad67e6266fb38fd72ef17f827315c42f921720248c983d4100e6ebd1c4b5e8762a973bac3bec7f7153b93752ebbb465f0fc9520bcfc30f9abfe303627338fed6ede9cf1b9173a736cf270cf4d9c6999ff4c3a301a78fd50dab6ccca67a0c5c2e41f216a1f3efd049a74bbe6252f9773bc309d3f9e554d996913ce8e1cec672a1fa4ea59726b61ea9e75d5ce9aa5dbfa96179a293810e02787f26de324fe7c88376ff57e29574a55faff7c2946f3e40e451861c32bf67da7377de3136858a18f34fab1bc8da37726ca2c25fc7b312a5427554ec944da81c7e27255d6c94ade9987ff7daedc2d1cc63d7d4cf93e691d13326fb1c7ee72ccdc0b134eb665fc6a9821e6fef6a6d45e4aac6dca6b505a0100ad56ea4f6fa4cdc2f0d1b65f730104a515172e34163bdb422f99d083e6eb860cf6b3f66642c4dbaf0d0fa1dca1b6166f1d1ffaa55a9d6d6df628afbdd14f1622c1c8303259299521a253bc28fcc93676723158067270fc710a09155a1e50c533e9b79ed5edba4ab70a08a9a2fc0eef0ddae050d75776a9804f8d6ad7e30ccb66c6a98d86710ca7a4dfb4feb159484796b9a015c5764aa3509051c87f729b9877ea41f8b470898c01388ed9098b1e006d3c30fc6e7c781072fa3f75d918505ee8ca75840fc62f67c57060666aa42578a2dd022eda62e3f1e447d7364074d34fd60ad9b138f60422afa6cfcb913fd6c213b496144dbfda7bfc7c24540cfe40ad0c0fd5a8c0902127f53d3178ba1b2a87bf1224d53d3a15e49ccdf121ae872a011c996d1b9793153cdcd4c0a7e99f8a35669788551cca2b62769eda24b6b55e2f4e0ac0d30aa50ecf33c6cdb24adfc922006a7bf434ced800fefe814c94c6fc8caa37b372d5088bb31d2f6b11a7a67ad3f70abbac0d5c256b637828de6cc525978cf151a2e50798e0c591787639a030291272c9ced3ab7d682e03f8c7db51f60163baa85315789666ea8c5cd6f789a7f4a5de4f8a9dfefce20f353cec606492fde8eab3e3b487b3a3a57434f8cf252a4b643fc125c8a5948b06744f5dc306aa587bdc85364c7488235c6edddd78763675e50a9637181519be06dd30c4ba0d845f9ba320d01706fd6dd64d1aa3cd4211a4a7d1d3f2c1ef2766d27d5d2cdf8e7f5e3ea309d4f149bb737305df1373a7f5313abe5986f4aa620bec4b0065d48aafac3631de3771f5c4d2f6eec67b09d9c70a3c1969fecdb014cb3c69832b63cc9d6efa378bff0ef95ffacdeb1675bb326e698f022c1a3a2e1c2b0f05e1492a6d2b7552388eca7ee8a2467ef5d4207f65d4e2ae7e33f13eb473954f249d7c20158ae703e1accddd4ea899f026618695ed2949715678a32a153df32c08922fafad68b1895e3b10e143e712940104b3b352369f4fe79bd1f1dbe03ea9909dbcf5862d1f15b3d1557a6191f54c891513cdb3c729bb9ab08c0d4c35a3ed67d517ffe1e2b7a798521aed15ff9822169c0ec860d7b897340bc2ef4c37f7eb73bd7dafef12c4fd4e6f5dd3690305257ae14ed03df5e3327b68467775a90993e613173fa6650ffa2a26e84b3ce79606bf234eda9f4053307f344099e3b10308d3785b8726fd02d8e94c2759bebd05748c3fe7d5fe087dc63608fb77f29708ab167a13f32da251e249a544124ed50c270cfc6986d9d1814273d2f0510d0d2ea335817207db6a4a23ae9b079967b63b25cb3ceea7001b65b879263f5009ac84ab89738a5b8b71fd032beb9f297326f1f5afa630a5198d684514e242f315a4d95fa6802e82799a525bb653b80b4518ec610a5996403b1391"); | |
bd006110 | 192 | consensus.hashGenesisBlock = genesis.GetHash(); |
66f07f5d | 193 | assert(consensus.hashGenesisBlock == uint256S("0x0cdf00b25a93ded11d73ebe1728cf7867f18e1f62aca9554b95e0f3026174e33")); |
0e4b3175 MH |
194 | |
195 | vFixedSeeds.clear(); | |
196 | vSeeds.clear(); | |
9fc324a1 | 197 | vSeeds.push_back(CDNSSeedData("z.cash", "dnsseed.testnet.z.cash")); // Zcash |
0e4b3175 | 198 | |
a2b04ddf CF |
199 | base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111); |
200 | base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196); | |
201 | base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239); | |
202 | base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >(); | |
203 | base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >(); | |
13039c53 | 204 | base58Prefixes[ZCPAYMENT_ADDRRESS] = {20,81}; |
05a6d19a | 205 | base58Prefixes[ZCSPENDING_KEY] = {177,235}; |
21913a9a | 206 | |
739d6155 | 207 | vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); |
a60120e9 | 208 | |
c8c52de3 | 209 | fRequireRPCPassword = true; |
210 | fMiningRequiresPeers = true; | |
3fcfbc8a | 211 | fDefaultConsistencyChecks = false; |
c8c52de3 | 212 | fRequireStandard = false; |
c8c52de3 | 213 | fMineBlocksOnDemand = false; |
cc972107 | 214 | fTestnetToBeDeprecatedFieldRPC = true; |
69968230 CF |
215 | |
216 | checkpointData = (Checkpoints::CCheckpointData) { | |
217 | boost::assign::map_list_of | |
9144ea8c SB |
218 | ( 0, consensus.hashGenesisBlock), |
219 | genesis.nTime, | |
220 | 0, | |
221 | 0 | |
69968230 CF |
222 | }; |
223 | ||
db0f9315 S |
224 | // Founders reward script expects a vector of 2-of-3 multisig addresses |
225 | vFoundersRewardAddress = { | |
226 | "2N2e2FRfP9D1dRN1oRWkH7pbFM69eGNAuQ4", "2NBW8WsA2jUussoJbRv82UXH1BYopkjYqcd", "2N1MudZmwDFTcYiLCZfrcsnhHwaSTTigbcN", "2MxfUJXWKz9D8X3mcMpVcdEJKdJ6zFukca9", | |
227 | "2N8iUwMCpU16VYpKQ1HRM6xfut5FZwGwieM", "2N9hyafTvJVrykBvZDw79j1brozwZNySwPP", "2NFx7tRozsp3kT1M4w4tL9FfnEj8RovzbzN", "2NAqoH96V1RtmK72LEZpJNX1uxhJ5yejRiK", | |
228 | "2MyV7hoV28KS8Uam2Z8nzY3xeo7R3T3TLUr", "2N8Tn19hMoCD4EmCwpg1V8qupVkQLVVPhav", "2NA5UeJU9zAQkSMyy3xpDcjfp4CEyKfzXKp", "2NBERNyXy46CfM9yewGeof4yzC3vkwYnhgS", | |
229 | "2N7fnpAswHb4mnPm2ZjWX3eKkF8hABAYBtQ", "2N9MXGsz7uYaY5ciax6tSMDG7sjZUoLhJTC", "2N5PwzPQFFmLut2XWGQWAmpwKsF8VzUoPtr", "2MvZdDpNP8hWyEqg6zKW9B62YTJqcUwjHr5", | |
230 | "2Mx4KfKJ37EDc3A43Frzof1iEjSe91JUX7d", "2NBMSdXjZ7YqREmwxEtgGryY59KBpqMSs1d", "2N9RbfE4ZCJ3Nx68vPfmvH2M6Q3qicJhagb", "2N4xwfFkFj4DR4NWNbynzP2aJmVcEFnA2DB", | |
231 | "2Mx4TyAwedmsRuDkvMNYGqrcCZfQTfCvxAp", "2Mx4HSVsxEqXjLxn8igJzmCrFdG9XhnNvtf", "2MtLM4SP7LJbBZ5rA5ZG8kAVz9UNrNKuoFB", "2N7SPq83Cbmwuwv5rjNBzVd9QtJKAxxKj8M", | |
232 | "2MwYkbE4U4p9XBsCrupDDkdcDH9L9xvc9Bn", "2MyaeCHpVmckokUi67YP1QK9L3Dkx3Pt86F", "2N7URNgBPXGjqnuPHiynCa6qMMhKm6YEaHr", "2N2eNwGVwj4WwbEdJg7YZDgrnYvDv1ZSNbB", | |
233 | "2MuWAG6BqLM1mtZc67Fv1aKgGwkNQ2akDGt", "2N7XH82MbGwpzbc7PM2aK5CU14bSJvK7Etz", "2MuPX8Ke5TvDDQ1nkqpaPMgYWPyWbFp18Jn", "2NFBST7oK9yw9PaXaq5QhdyYwp5HpHz9m81", | |
234 | "2MuSeMBUrttbjvDZAeQjTrrDeoP197qj2kG", "2N6JU8JNGGAUFknTCuLSuDEEhZJqMfFsH88", "2N4P2MrwtwbiHymQm1RASoVoiH3sFrBpmXa", "2MyhFiVXvVVxUNc8Qh9ppV7jG4NsKpnxige", | |
235 | "2N5dLXUho2GtjuHMWuqixLrHLCwUMcYxd7s", "2N9NhfSiYBt3fhETFR6mQc3uxreEy7simSg", "2NBEEWPY3v38uuC7n1tMtviEY7ND2XzfgSG", "2NCWWj6oREJiMmfJ2bV5sbm1xchMwQfAZ5r", | |
236 | "2N4ACsVCKMvJmtEb3Pd3xkqhJ3rLT4mYx1r", "2MtmMdabcwRJmenswaYtWA675df854KhUxD", "2N2h27Dd87eiGcm7ajvu4hJpXjTm9GkzvLZ", "2NGE19agRXU1EAK3PCLZWXERkpqyUexhk9r", | |
237 | "2N63112wMnBsXTaBFjbCTjW9LuyTXQmvEdw", "2NBkHxgkYZbU56zsoLNsP5WZVfMtBK6X8WK", "2N5pK7NfKo6d9qBmsKggpwuvQeMxGf65SLH", "2N5jHzgCg9a9uAcLaT2jij8WKTZzWbVNC5c", | |
238 | }; | |
239 | assert(vFoundersRewardAddress.size() < consensus.nSubsidyHalvingInterval + consensus.SubsidySlowStartShift()); | |
e11712df | 240 | } |
0e4b3175 MH |
241 | }; |
242 | static CTestNetParams testNetParams; | |
243 | ||
f2e03ffa MF |
244 | /** |
245 | * Regression test | |
246 | */ | |
0e4b3175 MH |
247 | class CRegTestParams : public CTestNetParams { |
248 | public: | |
249 | CRegTestParams() { | |
f5ae6c98 | 250 | strNetworkID = "regtest"; |
a180d0a6 | 251 | consensus.fCoinbaseMustBeProtected = false; |
7a1f5518 | 252 | consensus.nSubsidySlowStartInterval = 0; |
bd006110 JT |
253 | consensus.nSubsidyHalvingInterval = 150; |
254 | consensus.nMajorityEnforceBlockUpgrade = 750; | |
255 | consensus.nMajorityRejectBlockOutdated = 950; | |
256 | consensus.nMajorityWindow = 1000; | |
3e24a533 JG |
257 | consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f"); |
258 | assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow); | |
f2c48e15 JG |
259 | consensus.nPowMaxAdjustDown = 0; // Turn off adjustment down |
260 | consensus.nPowMaxAdjustUp = 0; // Turn off adjustment up | |
62fdd8d0 SB |
261 | pchMessageStart[0] = 0xaa; |
262 | pchMessageStart[1] = 0xe8; | |
263 | pchMessageStart[2] = 0x3f; | |
264 | pchMessageStart[3] = 0x5f; | |
2595b9ac | 265 | nMinerThreads = 1; |
33d6825c | 266 | nMaxTipAge = 24 * 60 * 60; |
c6a7e897 DH |
267 | const size_t N = 48, K = 5; |
268 | BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K)); | |
269 | nEquihashN = N; | |
270 | nEquihashK = K; | |
0e4b3175 | 271 | genesis.nTime = 1296688602; |
66f07f5d JG |
272 | genesis.nBits = 0x200f0f0f; |
273 | genesis.nNonce = uint256S("0x0000000000000000000000000000000000000000000000000000000000000021"); | |
274 | genesis.nSolution = ParseHex("0f2a976db4c4263da10fd5d38eb1790469cf19bdb4bf93450e09a72fdff17a3454326399"); | |
bd006110 | 275 | consensus.hashGenesisBlock = genesis.GetHash(); |
0e4b3175 | 276 | nDefaultPort = 18444; |
66f07f5d | 277 | assert(consensus.hashGenesisBlock == uint256S("0x00a215b4fe36f5d2f829d43e587bf10e89e64f9f48a5b6ce18559089e8fd643d")); |
f9ec3f0f | 278 | nPruneAfterHeight = 1000; |
0e4b3175 | 279 | |
f2e03ffa MF |
280 | vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds. |
281 | vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds. | |
0e4b3175 | 282 | |
c8c52de3 | 283 | fRequireRPCPassword = false; |
284 | fMiningRequiresPeers = false; | |
3fcfbc8a | 285 | fDefaultConsistencyChecks = true; |
c8c52de3 | 286 | fRequireStandard = false; |
c8c52de3 | 287 | fMineBlocksOnDemand = true; |
cc972107 | 288 | fTestnetToBeDeprecatedFieldRPC = false; |
69968230 CF |
289 | |
290 | checkpointData = (Checkpoints::CCheckpointData){ | |
291 | boost::assign::map_list_of | |
292 | ( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")), | |
293 | 0, | |
294 | 0, | |
295 | 0 | |
296 | }; | |
db0f9315 S |
297 | |
298 | // Founders reward script expects a vector of 2-of-3 multisig addresses | |
299 | vFoundersRewardAddress = { "2N2e2FRfP9D1dRN1oRWkH7pbFM69eGNAuQ4" }; | |
300 | assert(vFoundersRewardAddress.size() < consensus.nSubsidyHalvingInterval + consensus.SubsidySlowStartShift()); | |
e11712df | 301 | } |
0e4b3175 MH |
302 | }; |
303 | static CRegTestParams regTestParams; | |
304 | ||
84ce18ca | 305 | static CChainParams *pCurrentParams = 0; |
0e4b3175 MH |
306 | |
307 | const CChainParams &Params() { | |
84ce18ca | 308 | assert(pCurrentParams); |
0e4b3175 MH |
309 | return *pCurrentParams; |
310 | } | |
311 | ||
e84843c0 | 312 | CChainParams &Params(CBaseChainParams::Network network) { |
0e4b3175 | 313 | switch (network) { |
84ce18ca | 314 | case CBaseChainParams::MAIN: |
e84843c0 | 315 | return mainParams; |
84ce18ca | 316 | case CBaseChainParams::TESTNET: |
e84843c0 | 317 | return testNetParams; |
84ce18ca | 318 | case CBaseChainParams::REGTEST: |
e84843c0 | 319 | return regTestParams; |
0e4b3175 MH |
320 | default: |
321 | assert(false && "Unimplemented network"); | |
e84843c0 | 322 | return mainParams; |
0e4b3175 MH |
323 | } |
324 | } | |
325 | ||
e84843c0 RN |
326 | void SelectParams(CBaseChainParams::Network network) { |
327 | SelectBaseParams(network); | |
328 | pCurrentParams = &Params(network); | |
329 | } | |
330 | ||
ca3ce0fa | 331 | bool SelectParamsFromCommandLine() |
3fdb9e8c | 332 | { |
b796cb08 | 333 | CBaseChainParams::Network network = NetworkIdFromCommandLine(); |
3fdb9e8c | 334 | if (network == CBaseChainParams::MAX_NETWORK_TYPES) |
0e4b3175 | 335 | return false; |
0e4b3175 | 336 | |
3fdb9e8c | 337 | SelectParams(network); |
0e4b3175 MH |
338 | return true; |
339 | } | |
db0f9315 S |
340 | |
341 | ||
342 | // Block height must be >0 and <=last founders reward block height | |
343 | // Index variable i ranges from 0 - (vFoundersRewardAddress.size()-1) | |
241867b1 | 344 | std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const { |
db0f9315 | 345 | int maxHeight = consensus.GetLastFoundersRewardBlockHeight(); |
241867b1 | 346 | assert(nHeight > 0 && nHeight <= maxHeight); |
db0f9315 | 347 | |
3b30d836 S |
348 | size_t addressChangeInterval = (maxHeight + vFoundersRewardAddress.size()) / vFoundersRewardAddress.size(); |
349 | size_t i = nHeight / addressChangeInterval; | |
db0f9315 S |
350 | return vFoundersRewardAddress[i]; |
351 | } | |
352 | ||
353 | // Block height must be >0 and <=last founders reward block height | |
354 | // The founders reward address is expected to be a multisig (P2SH) address | |
241867b1 | 355 | CScript CChainParams::GetFoundersRewardScriptAtHeight(int nHeight) const { |
db0f9315 S |
356 | assert(nHeight > 0 && nHeight <= consensus.GetLastFoundersRewardBlockHeight()); |
357 | ||
3b30d836 | 358 | CBitcoinAddress address(GetFoundersRewardAddressAtHeight(nHeight).c_str()); |
db0f9315 S |
359 | assert(address.IsValid()); |
360 | assert(address.IsScript()); | |
361 | CScriptID scriptID = get<CScriptID>(address.Get()); // Get() returns a boost variant | |
362 | CScript script = CScript() << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL; | |
363 | return script; | |
364 | } | |
3b30d836 S |
365 | |
366 | std::string CChainParams::GetFoundersRewardAddressAtIndex(int i) const { | |
241867b1 | 367 | assert(i >= 0 && i < vFoundersRewardAddress.size()); |
3b30d836 S |
368 | return vFoundersRewardAddress[i]; |
369 | } |