2013-05-07 15:16:25 +02:00
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
2014-02-08 22:50:24 +01:00
|
|
|
// Copyright (c) 2009-2014 The Bitcoin developers
|
2015-03-18 00:06:58 +01:00
|
|
|
// Copyright (c) 2014-2015 The Dash developers
|
2014-10-25 11:24:16 +02:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-05-07 15:16:25 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include "chainparams.h"
|
2013-04-13 07:13:08 +02:00
|
|
|
|
2014-06-26 14:41:53 +02:00
|
|
|
#include "random.h"
|
2013-05-07 15:16:25 +02:00
|
|
|
#include "util.h"
|
2014-09-25 05:32:36 +02:00
|
|
|
#include "utilstrencodings.h"
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-08-28 22:56:53 +02:00
|
|
|
#include <assert.h>
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2013-06-23 02:33:47 +02:00
|
|
|
#include <boost/assign/list_of.hpp>
|
|
|
|
|
2014-06-16 16:30:38 +02:00
|
|
|
using namespace std;
|
2013-06-23 02:33:47 +02:00
|
|
|
using namespace boost::assign;
|
|
|
|
|
2014-07-24 13:52:57 +02:00
|
|
|
struct SeedSpec6 {
|
|
|
|
uint8_t addr[16];
|
|
|
|
uint16_t port;
|
|
|
|
};
|
|
|
|
|
|
|
|
#include "chainparamsseeds.h"
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* Main network
|
|
|
|
*/
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
//! Convert the pnSeeds6 array into usable address objects.
|
2014-07-24 13:52:57 +02:00
|
|
|
static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count)
|
2013-05-07 15:16:25 +02:00
|
|
|
{
|
2014-07-24 13:52:57 +02:00
|
|
|
// It'll only connect to one or two seed nodes because once it connects,
|
|
|
|
// it'll get a pile of addresses with newer timestamps.
|
|
|
|
// Seed nodes are given a random 'last seen time' of between one and two
|
|
|
|
// weeks ago.
|
|
|
|
const int64_t nOneWeek = 7*24*60*60;
|
|
|
|
for (unsigned int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
struct in6_addr ip;
|
|
|
|
memcpy(&ip, data[i].addr, sizeof(ip));
|
|
|
|
CAddress addr(CService(ip, data[i].port));
|
|
|
|
addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
|
|
|
|
vSeedsOut.push_back(addr);
|
|
|
|
}
|
|
|
|
}
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* What makes a good checkpoint block?
|
|
|
|
* + Is surrounded by blocks with reasonable timestamps
|
|
|
|
* (no blocks before with a timestamp after, none after with
|
|
|
|
* timestamp before)
|
|
|
|
* + Contains no strange transactions
|
|
|
|
*/
|
2014-08-31 21:32:23 +02:00
|
|
|
static Checkpoints::MapCheckpoints mapCheckpoints =
|
|
|
|
boost::assign::map_list_of
|
2015-04-03 00:51:08 +02:00
|
|
|
( 1500, uint256("0x000000aaf0300f59f49bc3e970bad15c11f961fe2347accffff19d96ec9778e3"))
|
|
|
|
( 4991, uint256("0x000000003b01809551952460744d5dbb8fcbd6cbae3c220267bf7fa43f837367"))
|
|
|
|
( 9918, uint256("0x00000000213e229f332c0ffbe34defdaa9e74de87f2d8d1f01af8d121c3c170b"))
|
|
|
|
( 16912, uint256("0x00000000075c0d10371d55a60634da70f197548dbbfa4123e12abfcbc5738af9"))
|
|
|
|
( 23912, uint256("0x0000000000335eac6703f3b1732ec8b2f89c3ba3a7889e5767b090556bb9a276"))
|
|
|
|
( 35457, uint256("0x0000000000b0ae211be59b048df14820475ad0dd53b9ff83b010f71a77342d9f"))
|
|
|
|
( 45479, uint256("0x000000000063d411655d590590e16960f15ceea4257122ac430c6fbe39fbf02d"))
|
|
|
|
( 55895, uint256("0x0000000000ae4c53a43639a4ca027282f69da9c67ba951768a20415b6439a2d7"))
|
|
|
|
( 68899, uint256("0x0000000000194ab4d3d9eeb1f2f792f21bb39ff767cb547fe977640f969d77b7"))
|
|
|
|
( 74619, uint256("0x000000000011d28f38f05d01650a502cc3f4d0e793fbc26e2a2ca71f07dc3842"))
|
|
|
|
( 75095, uint256("0x0000000000193d12f6ad352a9996ee58ef8bdc4946818a5fec5ce99c11b87f0d"))
|
|
|
|
( 88805, uint256("0x00000000001392f1652e9bf45cd8bc79dc60fe935277cd11538565b4a94fa85f"))
|
|
|
|
( 107996, uint256("0x00000000000a23840ac16115407488267aa3da2b9bc843e301185b7d17e4dc40"))
|
|
|
|
( 137993, uint256("0x00000000000cf69ce152b1bffdeddc59188d7a80879210d6e5c9503011929c3c"))
|
|
|
|
( 167996, uint256("0x000000000009486020a80f7f2cc065342b0c2fb59af5e090cd813dba68ab0fed"))
|
|
|
|
( 207992, uint256("0x00000000000d85c22be098f74576ef00b7aa00c05777e966aff68a270f1e01a5"))
|
|
|
|
( 217752, uint256("0x00000000000a7baeb2148272a7e14edf5af99a64af456c0afc23d15a0918b704"))
|
2014-08-31 21:32:23 +02:00
|
|
|
;
|
|
|
|
static const Checkpoints::CCheckpointData data = {
|
|
|
|
&mapCheckpoints,
|
2015-05-16 05:04:26 +02:00
|
|
|
1423563332, // * UNIX timestamp of last checkpoint block
|
|
|
|
853742, // * total number of transactions between genesis and last checkpoint
|
2014-08-31 21:32:23 +02:00
|
|
|
// (the tx=... number in the SetBestChain debug.log lines)
|
2015-05-16 05:04:26 +02:00
|
|
|
2800 // * estimated number of transactions per day after checkpoint
|
2014-08-31 21:32:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static Checkpoints::MapCheckpoints mapCheckpointsTestnet =
|
|
|
|
boost::assign::map_list_of
|
2015-04-03 00:51:08 +02:00
|
|
|
( 261, uint256("00000c26026d0815a7e2ce4fa270775f61403c040647ff2c3091f99e894a4618"))
|
2014-08-31 21:32:23 +02:00
|
|
|
;
|
|
|
|
static const Checkpoints::CCheckpointData dataTestnet = {
|
|
|
|
&mapCheckpointsTestnet,
|
2015-04-03 00:51:08 +02:00
|
|
|
1405699509,
|
|
|
|
201,
|
|
|
|
500
|
2014-08-31 21:32:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static Checkpoints::MapCheckpoints mapCheckpointsRegtest =
|
|
|
|
boost::assign::map_list_of
|
2015-04-03 00:51:08 +02:00
|
|
|
( 0, uint256("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"))
|
2014-08-31 21:32:23 +02:00
|
|
|
;
|
|
|
|
static const Checkpoints::CCheckpointData dataRegtest = {
|
|
|
|
&mapCheckpointsRegtest,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0
|
|
|
|
};
|
2013-05-07 15:16:25 +02:00
|
|
|
|
|
|
|
class CMainParams : public CChainParams {
|
|
|
|
public:
|
|
|
|
CMainParams() {
|
2014-06-19 15:10:04 +02:00
|
|
|
networkID = CBaseChainParams::MAIN;
|
2014-06-11 12:23:49 +02:00
|
|
|
strNetworkID = "main";
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* The message start string is designed to be unlikely to occur in normal data.
|
|
|
|
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
|
|
|
|
* a large 4-byte int at any alignment.
|
|
|
|
*/
|
2014-11-28 10:56:02 +01:00
|
|
|
pchMessageStart[0] = 0xbf;
|
|
|
|
pchMessageStart[1] = 0x0c;
|
|
|
|
pchMessageStart[2] = 0x6b;
|
|
|
|
pchMessageStart[3] = 0xbd;
|
2014-12-12 23:19:02 +01:00
|
|
|
vAlertPubKey = ParseHex("048240a8748a80a286b270ba126705ced4f2ce5a7847b3610ea3c06513150dade2a8512ed5ea86320824683fc0818f0ac019214973e677acd1244f6d0571fc5103");
|
2014-11-27 18:09:11 +01:00
|
|
|
nDefaultPort = 9999;
|
2015-04-03 00:51:08 +02:00
|
|
|
bnProofOfWorkLimit = ~uint256(0) >> 20; // Dash starting difficulty is 1 / 2^12
|
2013-05-07 15:16:25 +02:00
|
|
|
nSubsidyHalvingInterval = 210000;
|
2014-03-22 19:52:26 +01:00
|
|
|
nEnforceBlockUpgradeMajority = 750;
|
|
|
|
nRejectBlockOutdatedMajority = 950;
|
|
|
|
nToCheckBlockUpgradeMajority = 1000;
|
2014-03-08 07:47:56 +01:00
|
|
|
nMinerThreads = 0;
|
2015-04-03 00:51:08 +02:00
|
|
|
nTargetTimespan = 24 * 60 * 60; // Dash: 1 day
|
|
|
|
nTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* Build the genesis block. Note that the output of the genesis coinbase cannot
|
|
|
|
* be spent as it did not originally exist in the database.
|
|
|
|
*
|
|
|
|
* CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
|
|
|
|
* CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
|
|
|
|
* CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
|
|
|
|
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
|
|
|
|
* vMerkleTree: 4a5e1e
|
|
|
|
*/
|
2014-11-28 10:56:02 +01:00
|
|
|
const char* pszTimestamp = "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins";
|
2014-06-07 13:53:27 +02:00
|
|
|
CMutableTransaction txNew;
|
2013-05-07 15:16:25 +02:00
|
|
|
txNew.vin.resize(1);
|
|
|
|
txNew.vout.resize(1);
|
2014-03-26 20:50:29 +01:00
|
|
|
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
2013-05-07 15:16:25 +02:00
|
|
|
txNew.vout[0].nValue = 50 * COIN;
|
2014-11-28 10:56:02 +01:00
|
|
|
txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
|
2013-05-07 15:16:25 +02:00
|
|
|
genesis.vtx.push_back(txNew);
|
|
|
|
genesis.hashPrevBlock = 0;
|
|
|
|
genesis.hashMerkleRoot = genesis.BuildMerkleTree();
|
|
|
|
genesis.nVersion = 1;
|
2014-11-28 10:56:02 +01:00
|
|
|
genesis.nTime = 1390095618;
|
|
|
|
genesis.nBits = 0x1e0ffff0;
|
|
|
|
genesis.nNonce = 28917698;
|
|
|
|
|
2014-11-28 11:53:08 +01:00
|
|
|
hashGenesisBlock = genesis.GetHash();
|
2014-11-28 10:56:02 +01:00
|
|
|
assert(hashGenesisBlock == uint256("0x00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6"));
|
|
|
|
assert(genesis.hashMerkleRoot == uint256("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2015-03-22 21:49:43 +01:00
|
|
|
vSeeds.push_back(CDNSSeedData("darkcoin.io", "dnsseed.darkcoin.io"));
|
2015-04-13 15:53:55 +02:00
|
|
|
vSeeds.push_back(CDNSSeedData("darkcoin.qa", "dnsseed.darkcoin.qa"));
|
|
|
|
vSeeds.push_back(CDNSSeedData("masternode.io", "dnsseed.masternode.io"));
|
2015-04-13 15:55:09 +02:00
|
|
|
vSeeds.push_back(CDNSSeedData("dashpay.io", "dnsseed.dashpay.io"));
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2015-03-18 00:06:58 +01:00
|
|
|
base58Prefixes[PUBKEY_ADDRESS] = list_of( 76); // Dash addresses start with 'X'
|
|
|
|
base58Prefixes[SCRIPT_ADDRESS] = list_of( 16); // Dash script addresses start with '7'
|
|
|
|
base58Prefixes[SECRET_KEY] = list_of(204); // Dash private keys start with '7' or 'X'
|
|
|
|
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x02)(0xFE)(0x52)(0xF8); // Dash BIP32 pubkeys start with 'drkv'
|
|
|
|
base58Prefixes[EXT_SECRET_KEY] = list_of(0x02)(0xFE)(0x52)(0xCC); // Dash BIP32 prvkeys start with 'drkp'
|
|
|
|
base58Prefixes[EXT_COIN_TYPE] = list_of(0x80000005); // Dash BIP44 coin type is '5'
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-07-24 13:52:57 +02:00
|
|
|
convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireRPCPassword = true;
|
|
|
|
fMiningRequiresPeers = true;
|
|
|
|
fAllowMinDifficultyBlocks = false;
|
2015-03-13 17:25:34 +01:00
|
|
|
fDefaultConsistencyChecks = false;
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireStandard = true;
|
|
|
|
fMineBlocksOnDemand = false;
|
2014-09-29 13:13:47 +02:00
|
|
|
fSkipProofOfWorkCheck = false;
|
2014-08-31 22:32:52 +02:00
|
|
|
fTestnetToBeDeprecatedFieldRPC = false;
|
2015-04-03 00:51:08 +02:00
|
|
|
|
|
|
|
nPoolMaxTransactions = 3;
|
|
|
|
strSporkKey = "04549ac134f694c0243f503e8c8a9a986f5de6610049c40b07816809b0d1d06a21b07be27b9bb555931773f62ba6cf35a25fd52f694d4e1106ccd237a7bb899fdd";
|
|
|
|
strMasternodePaymentsPubKey = "04549ac134f694c0243f503e8c8a9a986f5de6610049c40b07816809b0d1d06a21b07be27b9bb555931773f62ba6cf35a25fd52f694d4e1106ccd237a7bb899fdd";
|
|
|
|
strDarksendPoolDummyAddress = "Xq19GqFvajRrEdDHYRKGYjTsQfpV5jyipF";
|
|
|
|
nStartMasternodePayments = 1403728576; //Wed, 25 Jun 2014 20:36:16 GMT
|
2013-05-07 15:16:25 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 21:32:23 +02:00
|
|
|
const Checkpoints::CCheckpointData& Checkpoints() const
|
|
|
|
{
|
|
|
|
return data;
|
2013-05-07 15:16:25 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
static CMainParams mainParams;
|
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* Testnet (v3)
|
|
|
|
*/
|
2013-05-07 15:16:25 +02:00
|
|
|
class CTestNetParams : public CMainParams {
|
|
|
|
public:
|
|
|
|
CTestNetParams() {
|
2014-06-19 15:10:04 +02:00
|
|
|
networkID = CBaseChainParams::TESTNET;
|
2014-06-11 12:23:49 +02:00
|
|
|
strNetworkID = "test";
|
2014-11-28 10:56:02 +01:00
|
|
|
pchMessageStart[0] = 0xce;
|
|
|
|
pchMessageStart[1] = 0xe2;
|
|
|
|
pchMessageStart[2] = 0xca;
|
|
|
|
pchMessageStart[3] = 0xff;
|
2014-12-12 23:19:02 +01:00
|
|
|
vAlertPubKey = ParseHex("04517d8a699cb43d3938d7b24faaff7cda448ca4ea267723ba614784de661949bf632d6304316b244646dea079735b9a6fc4af804efb4752075b9fe2245e14e412");
|
2014-11-27 18:09:11 +01:00
|
|
|
nDefaultPort = 19999;
|
2014-03-22 19:52:26 +01:00
|
|
|
nEnforceBlockUpgradeMajority = 51;
|
|
|
|
nRejectBlockOutdatedMajority = 75;
|
|
|
|
nToCheckBlockUpgradeMajority = 100;
|
2014-03-22 18:29:34 +01:00
|
|
|
nMinerThreads = 0;
|
2015-04-03 00:51:08 +02:00
|
|
|
nTargetTimespan = 24 * 60 * 60; // Dash: 1 day
|
|
|
|
nTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
//! Modify the testnet genesis block so the timestamp is valid for a later start.
|
2014-12-12 23:19:02 +01:00
|
|
|
genesis.nTime = 1390666206;
|
|
|
|
genesis.nNonce = 3861367235;
|
2014-11-28 10:56:02 +01:00
|
|
|
|
2014-11-28 11:53:08 +01:00
|
|
|
hashGenesisBlock = genesis.GetHash();
|
2014-12-12 23:19:02 +01:00
|
|
|
assert(hashGenesisBlock == uint256("0x00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c"));
|
2013-05-07 15:16:25 +02:00
|
|
|
|
|
|
|
vFixedSeeds.clear();
|
|
|
|
vSeeds.clear();
|
2015-03-22 21:49:43 +01:00
|
|
|
/*vSeeds.push_back(CDNSSeedData("dashpay.io", "testnet-seed.dashpay.io"));
|
2015-03-19 15:15:08 +01:00
|
|
|
vSeeds.push_back(CDNSSeedData("dash.qa", "testnet-seed.dash.qa"));
|
2015-03-22 21:49:43 +01:00
|
|
|
*///legacy seeders
|
2015-04-13 15:53:55 +02:00
|
|
|
vSeeds.push_back(CDNSSeedData("darkcoin.io", "testnet-seed.darkcoin.io"));
|
2015-03-22 21:49:43 +01:00
|
|
|
vSeeds.push_back(CDNSSeedData("darkcoin.qa", "testnet-seed.darkcoin.qa"));
|
2014-12-26 21:32:11 +01:00
|
|
|
vSeeds.push_back(CDNSSeedData("masternode.io", "test.dnsseed.masternode.io"));
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2015-03-19 15:15:08 +01:00
|
|
|
base58Prefixes[PUBKEY_ADDRESS] = list_of(139); // Testnet dash addresses start with 'x' or 'y'
|
|
|
|
base58Prefixes[SCRIPT_ADDRESS] = list_of( 19); // Testnet dash script addresses start with '8' or '9'
|
2014-12-31 13:50:14 +01:00
|
|
|
base58Prefixes[SECRET_KEY] = list_of(239); // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
|
2015-03-19 15:15:08 +01:00
|
|
|
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x3a)(0x80)(0x61)(0xa0); // Testnet dash BIP32 pubkeys start with 'DRKV'
|
|
|
|
base58Prefixes[EXT_SECRET_KEY] = list_of(0x3a)(0x80)(0x58)(0x37); // Testnet dash BIP32 prvkeys start with 'DRKP'
|
|
|
|
base58Prefixes[EXT_COIN_TYPE] = list_of(0x80000001); // Testnet dash BIP44 coin type is '5' (All coin's testnet default)
|
2014-03-22 20:09:12 +01:00
|
|
|
|
2014-07-24 13:52:57 +02:00
|
|
|
convertSeed6(vFixedSeeds, pnSeed6_test, ARRAYLEN(pnSeed6_test));
|
|
|
|
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireRPCPassword = true;
|
|
|
|
fMiningRequiresPeers = true;
|
|
|
|
fAllowMinDifficultyBlocks = true;
|
2015-03-13 17:25:34 +01:00
|
|
|
fDefaultConsistencyChecks = false;
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireStandard = false;
|
|
|
|
fMineBlocksOnDemand = false;
|
2014-08-31 22:32:52 +02:00
|
|
|
fTestnetToBeDeprecatedFieldRPC = true;
|
2015-04-03 00:51:08 +02:00
|
|
|
|
|
|
|
nPoolMaxTransactions = 2;
|
|
|
|
strSporkKey = "046f78dcf911fbd61910136f7f0f8d90578f68d0b3ac973b5040fb7afb501b5939f39b108b0569dca71488f5bbf498d92e4d1194f6f941307ffd95f75e76869f0e";
|
|
|
|
strMasternodePaymentsPubKey = "046f78dcf911fbd61910136f7f0f8d90578f68d0b3ac973b5040fb7afb501b5939f39b108b0569dca71488f5bbf498d92e4d1194f6f941307ffd95f75e76869f0e";
|
|
|
|
strDarksendPoolDummyAddress = "y1EZuxhhNMAUofTBEeLqGE1bJrpC2TWRNp";
|
|
|
|
nStartMasternodePayments = 1420837558; //Fri, 09 Jan 2015 21:05:58 GMT
|
2014-06-04 12:51:29 +02:00
|
|
|
}
|
2014-08-31 21:32:23 +02:00
|
|
|
const Checkpoints::CCheckpointData& Checkpoints() const
|
|
|
|
{
|
|
|
|
return dataTestnet;
|
2013-05-07 15:16:25 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
static CTestNetParams testNetParams;
|
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* Regression test
|
|
|
|
*/
|
2013-05-07 15:16:25 +02:00
|
|
|
class CRegTestParams : public CTestNetParams {
|
|
|
|
public:
|
|
|
|
CRegTestParams() {
|
2014-06-19 15:10:04 +02:00
|
|
|
networkID = CBaseChainParams::REGTEST;
|
2014-06-11 12:23:49 +02:00
|
|
|
strNetworkID = "regtest";
|
2014-11-28 10:56:02 +01:00
|
|
|
pchMessageStart[0] = 0xfc;
|
|
|
|
pchMessageStart[1] = 0xc1;
|
|
|
|
pchMessageStart[2] = 0xb7;
|
|
|
|
pchMessageStart[3] = 0xdc;
|
2013-05-07 15:16:25 +02:00
|
|
|
nSubsidyHalvingInterval = 150;
|
2014-03-22 19:52:26 +01:00
|
|
|
nEnforceBlockUpgradeMajority = 750;
|
|
|
|
nRejectBlockOutdatedMajority = 950;
|
|
|
|
nToCheckBlockUpgradeMajority = 1000;
|
2014-03-08 07:47:56 +01:00
|
|
|
nMinerThreads = 1;
|
2015-04-03 00:51:08 +02:00
|
|
|
nTargetTimespan = 24 * 60 * 60; // Dash: 1 day
|
|
|
|
nTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
|
2014-04-20 03:19:20 +02:00
|
|
|
bnProofOfWorkLimit = ~uint256(0) >> 1;
|
2014-12-04 22:24:59 +01:00
|
|
|
genesis.nTime = 1417713337;
|
2013-05-07 15:16:25 +02:00
|
|
|
genesis.nBits = 0x207fffff;
|
2014-12-04 22:24:59 +01:00
|
|
|
genesis.nNonce = 1096447;
|
2014-11-29 12:29:14 +01:00
|
|
|
hashGenesisBlock = genesis.GetHash();
|
2015-04-03 00:51:08 +02:00
|
|
|
nDefaultPort = 19994;
|
2014-12-04 22:24:59 +01:00
|
|
|
assert(hashGenesisBlock == uint256("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"));
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
|
|
|
|
vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds.
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireRPCPassword = false;
|
|
|
|
fMiningRequiresPeers = false;
|
|
|
|
fAllowMinDifficultyBlocks = true;
|
2015-03-13 17:25:34 +01:00
|
|
|
fDefaultConsistencyChecks = true;
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireStandard = false;
|
|
|
|
fMineBlocksOnDemand = true;
|
2014-08-31 22:32:52 +02:00
|
|
|
fTestnetToBeDeprecatedFieldRPC = false;
|
2014-06-04 12:51:29 +02:00
|
|
|
}
|
2014-08-31 21:32:23 +02:00
|
|
|
const Checkpoints::CCheckpointData& Checkpoints() const
|
|
|
|
{
|
|
|
|
return dataRegtest;
|
|
|
|
}
|
2013-05-07 15:16:25 +02:00
|
|
|
};
|
|
|
|
static CRegTestParams regTestParams;
|
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
/**
|
|
|
|
* Unit test
|
|
|
|
*/
|
2014-09-04 21:23:42 +02:00
|
|
|
class CUnitTestParams : public CMainParams, public CModifiableParams {
|
|
|
|
public:
|
|
|
|
CUnitTestParams() {
|
|
|
|
networkID = CBaseChainParams::UNITTEST;
|
|
|
|
strNetworkID = "unittest";
|
|
|
|
nDefaultPort = 18445;
|
2014-10-25 11:24:16 +02:00
|
|
|
vFixedSeeds.clear(); //! Unit test mode doesn't have any fixed seeds.
|
|
|
|
vSeeds.clear(); //! Unit test mode doesn't have any DNS seeds.
|
2014-09-04 21:23:42 +02:00
|
|
|
|
|
|
|
fRequireRPCPassword = false;
|
|
|
|
fMiningRequiresPeers = false;
|
2015-03-13 17:25:34 +01:00
|
|
|
fDefaultConsistencyChecks = true;
|
2014-09-04 21:23:42 +02:00
|
|
|
fAllowMinDifficultyBlocks = false;
|
|
|
|
fMineBlocksOnDemand = true;
|
|
|
|
}
|
2014-08-31 21:32:23 +02:00
|
|
|
|
|
|
|
const Checkpoints::CCheckpointData& Checkpoints() const
|
|
|
|
{
|
|
|
|
// UnitTest share the same checkpoints as MAIN
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2014-10-25 11:24:16 +02:00
|
|
|
//! Published setters to allow changing values in unit test cases
|
2014-09-04 21:23:42 +02:00
|
|
|
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; }
|
|
|
|
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; }
|
|
|
|
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; }
|
|
|
|
virtual void setToCheckBlockUpgradeMajority(int anToCheckBlockUpgradeMajority) { nToCheckBlockUpgradeMajority=anToCheckBlockUpgradeMajority; }
|
2015-03-13 17:25:34 +01:00
|
|
|
virtual void setDefaultConsistencyChecks(bool afDefaultConsistencyChecks) { fDefaultConsistencyChecks=afDefaultConsistencyChecks; }
|
2014-09-04 21:23:42 +02:00
|
|
|
virtual void setAllowMinDifficultyBlocks(bool afAllowMinDifficultyBlocks) { fAllowMinDifficultyBlocks=afAllowMinDifficultyBlocks; }
|
|
|
|
virtual void setSkipProofOfWorkCheck(bool afSkipProofOfWorkCheck) { fSkipProofOfWorkCheck = afSkipProofOfWorkCheck; }
|
|
|
|
};
|
|
|
|
static CUnitTestParams unitTestParams;
|
|
|
|
|
|
|
|
|
2014-06-19 15:10:04 +02:00
|
|
|
static CChainParams *pCurrentParams = 0;
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-09-04 21:23:42 +02:00
|
|
|
CModifiableParams *ModifiableParams()
|
|
|
|
{
|
|
|
|
assert(pCurrentParams);
|
|
|
|
assert(pCurrentParams==&unitTestParams);
|
|
|
|
return (CModifiableParams*)&unitTestParams;
|
|
|
|
}
|
2013-05-07 15:16:25 +02:00
|
|
|
|
|
|
|
const CChainParams &Params() {
|
2014-06-19 15:10:04 +02:00
|
|
|
assert(pCurrentParams);
|
2013-05-07 15:16:25 +02:00
|
|
|
return *pCurrentParams;
|
|
|
|
}
|
|
|
|
|
2014-08-02 20:54:57 +02:00
|
|
|
CChainParams &Params(CBaseChainParams::Network network) {
|
2013-05-07 15:16:25 +02:00
|
|
|
switch (network) {
|
2014-06-19 15:10:04 +02:00
|
|
|
case CBaseChainParams::MAIN:
|
2014-08-02 20:54:57 +02:00
|
|
|
return mainParams;
|
2014-06-19 15:10:04 +02:00
|
|
|
case CBaseChainParams::TESTNET:
|
2014-08-02 20:54:57 +02:00
|
|
|
return testNetParams;
|
2014-06-19 15:10:04 +02:00
|
|
|
case CBaseChainParams::REGTEST:
|
2014-08-02 20:54:57 +02:00
|
|
|
return regTestParams;
|
2014-09-04 21:23:42 +02:00
|
|
|
case CBaseChainParams::UNITTEST:
|
|
|
|
return unitTestParams;
|
2013-05-07 15:16:25 +02:00
|
|
|
default:
|
|
|
|
assert(false && "Unimplemented network");
|
2014-08-02 20:54:57 +02:00
|
|
|
return mainParams;
|
2013-05-07 15:16:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-02 20:54:57 +02:00
|
|
|
void SelectParams(CBaseChainParams::Network network) {
|
|
|
|
SelectBaseParams(network);
|
|
|
|
pCurrentParams = &Params(network);
|
|
|
|
}
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-10-16 22:49:33 +02:00
|
|
|
bool SelectParamsFromCommandLine()
|
2014-09-01 00:41:28 +02:00
|
|
|
{
|
2014-10-09 19:15:38 +02:00
|
|
|
CBaseChainParams::Network network = NetworkIdFromCommandLine();
|
2014-09-01 00:41:28 +02:00
|
|
|
if (network == CBaseChainParams::MAX_NETWORK_TYPES)
|
2013-05-07 15:16:25 +02:00
|
|
|
return false;
|
|
|
|
|
2014-09-01 00:41:28 +02:00
|
|
|
SelectParams(network);
|
2013-05-07 15:16:25 +02:00
|
|
|
return true;
|
|
|
|
}
|