]> Git Repo - VerusCoin.git/blame_incremental - src/chainparams.cpp
Remove DNS Seeds run by entities which were never well-established.
[VerusCoin.git] / src / chainparams.cpp
... / ...
CommitLineData
1// Copyright (c) 2010 Satoshi Nakamoto
2// Copyright (c) 2009-2014 The Bitcoin developers
3// Distributed under the MIT/X11 software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include "chainparams.h"
7
8#include "random.h"
9#include "util.h"
10
11#include <assert.h>
12
13#include <boost/assign/list_of.hpp>
14
15using namespace std;
16using namespace boost::assign;
17
18struct SeedSpec6 {
19 uint8_t addr[16];
20 uint16_t port;
21};
22
23#include "chainparamsseeds.h"
24
25//
26// Main network
27//
28
29// Convert the pnSeeds6 array into usable address objects.
30static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count)
31{
32 // It'll only connect to one or two seed nodes because once it connects,
33 // it'll get a pile of addresses with newer timestamps.
34 // Seed nodes are given a random 'last seen time' of between one and two
35 // weeks ago.
36 const int64_t nOneWeek = 7*24*60*60;
37 for (unsigned int i = 0; i < count; i++)
38 {
39 struct in6_addr ip;
40 memcpy(&ip, data[i].addr, sizeof(ip));
41 CAddress addr(CService(ip, data[i].port));
42 addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
43 vSeedsOut.push_back(addr);
44 }
45}
46
47class CMainParams : public CChainParams {
48public:
49 CMainParams() {
50 networkID = CBaseChainParams::MAIN;
51 strNetworkID = "main";
52 // The message start string is designed to be unlikely to occur in normal data.
53 // The characters are rarely used upper ASCII, not valid as UTF-8, and produce
54 // a large 4-byte int at any alignment.
55 pchMessageStart[0] = 0xf9;
56 pchMessageStart[1] = 0xbe;
57 pchMessageStart[2] = 0xb4;
58 pchMessageStart[3] = 0xd9;
59 vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");
60 nDefaultPort = 8333;
61 bnProofOfWorkLimit = ~uint256(0) >> 32;
62 nSubsidyHalvingInterval = 210000;
63 nEnforceBlockUpgradeMajority = 750;
64 nRejectBlockOutdatedMajority = 950;
65 nToCheckBlockUpgradeMajority = 1000;
66 nMinerThreads = 0;
67 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
68 nTargetSpacing = 10 * 60;
69
70 // Build the genesis block. Note that the output of the genesis coinbase cannot
71 // be spent as it did not originally exist in the database.
72 //
73 // CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
74 // CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
75 // CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
76 // CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
77 // vMerkleTree: 4a5e1e
78 const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
79 CMutableTransaction txNew;
80 txNew.vin.resize(1);
81 txNew.vout.resize(1);
82 txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
83 txNew.vout[0].nValue = 50 * COIN;
84 txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
85 genesis.vtx.push_back(txNew);
86 genesis.hashPrevBlock = 0;
87 genesis.hashMerkleRoot = genesis.BuildMerkleTree();
88 genesis.nVersion = 1;
89 genesis.nTime = 1231006505;
90 genesis.nBits = 0x1d00ffff;
91 genesis.nNonce = 2083236893;
92
93 hashGenesisBlock = genesis.GetHash();
94 assert(hashGenesisBlock == uint256("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
95 assert(genesis.hashMerkleRoot == uint256("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
96
97 vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be"));
98 vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me"));
99 vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org"));
100 vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com"));
101 vSeeds.push_back(CDNSSeedData("bitnodes.io", "seed.bitnodes.io"));
102 vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org"));
103
104 base58Prefixes[PUBKEY_ADDRESS] = list_of(0);
105 base58Prefixes[SCRIPT_ADDRESS] = list_of(5);
106 base58Prefixes[SECRET_KEY] = list_of(128);
107 base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E);
108 base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);
109
110 convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));
111
112 fRequireRPCPassword = true;
113 fMiningRequiresPeers = true;
114 fDefaultCheckMemPool = false;
115 fAllowMinDifficultyBlocks = false;
116 fRequireStandard = true;
117 fMineBlocksOnDemand = false;
118 }
119};
120static CMainParams mainParams;
121
122//
123// Testnet (v3)
124//
125
126class CTestNetParams : public CMainParams {
127public:
128 CTestNetParams() {
129 networkID = CBaseChainParams::TESTNET;
130 strNetworkID = "test";
131 // The message start string is designed to be unlikely to occur in normal data.
132 // The characters are rarely used upper ASCII, not valid as UTF-8, and produce
133 // a large 4-byte int at any alignment.
134 pchMessageStart[0] = 0x0b;
135 pchMessageStart[1] = 0x11;
136 pchMessageStart[2] = 0x09;
137 pchMessageStart[3] = 0x07;
138 vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
139 nDefaultPort = 18333;
140 nEnforceBlockUpgradeMajority = 51;
141 nRejectBlockOutdatedMajority = 75;
142 nToCheckBlockUpgradeMajority = 100;
143 nMinerThreads = 0;
144 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
145 nTargetSpacing = 10 * 60;
146
147 // Modify the testnet genesis block so the timestamp is valid for a later start.
148 genesis.nTime = 1296688602;
149 genesis.nNonce = 414098458;
150 hashGenesisBlock = genesis.GetHash();
151 assert(hashGenesisBlock == uint256("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
152
153 vFixedSeeds.clear();
154 vSeeds.clear();
155 vSeeds.push_back(CDNSSeedData("alexykot.me", "testnet-seed.alexykot.me"));
156 vSeeds.push_back(CDNSSeedData("bitcoin.petertodd.org", "testnet-seed.bitcoin.petertodd.org"));
157 vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me"));
158
159 base58Prefixes[PUBKEY_ADDRESS] = list_of(111);
160 base58Prefixes[SCRIPT_ADDRESS] = list_of(196);
161 base58Prefixes[SECRET_KEY] = list_of(239);
162 base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF);
163 base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);
164
165 convertSeed6(vFixedSeeds, pnSeed6_test, ARRAYLEN(pnSeed6_test));
166
167 fRequireRPCPassword = true;
168 fMiningRequiresPeers = true;
169 fDefaultCheckMemPool = false;
170 fAllowMinDifficultyBlocks = true;
171 fRequireStandard = false;
172 fMineBlocksOnDemand = false;
173 }
174};
175static CTestNetParams testNetParams;
176
177//
178// Regression test
179//
180class CRegTestParams : public CTestNetParams {
181public:
182 CRegTestParams() {
183 networkID = CBaseChainParams::REGTEST;
184 strNetworkID = "regtest";
185 pchMessageStart[0] = 0xfa;
186 pchMessageStart[1] = 0xbf;
187 pchMessageStart[2] = 0xb5;
188 pchMessageStart[3] = 0xda;
189 nSubsidyHalvingInterval = 150;
190 nEnforceBlockUpgradeMajority = 750;
191 nRejectBlockOutdatedMajority = 950;
192 nToCheckBlockUpgradeMajority = 1000;
193 nMinerThreads = 1;
194 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
195 nTargetSpacing = 10 * 60;
196 bnProofOfWorkLimit = ~uint256(0) >> 1;
197 genesis.nTime = 1296688602;
198 genesis.nBits = 0x207fffff;
199 genesis.nNonce = 2;
200 hashGenesisBlock = genesis.GetHash();
201 nDefaultPort = 18444;
202 assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
203
204 vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
205
206 fRequireRPCPassword = false;
207 fMiningRequiresPeers = false;
208 fDefaultCheckMemPool = true;
209 fAllowMinDifficultyBlocks = true;
210 fRequireStandard = false;
211 fMineBlocksOnDemand = true;
212 }
213};
214static CRegTestParams regTestParams;
215
216static CChainParams *pCurrentParams = 0;
217
218const CChainParams &Params() {
219 assert(pCurrentParams);
220 return *pCurrentParams;
221}
222
223void SelectParams(CBaseChainParams::Network network) {
224 SelectBaseParams(network);
225 switch (network) {
226 case CBaseChainParams::MAIN:
227 pCurrentParams = &mainParams;
228 break;
229 case CBaseChainParams::TESTNET:
230 pCurrentParams = &testNetParams;
231 break;
232 case CBaseChainParams::REGTEST:
233 pCurrentParams = &regTestParams;
234 break;
235 default:
236 assert(false && "Unimplemented network");
237 return;
238 }
239}
240
241bool SelectParamsFromCommandLine() {
242 if (!SelectBaseParamsFromCommandLine())
243 return false;
244
245 SelectParams(BaseParams().NetworkID());
246 return true;
247}
This page took 0.023616 seconds and 4 git commands to generate.