mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Elements: Start Alpha
This commit is contained in:
parent
ee9c9e8183
commit
f5237ea98b
8 changed files with 85 additions and 89 deletions
|
|
@ -16,10 +16,11 @@
|
|||
|
||||
#include "chainparamsseeds.h"
|
||||
|
||||
// Elements: change the name in chainparamsbase.h if you need to change the genesis hash
|
||||
const std::map<std::string, uint256> CChainParams::supportedChains =
|
||||
boost::assign::map_list_of
|
||||
( "main", uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"))
|
||||
( "regtest", uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"))
|
||||
( CHAINPARAMS_ELEMENTS, uint256S("0x300ae16b51c2e42da1e12133c76e4951a08d17b9c346c4a9d9e815c024ebeff7"))
|
||||
( CHAINPARAMS_REGTEST, uint256S("0x64593b5e4b59628d2a93d6685064a98c50560acf968855f276ea01900f2c81e1"))
|
||||
;
|
||||
|
||||
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
||||
|
|
@ -43,24 +44,6 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
|
|||
return genesis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the genesis block. Note that the output of its generation
|
||||
* transaction cannot be spent since 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
|
||||
*/
|
||||
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
||||
{
|
||||
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
|
||||
const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
||||
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
||||
}
|
||||
|
||||
void CChainParams::UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
||||
{
|
||||
consensus.vDeployments[d].nStartTime = nStartTime;
|
||||
|
|
@ -68,20 +51,13 @@ void CChainParams::UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nSta
|
|||
}
|
||||
|
||||
/**
|
||||
* Main network
|
||||
*/
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
* Elements Beta.
|
||||
|
||||
class CMainParams : public CChainParams {
|
||||
*/
|
||||
class CElementsParams : public CChainParams {
|
||||
public:
|
||||
CMainParams() {
|
||||
strNetworkID = "main";
|
||||
CElementsParams() {
|
||||
strNetworkID = CHAINPARAMS_ELEMENTS;
|
||||
consensus.nSubsidyHalvingInterval = 210000;
|
||||
consensus.BIP34Height = 227931;
|
||||
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
|
||||
|
|
@ -119,62 +95,57 @@ public:
|
|||
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
|
||||
* a large 32-bit integer with any alignment.
|
||||
*/
|
||||
pchMessageStart[0] = 0xf9;
|
||||
pchMessageStart[1] = 0xbe;
|
||||
pchMessageStart[2] = 0xb4;
|
||||
pchMessageStart[3] = 0xd9;
|
||||
nDefaultPort = 8333;
|
||||
pchMessageStart[0] = 0xee;
|
||||
pchMessageStart[1] = 0xa1;
|
||||
pchMessageStart[2] = 0x1f;
|
||||
pchMessageStart[3] = 0xfa;
|
||||
nDefaultPort = 4242;
|
||||
nPruneAfterHeight = 100000;
|
||||
|
||||
genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
|
||||
CScript scriptDestination(CScript() << OP_TRUE);
|
||||
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
assert(consensus.hashGenesisBlock == supportedChains.find(strNetworkID)->second);
|
||||
|
||||
// Note that of those with the service bits flag, most only support a subset of possible options
|
||||
vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be", true)); // Pieter Wuille, only supports x1, x5, x9, and xd
|
||||
vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me", true)); // Matt Corallo, only supports x9
|
||||
vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); // Luke Dashjr
|
||||
vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com", true)); // Christian Decker, supports x1 - xf
|
||||
vSeeds.push_back(CDNSSeedData("bitcoin.jonasschnelli.ch", "seed.bitcoin.jonasschnelli.ch", true)); // Jonas Schnelli, only supports x1, x5, x9, and xd
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
|
||||
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();
|
||||
|
||||
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
|
||||
vFixedSeeds.clear(); //! TODO
|
||||
vSeeds.clear(); //! TODO
|
||||
|
||||
fMiningRequiresPeers = true;
|
||||
fDefaultConsistencyChecks = false;
|
||||
fRequireStandard = true;
|
||||
fMineBlocksOnDemand = false;
|
||||
|
||||
checkpointData = (CCheckpointData) {
|
||||
checkpointData = (CCheckpointData){
|
||||
boost::assign::map_list_of
|
||||
( 0, consensus.hashGenesisBlock)
|
||||
( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
|
||||
( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
|
||||
( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
|
||||
(105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
|
||||
(134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
|
||||
(168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
|
||||
(193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
|
||||
(210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
|
||||
(216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
|
||||
(225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
|
||||
(250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))
|
||||
(279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))
|
||||
(295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983"))
|
||||
};
|
||||
|
||||
chainTxData = ChainTxData{
|
||||
// Data as of block 00000000000000000166d612d5595e2b1cd88d71d695fc580af64d8da8658c23 (height 446482).
|
||||
1483472411, // * UNIX timestamp of last known number of transactions
|
||||
184495391, // * total number of transactions between genesis and that timestamp
|
||||
// (the tx=... number in the SetBestChain debug.log lines)
|
||||
3.2 // * estimated number of transactions per second after that timestamp
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
|
||||
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Use production base58 for tests
|
||||
*/
|
||||
class CMainParams : public CElementsParams {
|
||||
public:
|
||||
CMainParams() : CElementsParams() {
|
||||
strNetworkID = CHAINPARAMS_OLD_MAIN;
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
|
||||
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -184,7 +155,7 @@ public:
|
|||
class CRegTestParams : public CChainParams {
|
||||
public:
|
||||
CRegTestParams() {
|
||||
strNetworkID = "regtest";
|
||||
strNetworkID = CHAINPARAMS_REGTEST;
|
||||
consensus.nSubsidyHalvingInterval = 150;
|
||||
consensus.BIP34Height = 100000000; // BIP34 has not activated on regtest (far in the future so block v1 are not rejected in tests)
|
||||
consensus.BIP34Hash = uint256();
|
||||
|
|
@ -220,9 +191,9 @@ public:
|
|||
nDefaultPort = 18444;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
|
||||
CScript scriptDestination(CScript() << OP_TRUE);
|
||||
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1296688602, 2, 0x207fffff, 1, 50 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
assert(consensus.hashGenesisBlock == supportedChains.find(strNetworkID)->second);
|
||||
|
||||
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
|
||||
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
|
||||
|
|
@ -330,6 +301,8 @@ std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain)
|
|||
{
|
||||
if (chain == CBaseChainParams::MAIN)
|
||||
return std::unique_ptr<CChainParams>(new CMainParams());
|
||||
else if (chain == CHAINPARAMS_ELEMENTS)
|
||||
return std::unique_ptr<CChainParams>(new CElementsParams());
|
||||
else if (chain == CBaseChainParams::REGTEST)
|
||||
return std::unique_ptr<CChainParams>(new CRegTestParams());
|
||||
else if (chain == CBaseChainParams::CUSTOM) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue