]> Git Repo - VerusCoin.git/blob - src/chainparams.cpp
Enforce standard transaction rules on testnet
[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         // guarantees the first 2 characters, when base58 encoded, are "t1"
117         base58Prefixes[PUBKEY_ADDRESS]     = {0x1C,0xB8};
118         // guarantees the first 2 characters, when base58 encoded, are "t3"
119         base58Prefixes[SCRIPT_ADDRESS]     = {0x1C,0xBD};
120         // the first character, when base58 encoded, is "5" or "K" or "L" (as in Bitcoin)
121         base58Prefixes[SECRET_KEY]         = {0x80};
122         // do not rely on these BIP32 prefixes; they are not specified and may change
123         base58Prefixes[EXT_PUBLIC_KEY]     = {0x04,0x88,0xB2,0x1E};
124         base58Prefixes[EXT_SECRET_KEY]     = {0x04,0x88,0xAD,0xE4};
125         // guarantees the first 2 characters, when base58 encoded, are "zc"
126         base58Prefixes[ZCPAYMENT_ADDRRESS] = {0x16,0x9A};
127         // guarantees the first 2 characters, when base58 encoded, are "SK"
128         base58Prefixes[ZCSPENDING_KEY]     = {0xAB,0x36};
129
130         vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
131
132         fRequireRPCPassword = true;
133         fMiningRequiresPeers = true;
134         fDefaultConsistencyChecks = false;
135         fRequireStandard = true;
136         fMineBlocksOnDemand = false;
137         fTestnetToBeDeprecatedFieldRPC = false;
138
139         checkpointData = (Checkpoints::CCheckpointData) {
140             boost::assign::map_list_of
141             ( 0, consensus.hashGenesisBlock),
142             genesis.nTime, // * UNIX timestamp of last checkpoint block
143             0,   // * total number of transactions between genesis and last checkpoint
144                  //   (the tx=... number in the SetBestChain debug.log lines)
145             0    // * estimated number of transactions per day after checkpoint
146         };
147
148         // Founders reward script expects a vector of 2-of-3 multisig addresses
149         vFoundersRewardAddress = {
150             "t3QW3CN6TzmTVH8M5E5aJoKzN838zAEBCuS", "t3c6yYJxXBGr3A2KjATDwDsbn8iLP9AsXfk", "t3TuV45WwNVwo3Qc4o2Mr1TenrY9FwRM18Z", "t3hmq4gpfPGhbaRaCsmD2ePidaPxWf3upsg",
151             "t3Y8pxVmXa4URdCWLC4cmeGPQ9nu8eSJMvG", "t3aE5FYLigL7VZw6qjmM6ftjBiAvGiPkjo5", "t3eiUmJQGPykPH8U5gzbPd1SjGDK2k6SFvb", "t3N1ybrjKLyn7q7tpQSRxSZmYp7UgkEgHDb",
152             "t3c8uR6tn6KWwrPWApBXJQuQ6daAr8bcaMg", "t3PGLi4mkL5FkMNjp9ERHtTBQguHPjT3yqA", "t3NYWdEZKfKwvBGCtJM2oMWhy1Rzot3yL3Q", "t3N7PKyV2yQnciu9cx5UbaqDRCVtev9qHpN",
153             "t3YPB1besUqKeEtx9FZX1A6HcXnkXq9Vc3r", "t3UrKCimx2FA9LU4ZMHE5A9dWbxEzm5MgLj", "t3WF7VvMmEh5teWs3WnW6shMqMj3UbX6p33", "t3aBmkm1cZoF5dZuumscMjWviipvSx6hFLR",
154             "t3VMf2EpazVsr4mKy4Gyp9qizCdQLrWTm9J", "t3NtLU7S7fYCtLMCjJHkxGd8kr79w7UhtpX", "t3SwJTa8B4zCEX6fth9BMaejp3pQW11DTB8", "t3PCnGjULLqDUq91XNAwU7aAx6v2WkAP12v",
155             "t3MAXyTGySnb6b3No3LuoVuFL3fY7recEin", "t3hbK2KY4BQ1rQuzwufyxLzSKQQPiP9XidW", "t3aF3uT8jQSmVetYwP5qLAuTnNqWJRNLQu7", "t3PWLsr8ru9MXyq7YWGAHPcY3N9t3Zp45uo",
156             "t3WzEt94EcdNXWjL8sb2KFTawZPUcL42MoX", "t3cjgEXQH2dp4Gozu6Mn45LC5HGfjrSAf9V", "t3ZmskqAyBLXkYBMGfBBpVmR3sNKN79anu3", "t3hGLeywDDaiqBro2Mi2eLD1i8LUttrBfbT",
157             "t3eQdDzPZMdN4vCziFt5zar7qp1XyMwgnD6", "t3PXk3FyBi7q48paPDLtCKdzF1zDS4bpjM3", "t3W65DrnBYmU8DPJgQ44acpz3YPwoNE8pc5", "t3Tj5a6hNPksnpcRSXS2pv1f2mrPtL2bqGb",
158             "t3heu9Ty3XwHAJbux6Bm4MakzS8jUL3EkFD", "t3WFEk3WwAXF6ByHxfLohtz22J1TUwsL6iu", "t3gxDHAf8iW7xBFB7JsScngfJjH6h3QBfot", "t3bn1o8hx4jYjxgC8Pdt6Z6oeFrPQPtT8pC",
159             "t3XHGtWbALCLfY1jAtkUpVELPJMZpqxBtgE", "t3RUBEzMhjHpM2DQLsAmpAm9ZUHUxnEQAtM", "t3KdS1RGsiDXBKebyZvwVE2pfacNj28KLqB", "t3MmVaTutnXLqyD2F6EKnDtCKs38HxkVAdH",
160             "t3LesWouCkeWkwkaQUoGnD4k1pqmn3AYkt4", "t3PmV5vRVByLMTjR1W8ZCp2xy82kpb6n99u", "t3KX34whzndhhxPKJwAyETkeVA2Q1TzBhor", "t3SPSmxWnzNYr7WQooNxkHMhVYdAKY6M5Dr",
161             "t3KpcuJDA82TZhJoygng6eq72LWBCYtp7W8", "t3cHewjCnajURPGXA74kdLUkcqtRWpN3QkG", "t3a3zS49EqTFJWfDgNQhTNNFjkkhveqQssP", "t3eunPgNGpcSqEUSgAwip3Mm5nYQcPvacvX",
162         };
163         assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
164     }
165 };
166 static CMainParams mainParams;
167
168 /**
169  * Testnet (v3)
170  */
171 class CTestNetParams : public CMainParams {
172 public:
173     CTestNetParams() {
174         strNetworkID = "test";
175         consensus.nMajorityEnforceBlockUpgrade = 51;
176         consensus.nMajorityRejectBlockOutdated = 75;
177         consensus.nMajorityWindow = 400;
178         consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
179         assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
180         consensus.fPowAllowMinDifficultyBlocks = true;
181         pchMessageStart[0] = 0x0C;
182         pchMessageStart[1] = 0x9E;
183         pchMessageStart[2] = 0xD7;
184         pchMessageStart[3] = 0xA2;
185         vAlertPubKey = ParseHex("044e7a1553392325c871c5ace5d6ad73501c66f4c185d6b0453cf45dec5a1322e705c672ac1a27ef7cdaf588c10effdf50ed5f95f85f2f54a5f6159fca394ed0c6");
186         nDefaultPort = 18233;
187         nMinerThreads = 0;
188         nMaxTipAge = 0x7fffffff;
189         nPruneAfterHeight = 1000;
190
191         //! Modify the testnet genesis block so the timestamp is valid for a later start.
192         genesis.nTime = 1296688602;
193         genesis.nBits = 0x200f0f0f;
194         genesis.nNonce = uint256S("0x0000000000000000000000000000000000000000000000000000000000000009");
195         genesis.nSolution = ParseHex("003423da3e41f916bf3ff0ee770eb844a240361abe08a8c9d46bd30226e2ad411a4047b6ddc230d173c60537e470e24f764120f5a2778b2a1285b0727bf79a0b085ad67e6266fb38fd72ef17f827315c42f921720248c983d4100e6ebd1c4b5e8762a973bac3bec7f7153b93752ebbb465f0fc9520bcfc30f9abfe303627338fed6ede9cf1b9173a736cf270cf4d9c6999ff4c3a301a78fd50dab6ccca67a0c5c2e41f216a1f3efd049a74bbe6252f9773bc309d3f9e554d996913ce8e1cec672a1fa4ea59726b61ea9e75d5ce9aa5dbfa96179a293810e02787f26de324fe7c88376ff57e29574a55faff7c2946f3e40e451861c32bf67da7377de3136858a18f34fab1bc8da37726ca2c25fc7b312a5427554ec944da81c7e27255d6c94ade9987ff7daedc2d1cc63d7d4cf93e691d13326fb1c7ee72ccdc0b134eb665fc6a9821e6fef6a6d45e4aac6dca6b505a0100ad56ea4f6fa4cdc2f0d1b65f730104a515172e34163bdb422f99d083e6eb860cf6b3f66642c4dbaf0d0fa1dca1b6166f1d1ffaa55a9d6d6df628afbdd14f1622c1c8303259299521a253bc28fcc93676723158067270fc710a09155a1e50c533e9b79ed5edba4ab70a08a9a2fc0eef0ddae050d75776a9804f8d6ad7e30ccb66c6a98d86710ca7a4dfb4feb159484796b9a015c5764aa3509051c87f729b9877ea41f8b470898c01388ed9098b1e006d3c30fc6e7c781072fa3f75d918505ee8ca75840fc62f67c57060666aa42578a2dd022eda62e3f1e447d7364074d34fd60ad9b138f60422afa6cfcb913fd6c213b496144dbfda7bfc7c24540cfe40ad0c0fd5a8c0902127f53d3178ba1b2a87bf1224d53d3a15e49ccdf121ae872a011c996d1b9793153cdcd4c0a7e99f8a35669788551cca2b62769eda24b6b55e2f4e0ac0d30aa50ecf33c6cdb24adfc922006a7bf434ced800fefe814c94c6fc8caa37b372d5088bb31d2f6b11a7a67ad3f70abbac0d5c256b637828de6cc525978cf151a2e50798e0c591787639a030291272c9ced3ab7d682e03f8c7db51f60163baa85315789666ea8c5cd6f789a7f4a5de4f8a9dfefce20f353cec606492fde8eab3e3b487b3a3a57434f8cf252a4b643fc125c8a5948b06744f5dc306aa587bdc85364c7488235c6edddd78763675e50a9637181519be06dd30c4ba0d845f9ba320d01706fd6dd64d1aa3cd4211a4a7d1d3f2c1ef2766d27d5d2cdf8e7f5e3ea309d4f149bb737305df1373a7f5313abe5986f4aa620bec4b0065d48aafac3631de3771f5c4d2f6eec67b09d9c70a3c1969fecdb014cb3c69832b63cc9d6efa378bff0ef95ffacdeb1675bb326e698f022c1a3a2e1c2b0f05e1492a6d2b7552388eca7ee8a2467ef5d4207f65d4e2ae7e33f13eb473954f249d7c20158ae703e1accddd4ea899f026618695ed2949715678a32a153df32c08922fafad68b1895e3b10e143e712940104b3b352369f4fe79bd1f1dbe03ea9909dbcf5862d1f15b3d1557a6191f54c891513cdb3c729bb9ab08c0d4c35a3ed67d517ffe1e2b7a798521aed15ff9822169c0ec860d7b897340bc2ef4c37f7eb73bd7dafef12c4fd4e6f5dd3690305257ae14ed03df5e3327b68467775a90993e613173fa6650ffa2a26e84b3ce79606bf234eda9f4053307f344099e3b10308d3785b8726fd02d8e94c2759bebd05748c3fe7d5fe087dc63608fb77f29708ab167a13f32da251e249a544124ed50c270cfc6986d9d1814273d2f0510d0d2ea335817207db6a4a23ae9b079967b63b25cb3ceea7001b65b879263f5009ac84ab89738a5b8b71fd032beb9f297326f1f5afa630a5198d684514e242f315a4d95fa6802e82799a525bb653b80b4518ec610a5996403b1391");
196         consensus.hashGenesisBlock = genesis.GetHash();
197         assert(consensus.hashGenesisBlock == uint256S("0x0cdf00b25a93ded11d73ebe1728cf7867f18e1f62aca9554b95e0f3026174e33"));
198
199         vFixedSeeds.clear();
200         vSeeds.clear();
201         vSeeds.push_back(CDNSSeedData("z.cash", "dnsseed.testnet.z.cash")); // Zcash
202
203         // guarantees the first 2 characters, when base58 encoded, are "tm"
204         base58Prefixes[PUBKEY_ADDRESS]     = {0x1D,0x25};
205         // guarantees the first 2 characters, when base58 encoded, are "t2"
206         base58Prefixes[SCRIPT_ADDRESS]     = {0x1C,0xBA};
207         // the first character, when base58 encoded, is "9" or "c" (as in Bitcoin)
208         base58Prefixes[SECRET_KEY]         = {0xEF};
209         // do not rely on these BIP32 prefixes; they are not specified and may change
210         base58Prefixes[EXT_PUBLIC_KEY]     = {0x04,0x35,0x87,0xCF};
211         base58Prefixes[EXT_SECRET_KEY]     = {0x04,0x35,0x83,0x94};
212         // guarantees the first 2 characters, when base58 encoded, are "zt"
213         base58Prefixes[ZCPAYMENT_ADDRRESS] = {0x16,0xB6};
214         // guarantees the first 2 characters, when base58 encoded, are "ST"
215         base58Prefixes[ZCSPENDING_KEY]     = {0xAC,0x08};
216
217         vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
218
219         fRequireRPCPassword = true;
220         fMiningRequiresPeers = true;
221         fDefaultConsistencyChecks = false;
222         fRequireStandard = true;
223         fMineBlocksOnDemand = false;
224         fTestnetToBeDeprecatedFieldRPC = true;
225
226         checkpointData = (Checkpoints::CCheckpointData) {
227             boost::assign::map_list_of
228             ( 0, consensus.hashGenesisBlock),
229             genesis.nTime,
230             0,
231             0
232         };
233
234         // Founders reward script expects a vector of 2-of-3 multisig addresses
235         vFoundersRewardAddress = {
236             "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi", "t2N9PH9Wk9xjqYg9iin1Ua3aekJqfAtE543", "t2NGQjYMQhFndDHguvUw4wZdNdsssA6K7x2", "t27ktmq1kbeCWiQ5TZ7w5npSzcdbBmTB7v6",
237             "t2GcBttAKD2WTHka8HyGc2dfvVTKYZUfHmJ", "t2Q3vxWaD9LrdqUE8Xd9Ddjpr9pUQ2aGotK", "t2TTfWDsYu998fHWzVP9Gns4fgxXXRi1Wzu", "t2KS6R4MMWdSBMjLCiw2iMyhWGRQPmyRqDn",
238             "t2Q2ELrgotWv3Eec6LEtMMiiQ8dtW38u8Tj", "t2AEgJA88vTWAKqxJDFUEJWyHUtQAZi5G1D", "t2HCSdmpq1TQKksuwPQevwAzPTgfJ2rkMbG", "t2HQCPFAUQaUdJWHPhg5pPBxit7inaJzubE",
239             "t2Fzqvq8Y9e6Mn3JNPb982aYsLmq4b5HmhH", "t2HEz7YZQqDUgC5h4y2WSD3mWneqJNVRjjJ", "t2GCR1SCk687Eeo5NEZ23MLsms7JjVWBgfG", "t2KyiPR9Lztq2w1w747X6W4nkUMAGL8M9KN",
240             "t2UxymadyxSyVihmbq7S1yxw5dCBqJ1S4jT", "t2AVeMy7fdmTcJhckqiKRG8B7F1vccEhSqU", "t26m7LwihQzD2sH7ZVhYpPJM5j7kzwbfKW9", "t2DgwUNTe7NxuyPU6fxsB5xJXap3E4yWXrN",
241             "t2U6funcXA11fC9SZehyvUL3rk3Vhuh7fzS", "t284JhyS8LGM72Tx1porSqwrcq3CejthP1p", "t29egu8QcpzKeLoPLqWS6QVMnUUPQdF6eNm", "t29LqD9p9D3B26euBwFi6mfcWu8HPA38VNs",
242             "t28GsAMCxAyLy85XaasddDzaYFTtfewr86y", "t2GV44QyaikQPLUfm6oTfZnw71LLjnR7gDG", "t2U2QzNLQ1jtAu4L6xxVnRXLBsQpQvGRR2g", "t2QKGr5PNan7nrwDgseyHMN9NFeeuUjCh8b",
243             "t2AfS8u6HwBeJpKpbuxztvRjupKQDXqnrwa", "t2CTRQUViQd3CWMhnKhFnUHqDLUyTxmWhJs", "t2CbM9EqszNURqh1UXZBXYhwp1R4GwEhWRE", "t2LM7uYiAsKDU42GNSnMwDxbZ8s1DowQzYH",
244             "t2AgvT35LHR378AE3ouz6xKMhkTLHLJC6nD", "t285EAQXUVyi4NMddJv2QqTrnv45GRMbP8e", "t2EpMRCD5b8f2DCQ37npNULcpZhkjC8muqA", "t2BCmWXrRPiCeQTpizSWKKRPM5X6PS7umDY",
245             "t2DN7X6wDFn5hYKBiBmn3Z98st419yaTVTH", "t2QJj8HeCwQ6mHwqekxxDLZntYpZTHNU62t", "t2QdHBR1Yciqn4j8gpS8DcQZZtYetKvfNj3", "t2E5cpLA1ey5VNxFNcuopeQMq2rH2NHiPdu",
246             "t2EVRGtzjFAyz8CF8ndvLuiJu7qZUfDa93H", "t2KoQDk3BSFadBkuaWdLwchFuQamzw9RE4L", "t2FnR3yhTmuiejEJeu6qpidWTghRd1HpjLt", "t2BAuBAAospDc9d1u5nNGEi6x4NRJBD2PQ2",
247             "t2RtKrLCGcyPkm4a4APg1YY9Wu2m4R2PgrB", "t28aUbSteZzBq2pFgj1K1XNZRZP5mMMyakV", "t2Urdy1ERfkvsFuy6Z4BkhvYGzWdmivfAFR", "t2ADinR4JrvCMd4Q1XGALPajzFrirqvhED6",
248         };
249         assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
250     }
251 };
252 static CTestNetParams testNetParams;
253
254 /**
255  * Regression test
256  */
257 class CRegTestParams : public CTestNetParams {
258 public:
259     CRegTestParams() {
260         strNetworkID = "regtest";
261         consensus.fCoinbaseMustBeProtected = false;
262         consensus.nSubsidySlowStartInterval = 0;
263         consensus.nSubsidyHalvingInterval = 150;
264         consensus.nMajorityEnforceBlockUpgrade = 750;
265         consensus.nMajorityRejectBlockOutdated = 950;
266         consensus.nMajorityWindow = 1000;
267         consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
268         assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
269         consensus.nPowMaxAdjustDown = 0; // Turn off adjustment down
270         consensus.nPowMaxAdjustUp = 0; // Turn off adjustment up
271         pchMessageStart[0] = 0xaa;
272         pchMessageStart[1] = 0xe8;
273         pchMessageStart[2] = 0x3f;
274         pchMessageStart[3] = 0x5f;
275         nMinerThreads = 1;
276         nMaxTipAge = 24 * 60 * 60;
277         const size_t N = 48, K = 5;
278         BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
279         nEquihashN = N;
280         nEquihashK = K;
281         genesis.nTime = 1296688602;
282         genesis.nBits = 0x200f0f0f;
283         genesis.nNonce = uint256S("0x0000000000000000000000000000000000000000000000000000000000000021");
284         genesis.nSolution = ParseHex("0f2a976db4c4263da10fd5d38eb1790469cf19bdb4bf93450e09a72fdff17a3454326399");
285         consensus.hashGenesisBlock = genesis.GetHash();
286         nDefaultPort = 18444;
287         assert(consensus.hashGenesisBlock == uint256S("0x00a215b4fe36f5d2f829d43e587bf10e89e64f9f48a5b6ce18559089e8fd643d"));
288         nPruneAfterHeight = 1000;
289
290         vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
291         vSeeds.clear();  //! Regtest mode doesn't have any DNS seeds.
292
293         fRequireRPCPassword = false;
294         fMiningRequiresPeers = false;
295         fDefaultConsistencyChecks = true;
296         fRequireStandard = false;
297         fMineBlocksOnDemand = true;
298         fTestnetToBeDeprecatedFieldRPC = false;
299
300         checkpointData = (Checkpoints::CCheckpointData){
301             boost::assign::map_list_of
302             ( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
303             0,
304             0,
305             0
306         };
307
308         // Founders reward script expects a vector of 2-of-3 multisig addresses
309         vFoundersRewardAddress = { "t2FwcEhFdNXuFMv1tcYwaBJtYVtMj8b1uTg" };
310         assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
311     }
312 };
313 static CRegTestParams regTestParams;
314
315 static CChainParams *pCurrentParams = 0;
316
317 const CChainParams &Params() {
318     assert(pCurrentParams);
319     return *pCurrentParams;
320 }
321
322 CChainParams &Params(CBaseChainParams::Network network) {
323     switch (network) {
324         case CBaseChainParams::MAIN:
325             return mainParams;
326         case CBaseChainParams::TESTNET:
327             return testNetParams;
328         case CBaseChainParams::REGTEST:
329             return regTestParams;
330         default:
331             assert(false && "Unimplemented network");
332             return mainParams;
333     }
334 }
335
336 void SelectParams(CBaseChainParams::Network network) {
337     SelectBaseParams(network);
338     pCurrentParams = &Params(network);
339
340     // Some python qa rpc tests need to enforce the coinbase consensus rule
341     if (network == CBaseChainParams::REGTEST && mapArgs.count("-regtestprotectcoinbase")) {
342         regTestParams.SetRegTestCoinbaseMustBeProtected();
343     }
344 }
345
346 bool SelectParamsFromCommandLine()
347 {
348     CBaseChainParams::Network network = NetworkIdFromCommandLine();
349     if (network == CBaseChainParams::MAX_NETWORK_TYPES)
350         return false;
351
352     SelectParams(network);
353     return true;
354 }
355
356
357 // Block height must be >0 and <=last founders reward block height
358 // Index variable i ranges from 0 - (vFoundersRewardAddress.size()-1)
359 std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const {
360     int maxHeight = consensus.GetLastFoundersRewardBlockHeight();
361     assert(nHeight > 0 && nHeight <= maxHeight);
362
363     size_t addressChangeInterval = (maxHeight + vFoundersRewardAddress.size()) / vFoundersRewardAddress.size();
364     size_t i = nHeight / addressChangeInterval;
365     return vFoundersRewardAddress[i];
366 }
367
368 // Block height must be >0 and <=last founders reward block height
369 // The founders reward address is expected to be a multisig (P2SH) address
370 CScript CChainParams::GetFoundersRewardScriptAtHeight(int nHeight) const {
371     assert(nHeight > 0 && nHeight <= consensus.GetLastFoundersRewardBlockHeight());
372
373     // #1398 START
374     // We can remove this code when miner_tests no longer expect this script
375     if (fMinerTestModeForFoundersRewardScript) {
376         auto rewardScript = ParseHex("a9146708e6670db0b950dac68031025cc5b63213a49187");
377         return CScript(rewardScript.begin(), rewardScript.end());
378     }
379     // #1398 END
380
381     CBitcoinAddress address(GetFoundersRewardAddressAtHeight(nHeight).c_str());
382     assert(address.IsValid());
383     assert(address.IsScript());
384     CScriptID scriptID = get<CScriptID>(address.Get()); // Get() returns a boost variant
385     CScript script = CScript() << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL;
386     return script;
387 }
388
389 std::string CChainParams::GetFoundersRewardAddressAtIndex(int i) const {
390     assert(i >= 0 && i < vFoundersRewardAddress.size());
391     return vFoundersRewardAddress[i];
392 }
This page took 0.043624 seconds and 4 git commands to generate.