]> Git Repo - VerusCoin.git/blob - src/chainparams.cpp
Auto merge of #1427 - bitcartel:master_1345_getbalance, r=bitcartel
[VerusCoin.git] / src / chainparams.cpp
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6 #include "main.h"
7 #include "crypto/equihash.h"
8
9 #include "util.h"
10 #include "utilstrencodings.h"
11
12 #include <assert.h>
13
14 #include <boost/assign/list_of.hpp>
15
16 #include "base58.h"
17
18 using namespace std;
19
20 #include "chainparamsseeds.h"
21
22 /**
23  * Main network
24  */
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  */
32
33 const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
34
35 class CMainParams : public CChainParams {
36 public:
37     CMainParams() {
38         strNetworkID = "main";
39         consensus.fCoinbaseMustBeProtected = true;
40         consensus.nSubsidySlowStartInterval = 20000;
41         consensus.nSubsidyHalvingInterval = 840000;
42         consensus.nMajorityEnforceBlockUpgrade = 750;
43         consensus.nMajorityRejectBlockOutdated = 950;
44         consensus.nMajorityWindow = 4000;
45         // TODO generate harder genesis block
46         //consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
47         consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
48         consensus.nPowAveragingWindow = 17;
49         assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
50         consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
51         consensus.nPowMaxAdjustUp = 16; // 16% adjustment up
52         consensus.nPowTargetSpacing = 2.5 * 60;
53         consensus.fPowAllowMinDifficultyBlocks = false;
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
57          * a large 32-bit integer with any alignment.
58          */
59         pchMessageStart[0] = 0x9f;
60         pchMessageStart[1] = 0xee;
61         pchMessageStart[2] = 0x4e;
62         pchMessageStart[3] = 0xd8;
63         vAlertPubKey = ParseHex("04b7ecf0baa90495ceb4e4090f6b2fd37eec1e9c85fac68a487f3ce11589692e4a317479316ee814e066638e1db54e37a10689b70286e6315b1087b6615d179264");
64         nDefaultPort = 8233;
65         nMinerThreads = 0;
66         nMaxTipAge = 24 * 60 * 60;
67         nPruneAfterHeight = 100000;
68         const size_t N = 200, K = 9;
69         BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
70         nEquihashN = N;
71         nEquihashK = K;
72
73         /**
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          *
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          */
84         const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
85         CMutableTransaction txNew;
86         txNew.vin.resize(1);
87         txNew.vout.resize(1);
88         txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
89         txNew.vout[0].nValue = 50 * COIN;
90         txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
91         genesis.vtx.push_back(txNew);
92         genesis.hashPrevBlock.SetNull();
93         genesis.hashMerkleRoot = genesis.BuildMerkleTree();
94         genesis.nVersion = 1;
95         genesis.nTime    = 1231006505;
96         // TODO generate harder genesis block
97         //genesis.nBits    = 0x1d00ffff;
98         genesis.nBits    = 0x200f0f0f;
99         genesis.nNonce   = uint256S("0x000000000000000000000000000000000000000000000000000000000000000b");
100         genesis.nSolution = ParseHex("000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2");
101
102         consensus.hashGenesisBlock = genesis.GetHash();
103         assert(consensus.hashGenesisBlock == uint256S("0x027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71"));
104         assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
105
106         vFixedSeeds.clear();
107         vSeeds.clear();
108         // TODO: set up bootstrapping for mainnet
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
115
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> >();
121         // guarantees the first two characters, when base58 encoded, are "zc"
122         base58Prefixes[ZCPAYMENT_ADDRRESS] = {22,154};
123         // guarantees the first two characters, when base58 encoded, are "SK"
124         base58Prefixes[ZCSPENDING_KEY] = {171,54};
125
126         vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
127
128         fRequireRPCPassword = true;
129         fMiningRequiresPeers = true;
130         fDefaultConsistencyChecks = false;
131         fRequireStandard = true;
132         fMineBlocksOnDemand = false;
133         fTestnetToBeDeprecatedFieldRPC = false;
134
135         checkpointData = (Checkpoints::CCheckpointData) {
136             boost::assign::map_list_of
137             ( 0, consensus.hashGenesisBlock),
138             genesis.nTime, // * UNIX timestamp of last checkpoint block
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
142         };
143
144         // Founders reward script expects a vector of 2-of-3 multisig addresses
145         vFoundersRewardAddress = {
146             "37dSC2gL2SftgVJBHemBfWtSsNwuNfeTkz", "3KENXyYPCx4SZPGqE2Qp64Vrt49JNxvCbH", "3B2t3k6oQBACSmZArbYiseYsbsxBFFsHXG", "3QuE4MQXQwuzynXJwLPuWaciKjmRqkj9Yg",
147             "3FGDxAMPbjgq2ZTSFdoeWTHUu8i3nZcENb", "3HMUFCvai1KtyJ3woLXyY5dGTWjBwmD3M2", "3Mqskxz8RexngVRBkZnGVCLp1Z7wyqFjVE", "359NbXKBNezXEUqvU1cqJkfdZTHbzfsQfV",
148             "3KGJQmUe7zjMFkTGskiBH6JBNuymJRzU3a", "36PjhjMcMkU9kjgvCocAke5VSF6JzKXuqZ", "35fucu9Bh1AKad9zMvDgDhc3kmoj6ZcFNV", "35EnKe4u16128G6j1efUT27Vwqha6MgWDH",
149             "3FWa1GEjWWY3eFuFK8ht2HBhH8ZT1zXJcR", "3ByiCPMp3vNYjq1fQrQx2LXbMJ3uyiUfH6", "3DNWVawdGNJJ3sp9aMgyjtFv74rPivPUcM", "3HKAkRbUbUTV2vs1qSoEbhpoUAjNAmGxrm",
150             "3CV41uQT2B6FU8H57rAh22d4wyDG8FrK37", "361jTn1yhDRHji9qMrwq8p2qbSxrEfcf58", "3A4hTEi36fQdvTczkiNESqdtoADRFEUGdr", "36LBGQ4CNWRtEVxdRk8Lym52rFqRx5aAy9",
151             "34Hvy7rqUToVzQKu6v6gN69Qo1M37ktKpZ", "3Qii1z7vD5EFpGx3yFAqDBLQ9kCdfpxwpC", "3HNSu7ibS7yu4FW3Sf2D36Ms8BKDhBTPQo", "36djsWiivpZwPC4eZqMAFoS87VgxkjDHen",
152             "3E7dsoe6eJavv6HEwADC7eV2JjHXZE8wx4", "3Ks5EBz94K2TgAx19vxvwX6A2cUf1AWNfJ", "3GuGkVkqD1k9wYJNikNhMxK8ci8HGnJ3HN", "3QPjeeX5FFwEbDk8RHDXCPunsgHp9YLXsV",
153             "3MY2DeyRPJaUKZwpKTGsT31vZMLtVk66FP", "36f92vZ3jo3TYBXVGv55BptKmL2MDL47ZF", "3DDUDXN3aSgXckFnTdFTV1t8HjkifNKbJM", "3ArUZmHERS6CDyNYb1DhnCZ7XCCoWEURAb",
154             "3QnJ98YuZcVZhxs49kwwDmf5BUYPbjvKRQ", "3DNdji6oCCTVbLF4iuzamAv73MGQ9LsKNb", "3Q5cGqEzkBLMac8DNSdVesZPUcucFP3jqU", "3JuQnoHp6Qm9N39ETD4yRHhj1CCKXo3deG",
155             "3EQftBB2MsZ4wNgGxKfhMREU3hNk29VZeW", "38baEewZky2kRaMSvjxh2x3eDdHt1ovVnu", "32kq15rjjtjaj1Z5dW8N6DikKxBeEbCZ5B", "34tta8VkpCZFNZyM9oWf656QcNwDB2qoRV",
156             "33nGWUV4nKjAM7XWYNTf5Fe6aBahCe22RN", "36tt5b1MDeYks6N7Zhk5gDs3sNZjkh4mG7", "32eS4cHrpJv7MkGQzkA7KwYZuNCvbpCzm4", "39Wqmd6f23mFWsMurx9d9YbaHxyEmXpw4G",
157             "32x1txo29hfy6fm5kMryX2175qz7ocU8iz", "3KR3wPnecQgpndUGAdwWCfehbEES4DES3C", "3HBPRij6s8Thv2AnRytLEZ9pW6Wqoztcr6", "3N3BPLx8rHfEdqPnEWuguYfAXtDXc8sK53",
158         };
159         assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
160     }
161 };
162 static CMainParams mainParams;
163
164 /**
165  * Testnet (v3)
166  */
167 class CTestNetParams : public CMainParams {
168 public:
169     CTestNetParams() {
170         strNetworkID = "test";
171         consensus.nMajorityEnforceBlockUpgrade = 51;
172         consensus.nMajorityRejectBlockOutdated = 75;
173         consensus.nMajorityWindow = 400;
174         consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
175         assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
176         consensus.fPowAllowMinDifficultyBlocks = true;
177         pchMessageStart[0] = 0xA5;
178         pchMessageStart[1] = 0xF1;
179         pchMessageStart[2] = 0xE7;
180         pchMessageStart[3] = 0x26;
181         vAlertPubKey = ParseHex("044e7a1553392325c871c5ace5d6ad73501c66f4c185d6b0453cf45dec5a1322e705c672ac1a27ef7cdaf588c10effdf50ed5f95f85f2f54a5f6159fca394ed0c6");
182         nDefaultPort = 18233;
183         nMinerThreads = 0;
184         nMaxTipAge = 0x7fffffff;
185         nPruneAfterHeight = 1000;
186
187         //! Modify the testnet genesis block so the timestamp is valid for a later start.
188         genesis.nTime = 1296688602;
189         genesis.nBits = 0x200f0f0f;
190         genesis.nNonce = uint256S("0x0000000000000000000000000000000000000000000000000000000000000009");
191         genesis.nSolution = ParseHex("003423da3e41f916bf3ff0ee770eb844a240361abe08a8c9d46bd30226e2ad411a4047b6ddc230d173c60537e470e24f764120f5a2778b2a1285b0727bf79a0b085ad67e6266fb38fd72ef17f827315c42f921720248c983d4100e6ebd1c4b5e8762a973bac3bec7f7153b93752ebbb465f0fc9520bcfc30f9abfe303627338fed6ede9cf1b9173a736cf270cf4d9c6999ff4c3a301a78fd50dab6ccca67a0c5c2e41f216a1f3efd049a74bbe6252f9773bc309d3f9e554d996913ce8e1cec672a1fa4ea59726b61ea9e75d5ce9aa5dbfa96179a293810e02787f26de324fe7c88376ff57e29574a55faff7c2946f3e40e451861c32bf67da7377de3136858a18f34fab1bc8da37726ca2c25fc7b312a5427554ec944da81c7e27255d6c94ade9987ff7daedc2d1cc63d7d4cf93e691d13326fb1c7ee72ccdc0b134eb665fc6a9821e6fef6a6d45e4aac6dca6b505a0100ad56ea4f6fa4cdc2f0d1b65f730104a515172e34163bdb422f99d083e6eb860cf6b3f66642c4dbaf0d0fa1dca1b6166f1d1ffaa55a9d6d6df628afbdd14f1622c1c8303259299521a253bc28fcc93676723158067270fc710a09155a1e50c533e9b79ed5edba4ab70a08a9a2fc0eef0ddae050d75776a9804f8d6ad7e30ccb66c6a98d86710ca7a4dfb4feb159484796b9a015c5764aa3509051c87f729b9877ea41f8b470898c01388ed9098b1e006d3c30fc6e7c781072fa3f75d918505ee8ca75840fc62f67c57060666aa42578a2dd022eda62e3f1e447d7364074d34fd60ad9b138f60422afa6cfcb913fd6c213b496144dbfda7bfc7c24540cfe40ad0c0fd5a8c0902127f53d3178ba1b2a87bf1224d53d3a15e49ccdf121ae872a011c996d1b9793153cdcd4c0a7e99f8a35669788551cca2b62769eda24b6b55e2f4e0ac0d30aa50ecf33c6cdb24adfc922006a7bf434ced800fefe814c94c6fc8caa37b372d5088bb31d2f6b11a7a67ad3f70abbac0d5c256b637828de6cc525978cf151a2e50798e0c591787639a030291272c9ced3ab7d682e03f8c7db51f60163baa85315789666ea8c5cd6f789a7f4a5de4f8a9dfefce20f353cec606492fde8eab3e3b487b3a3a57434f8cf252a4b643fc125c8a5948b06744f5dc306aa587bdc85364c7488235c6edddd78763675e50a9637181519be06dd30c4ba0d845f9ba320d01706fd6dd64d1aa3cd4211a4a7d1d3f2c1ef2766d27d5d2cdf8e7f5e3ea309d4f149bb737305df1373a7f5313abe5986f4aa620bec4b0065d48aafac3631de3771f5c4d2f6eec67b09d9c70a3c1969fecdb014cb3c69832b63cc9d6efa378bff0ef95ffacdeb1675bb326e698f022c1a3a2e1c2b0f05e1492a6d2b7552388eca7ee8a2467ef5d4207f65d4e2ae7e33f13eb473954f249d7c20158ae703e1accddd4ea899f026618695ed2949715678a32a153df32c08922fafad68b1895e3b10e143e712940104b3b352369f4fe79bd1f1dbe03ea9909dbcf5862d1f15b3d1557a6191f54c891513cdb3c729bb9ab08c0d4c35a3ed67d517ffe1e2b7a798521aed15ff9822169c0ec860d7b897340bc2ef4c37f7eb73bd7dafef12c4fd4e6f5dd3690305257ae14ed03df5e3327b68467775a90993e613173fa6650ffa2a26e84b3ce79606bf234eda9f4053307f344099e3b10308d3785b8726fd02d8e94c2759bebd05748c3fe7d5fe087dc63608fb77f29708ab167a13f32da251e249a544124ed50c270cfc6986d9d1814273d2f0510d0d2ea335817207db6a4a23ae9b079967b63b25cb3ceea7001b65b879263f5009ac84ab89738a5b8b71fd032beb9f297326f1f5afa630a5198d684514e242f315a4d95fa6802e82799a525bb653b80b4518ec610a5996403b1391");
192         consensus.hashGenesisBlock = genesis.GetHash();
193         assert(consensus.hashGenesisBlock == uint256S("0x0cdf00b25a93ded11d73ebe1728cf7867f18e1f62aca9554b95e0f3026174e33"));
194
195         vFixedSeeds.clear();
196         vSeeds.clear();
197         vSeeds.push_back(CDNSSeedData("z.cash", "dnsseed.testnet.z.cash")); // Zcash
198
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> >();
204         base58Prefixes[ZCPAYMENT_ADDRRESS] = {20,81};
205         base58Prefixes[ZCSPENDING_KEY] = {177,235};
206
207         vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
208
209         fRequireRPCPassword = true;
210         fMiningRequiresPeers = true;
211         fDefaultConsistencyChecks = false;
212         fRequireStandard = false;
213         fMineBlocksOnDemand = false;
214         fTestnetToBeDeprecatedFieldRPC = true;
215
216         checkpointData = (Checkpoints::CCheckpointData) {
217             boost::assign::map_list_of
218             ( 0, consensus.hashGenesisBlock),
219             genesis.nTime,
220             0,
221             0
222         };
223
224         // Founders reward script expects a vector of 2-of-3 multisig addresses
225         vFoundersRewardAddress = {
226             "2NF5QVDMtYBHaUzPLTxirybjwPjm9wVwacv", "2N8qoHsvVvdrDc89dXjpBWZHMbWdaHVc3rg", "2N8xpkGmATvu1GjgpjSjmt5L5V5fnEhW89v", "2MtTJnZRWNKJtmr5NN5jnjL9hTqP6tFBuLE",
227             "2N3Jbuca4yhcqMCa36w5Jy9NdLf7Te2BBZr", "2NAkLyEyxv1y1tvE3LawvaFXZ12GKDyXc9K", "2NEA5WxHJfpFWijWuJLwyjNmNYAKSdBFrFt", "2N68WRnm7HJYZRBL7XtqRJVQD7dCJtQx4Vg",
228             "2NAieMb6ZfC2RJ6c19Ch4JER6yqgRAd1CeG", "2Mvw6JtXth8cYPHxD2DGwF2fzL6C5g66w6w", "2N3treWEan8WhpKurCNTdsgh6JtTD8hLMEY", "2N46cPyaEBFb1MxHJWdtXKhfRjKWhoAF2VY",
229             "2N2hFwZYHvKCjqVJHCYwpy6FaBycyjcKaHB", "2N3wQ8GyAbtb4FXgymzK99ZUDdrdDVQBGNx", "2N2tq2AcVroDciF5H3WpkHraUiK6eZZgJqR", "2N6g8Q9Z6mZwQzTw1s5KoSaVTKYxBVDMeqc",
230             "2NFfPnK3jj85sn9mWe5EivUdnUPykMRXGp6", "2MwC4NhXRQSZzN9cfeg88Cdsp6DiXn2Axt9", "2MsTXMg8TBfKQvj7UJfMXKp3naKYv9ty3jv", "2MzPMV6sPt45J2qU1Uvft2U1ES1q9Cnw74J",
231             "2NEo5vX2Gvg83FbSUTfndQqkZbFHd1zJnZz", "2Mtkiihqt6wTV5uwvdmf9nTZKgEzZx6BMXB", "2MvM6urpNbfS2QFPFeUEoM14VKgBKoV8Qws", "2Mv3FDtDtyiHQA6u6kDWoiBKDkL5JFuA4Se",
232             "2MtyHB5chweTMBXXVPqSLAWHF6fgajGisi6", "2N3BU59PLVRWmPvffumGNWJdorY8ex5NKHq", "2NEiq16k9nQzYxWL1mvJVN32ticcL3b65vW", "2NB1groo8MTEAvPDbgcmzHsr56rSpbmXj48",
233             "2MwMr9dW3hrkgsmpWivobrwScfXC8hFsg4N", "2My9qRCuUBJ9aZohh8f4VQoXvBgmP9pBE11", "2MyHm9yFdm3aou91PLWzEVDeWrcrC5re4GS", "2N73XvH7vdzKr7UGHFkAeAUJFz4o8zTFeZY",
234             "2MwPLTmV6469VBcDxcsnotq4Qbf8CRX7DWz", "2MtmeB8wEGepSRodY7sq7myZVmFsBWAXYpW", "2N1WmRvcqMomQGePwvkd5QrKXQuYePDZh9Z", "2MwuBXGGBAPK2TupdoQK2Fw63vitJb7RUJZ",
235             "2Mz4XXqLy2TC5bmBczjakVeqajFo5D3jma2", "2NB19923xi5D9MPqZZvkvH5VbQ2MNRfW9e2", "2NBKhC9RJPPxA8B8bdPvvYvGGjkSoTfdrKh", "2Mzn2q4ZmReBsSQFHRscXav4Xt44wXWeo9a",
236             "2N1BqHdQV1r6NBeF3bbj3rE1by3MPrwgbbb", "2N6VpEUSwCvh1FCuVKb9eZCxcFnZuzcxB6f", "2N2Uq4i7DYaq2ngJZi4eXf9DAXuDYCDKMzc", "2MwsKBtaZeVKzD51otkAyBDoeuaDDK8wgqe",
237             "2NCajs4c2PeW8pWZxyMUiV3rDkEYyYnRAhQ", "2MuGtcBJQLfJD6GFbXy7iTtG8QasgZ8qd3Y", "2NFZ3yjeBSS3FKMy1N1zTeSEyqiRgnH35v4", "2Mvv8o9U4dbJjgWPvLDy3L6Sh74Wmynf36q",
238         };
239         assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
240     }
241 };
242 static CTestNetParams testNetParams;
243
244 /**
245  * Regression test
246  */
247 class CRegTestParams : public CTestNetParams {
248 public:
249     CRegTestParams() {
250         strNetworkID = "regtest";
251         consensus.fCoinbaseMustBeProtected = false;
252         consensus.nSubsidySlowStartInterval = 0;
253         consensus.nSubsidyHalvingInterval = 150;
254         consensus.nMajorityEnforceBlockUpgrade = 750;
255         consensus.nMajorityRejectBlockOutdated = 950;
256         consensus.nMajorityWindow = 1000;
257         consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
258         assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
259         consensus.nPowMaxAdjustDown = 0; // Turn off adjustment down
260         consensus.nPowMaxAdjustUp = 0; // Turn off adjustment up
261         pchMessageStart[0] = 0xaa;
262         pchMessageStart[1] = 0xe8;
263         pchMessageStart[2] = 0x3f;
264         pchMessageStart[3] = 0x5f;
265         nMinerThreads = 1;
266         nMaxTipAge = 24 * 60 * 60;
267         const size_t N = 48, K = 5;
268         BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
269         nEquihashN = N;
270         nEquihashK = K;
271         genesis.nTime = 1296688602;
272         genesis.nBits = 0x200f0f0f;
273         genesis.nNonce = uint256S("0x0000000000000000000000000000000000000000000000000000000000000021");
274         genesis.nSolution = ParseHex("0f2a976db4c4263da10fd5d38eb1790469cf19bdb4bf93450e09a72fdff17a3454326399");
275         consensus.hashGenesisBlock = genesis.GetHash();
276         nDefaultPort = 18444;
277         assert(consensus.hashGenesisBlock == uint256S("0x00a215b4fe36f5d2f829d43e587bf10e89e64f9f48a5b6ce18559089e8fd643d"));
278         nPruneAfterHeight = 1000;
279
280         vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
281         vSeeds.clear();  //! Regtest mode doesn't have any DNS seeds.
282
283         fRequireRPCPassword = false;
284         fMiningRequiresPeers = false;
285         fDefaultConsistencyChecks = true;
286         fRequireStandard = false;
287         fMineBlocksOnDemand = true;
288         fTestnetToBeDeprecatedFieldRPC = false;
289
290         checkpointData = (Checkpoints::CCheckpointData){
291             boost::assign::map_list_of
292             ( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
293             0,
294             0,
295             0
296         };
297
298         // Founders reward script expects a vector of 2-of-3 multisig addresses
299         vFoundersRewardAddress = { "2N2e2FRfP9D1dRN1oRWkH7pbFM69eGNAuQ4" };
300         assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
301     }
302 };
303 static CRegTestParams regTestParams;
304
305 static CChainParams *pCurrentParams = 0;
306
307 const CChainParams &Params() {
308     assert(pCurrentParams);
309     return *pCurrentParams;
310 }
311
312 CChainParams &Params(CBaseChainParams::Network network) {
313     switch (network) {
314         case CBaseChainParams::MAIN:
315             return mainParams;
316         case CBaseChainParams::TESTNET:
317             return testNetParams;
318         case CBaseChainParams::REGTEST:
319             return regTestParams;
320         default:
321             assert(false && "Unimplemented network");
322             return mainParams;
323     }
324 }
325
326 void SelectParams(CBaseChainParams::Network network) {
327     SelectBaseParams(network);
328     pCurrentParams = &Params(network);
329 }
330
331 bool SelectParamsFromCommandLine()
332 {
333     CBaseChainParams::Network network = NetworkIdFromCommandLine();
334     if (network == CBaseChainParams::MAX_NETWORK_TYPES)
335         return false;
336
337     SelectParams(network);
338     return true;
339 }
340
341
342 // Block height must be >0 and <=last founders reward block height
343 // Index variable i ranges from 0 - (vFoundersRewardAddress.size()-1)
344 std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const {
345     int maxHeight = consensus.GetLastFoundersRewardBlockHeight();
346     assert(nHeight > 0 && nHeight <= maxHeight);
347
348     size_t addressChangeInterval = (maxHeight + vFoundersRewardAddress.size()) / vFoundersRewardAddress.size();
349     size_t i = nHeight / addressChangeInterval;
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
355 CScript CChainParams::GetFoundersRewardScriptAtHeight(int nHeight) const {
356     assert(nHeight > 0 && nHeight <= consensus.GetLastFoundersRewardBlockHeight());
357
358     // #1398 START
359     // We can remove this code when miner_tests no longer expect this script
360     if (fMinerTestModeForFoundersRewardScript) {
361         auto rewardScript = ParseHex("a9146708e6670db0b950dac68031025cc5b63213a49187");
362         return CScript(rewardScript.begin(), rewardScript.end());
363     }
364     // #1398 END
365
366     CBitcoinAddress address(GetFoundersRewardAddressAtHeight(nHeight).c_str());
367     assert(address.IsValid());
368     assert(address.IsScript());
369     CScriptID scriptID = get<CScriptID>(address.Get()); // Get() returns a boost variant
370     CScript script = CScript() << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL;
371     return script;
372 }
373
374 std::string CChainParams::GetFoundersRewardAddressAtIndex(int i) const {
375     assert(i >= 0 && i < vFoundersRewardAddress.size());
376     return vFoundersRewardAddress[i];
377 }
This page took 0.085257 seconds and 4 git commands to generate.