Bitcoin Core  0.18.99
P2P Digital Currency
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2018 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or
9 #include <chainparamsbase.h>
10 #include <consensus/params.h>
11 #include <primitives/block.h>
12 #include <protocol.h>
14 #include <memory>
15 #include <vector>
17 struct SeedSpec6 {
18  uint8_t addr[16];
19  uint16_t port;
20 };
22 typedef std::map<int, uint256> MapCheckpoints;
26 };
34 struct ChainTxData {
35  int64_t nTime;
36  int64_t nTxCount;
37  double dTxRate;
38 };
48 {
49 public:
50  enum Base58Type {
58  };
60  const Consensus::Params& GetConsensus() const { return consensus; }
61  const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
62  int GetDefaultPort() const { return nDefaultPort; }
64  const CBlock& GenesisBlock() const { return genesis; }
66  bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
68  bool RequireStandard() const { return fRequireStandard; }
69  uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
71  uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
73  uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
75  bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
77  std::string NetworkIDString() const { return strNetworkID; }
79  bool IsFallbackFeeEnabled() const { return m_fallback_fee_enabled; }
81  const std::vector<std::string>& DNSSeeds() const { return vSeeds; }
82  const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
83  const std::string& Bech32HRP() const { return bech32_hrp; }
84  const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
85  const CCheckpointData& Checkpoints() const { return checkpointData; }
86  const ChainTxData& TxData() const { return chainTxData; }
87 protected:
96  std::vector<std::string> vSeeds;
97  std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
98  std::string bech32_hrp;
99  std::string strNetworkID;
101  std::vector<SeedSpec6> vFixedSeeds;
108 };
115 std::unique_ptr<const CChainParams> CreateChainParams(const std::string& chain);
121 const CChainParams &Params();
127 void SelectParams(const std::string& chain);
const std::vector< std::string > & DNSSeeds() const
Return the list of hostnames to look up for DNS seeds.
Definition: chainparams.h:81
std::string NetworkIDString() const
Return the BIP70 network string (main, test or regtest)
Definition: chainparams.h:77
bool fMineBlocksOnDemand
Definition: chainparams.h:104
int nDefaultPort
Definition: chainparams.h:92
double dTxRate
estimated number of transactions per second after that timestamp
Definition: chainparams.h:37
std::map< int, uint256 > MapCheckpoints
Definition: chainparams.h:22
Definition: block.h:72
const std::string & Bech32HRP() const
Definition: chainparams.h:83
uint64_t AssumedChainStateSize() const
Minimum free space (in GB) needed for data directory when pruned; Does not include prune target...
Definition: chainparams.h:73
uint64_t m_assumed_chain_state_size
Definition: chainparams.h:95
bool DefaultConsistencyChecks() const
Default value for -checkmempool and -checkblockindex argument.
Definition: chainparams.h:66
const CBlock & GenesisBlock() const
Definition: chainparams.h:64
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
Definition: chainparams.h:47
std::string bech32_hrp
Definition: chainparams.h:98
CBlock genesis
Definition: chainparams.h:100
int64_t nTime
UNIX timestamp of last known number of transactions.
Definition: chainparams.h:35
const CCheckpointData & Checkpoints() const
Definition: chainparams.h:85
CMessageHeader::MessageStartChars pchMessageStart
Definition: chainparams.h:91
ChainTxData chainTxData
Definition: chainparams.h:106
uint64_t m_assumed_blockchain_size
Definition: chainparams.h:94
int64_t nTxCount
total number of transactions between genesis and that timestamp
Definition: chainparams.h:36
uint64_t PruneAfterHeight() const
Definition: chainparams.h:69
uint16_t port
Definition: chainparams.h:19
bool m_fallback_fee_enabled
Definition: chainparams.h:107
bool MineBlocksOnDemand() const
Make miner stop after a block is found.
Definition: chainparams.h:75
bool fRequireStandard
Definition: chainparams.h:103
Holds various statistics on transactions within a chain.
Definition: chainparams.h:34
void SelectParams(const std::string &chain)
Sets the params returned by Params() to those for the given BIP70 chain name.
std::vector< std::string > vSeeds
Definition: chainparams.h:96
const CMessageHeader::MessageStartChars & MessageStart() const
Definition: chainparams.h:61
int GetDefaultPort() const
Definition: chainparams.h:62
Parameters that influence chain consensus.
Definition: params.h:49
unsigned char MessageStartChars[MESSAGE_START_SIZE]
Definition: protocol.h:38
bool RequireStandard() const
Policy: Filter transactions that do not match well-defined patterns.
Definition: chainparams.h:68
const CChainParams & Params()
Return the currently selected parameters.
const ChainTxData & TxData() const
Definition: chainparams.h:86
std::vector< SeedSpec6 > vFixedSeeds
Definition: chainparams.h:101
bool fRequireStandard
Definition: validation.cpp:247
uint64_t AssumedBlockchainSize() const
Minimum free space (in GB) needed for data directory.
Definition: chainparams.h:71
MapCheckpoints mapCheckpoints
Definition: chainparams.h:25
Consensus::Params consensus
Definition: chainparams.h:90
std::string strNetworkID
Definition: chainparams.h:99
const std::vector< SeedSpec6 > & FixedSeeds() const
Definition: chainparams.h:84
uint64_t nPruneAfterHeight
Definition: chainparams.h:93
bool IsFallbackFeeEnabled() const
Return true if the fallback fee is by default enabled for this network.
Definition: chainparams.h:79
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:60
uint8_t addr[16]
Definition: chainparams.h:18
CCheckpointData checkpointData
Definition: chainparams.h:105
std::unique_ptr< const CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
bool fDefaultConsistencyChecks
Definition: chainparams.h:102
const std::vector< unsigned char > & Base58Prefix(Base58Type type) const
Definition: chainparams.h:82