Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
chainparams.h
Go to the documentation of this file.
1// Copyright (c) 2010 Satoshi Nakamoto
2// Copyright (c) 2009-2021 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#ifndef BITCOIN_KERNEL_CHAINPARAMS_H
7#define BITCOIN_KERNEL_CHAINPARAMS_H
8
9#include <consensus/params.h>
10#include <netaddress.h>
11#include <primitives/block.h>
12#include <protocol.h>
13#include <uint256.h>
14#include <util/hash_type.h>
15
16#include <cstdint>
17#include <iterator>
18#include <map>
19#include <memory>
20#include <optional>
21#include <string>
22#include <unordered_map>
23#include <utility>
24#include <vector>
25
30
31typedef std::map<int, BlockHash> MapCheckpoints;
32
36
37struct AssumeutxoHash : public BaseHash<uint256> {
38 explicit AssumeutxoHash(const uint256 &hash) : BaseHash(hash) {}
39};
40
49
56 const unsigned int nChainTx;
57};
58
59using MapAssumeutxo = std::map<int, const AssumeutxoData>;
60
72
81public:
91
92 const Consensus::Params &GetConsensus() const { return consensus; }
99 uint16_t GetDefaultPort(const std::string &addr) const {
100 CNetAddr a;
101 return a.SetSpecial(addr) ? GetDefaultPort(a.GetNetwork())
102 : GetDefaultPort();
103 }
104
105 const CBlock &GenesisBlock() const { return genesis; }
109 bool RequireStandard() const { return fRequireStandard; }
111 bool IsTestChain() const { return m_is_test_chain; }
113 bool IsMockableChain() const { return m_is_mockable_chain; }
127 std::string NetworkIDString() const { return strNetworkID; }
129 const std::vector<uint8_t> &Base58Prefix(Base58Type type) const {
130 return base58Prefixes[type];
131 }
132 const std::string &CashAddrPrefix() const { return cashaddrPrefix; }
133 const std::vector<SeedSpec6> &FixedSeeds() const { return vFixedSeeds; }
134 const CCheckpointData &Checkpoints() const { return checkpointData; }
135
138 const MapAssumeutxo &Assumeutxo() const { return m_assumeutxo_data; }
139
140 const ChainTxData &TxData() const { return chainTxData; }
141
143 bool ecash{true};
144 bool fastprune{false};
145 };
146
147 static std::unique_ptr<const CChainParams>
148 RegTest(const ChainOptions &options);
149 static std::unique_ptr<const CChainParams>
150 Main(const ChainOptions &options);
151 static std::unique_ptr<const CChainParams>
152 TestNet(const ChainOptions &options);
153
154protected:
156
164 std::vector<std::string> vSeeds;
165 std::vector<uint8_t> base58Prefixes[MAX_BASE58_TYPES];
166 std::string cashaddrPrefix;
167 std::string strNetworkID;
169 std::vector<SeedSpec6> vFixedSeeds;
177
178 friend const std::vector<std::string>
179 GetRandomizedDNSSeeds(const CChainParams &params);
180};
181
182const CCheckpointData &CheckpointData(const std::string &chain);
183
184#endif // BITCOIN_KERNEL_CHAINPARAMS_H
Definition block.h:60
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition chainparams.h:80
uint64_t m_assumed_chain_state_size
const CBlock & GenesisBlock() const
bool DefaultConsistencyChecks() const
Default value for -checkmempool and -checkblockindex argument.
const CMessageHeader::MessageMagic & NetMagic() const
Definition chainparams.h:94
const CMessageHeader::MessageMagic & DiskMagic() const
Definition chainparams.h:93
const std::vector< SeedSpec6 > & FixedSeeds() const
bool m_is_test_chain
std::string NetworkIDString() const
Return the BIP70 network string (main, test or regtest)
uint16_t GetDefaultPort(const std::string &addr) const
Definition chainparams.h:99
bool RequireStandard() const
Policy: Filter transactions that do not match well-defined patterns.
MapAssumeutxo m_assumeutxo_data
const std::vector< uint8_t > & Base58Prefix(Base58Type type) const
Return the list of hostnames to look up for DNS seeds.
uint64_t m_assumed_blockchain_size
bool IsMockableChain() const
If this chain allows time to be mocked.
CMessageHeader::MessageMagic netMagic
std::vector< uint8_t > base58Prefixes[MAX_BASE58_TYPES]
bool fDefaultConsistencyChecks
std::vector< SeedSpec6 > vFixedSeeds
const ChainTxData & TxData() const
std::string strNetworkID
friend const std::vector< std::string > GetRandomizedDNSSeeds(const CChainParams &params)
Return the list of hostnames to look up for DNS seeds.
Definition dnsseeds.cpp:11
const Consensus::Params & GetConsensus() const
Definition chainparams.h:92
bool IsTestChain() const
If this chain is exclusively used for testing.
bool MineBlocksOnDemand() const
Whether it is possible to mine blocks on demand (no retargeting)
Consensus::Params consensus
static std::unique_ptr< const CChainParams > TestNet(const ChainOptions &options)
uint16_t GetDefaultPort() const
Definition chainparams.h:95
static std::unique_ptr< const CChainParams > RegTest(const ChainOptions &options)
const std::string & CashAddrPrefix() const
uint64_t AssumedBlockchainSize() const
Minimum free space (in GB) needed for data directory.
bool fRequireStandard
std::string cashaddrPrefix
std::vector< std::string > vSeeds
bool m_is_mockable_chain
CMessageHeader::MessageMagic diskMagic
static std::unique_ptr< const CChainParams > Main(const ChainOptions &options)
uint64_t AssumedChainStateSize() const
Minimum free space (in GB) needed for data directory when pruned; Does not include prune target.
uint64_t PruneAfterHeight() const
CCheckpointData checkpointData
uint16_t nDefaultPort
const MapAssumeutxo & Assumeutxo() const
Get allowed assumeutxo configuration.
const CCheckpointData & Checkpoints() const
uint64_t nPruneAfterHeight
ChainTxData chainTxData
uint16_t GetDefaultPort(Network net) const
Definition chainparams.h:96
std::array< uint8_t, MESSAGE_START_SIZE > MessageMagic
Definition protocol.h:46
Network address.
Definition netaddress.h:121
bool SetSpecial(const std::string &addr)
Parse a Tor or I2P address and set this object to it.
256-bit opaque blob.
Definition uint256.h:129
std::map< int, const AssumeutxoData > MapAssumeutxo
Definition chainparams.h:59
std::map< int, BlockHash > MapCheckpoints
Definition chainparams.h:31
const CCheckpointData & CheckpointData(const std::string &chain)
static constexpr uint16_t I2P_SAM31_PORT
SAM 3.1 and earlier do not support specifying ports and force the port to 0.
Definition netaddress.h:116
Network
A network type.
Definition netaddress.h:44
@ NET_I2P
I2P.
Definition netaddress.h:59
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
Holds configuration for use during UTXO snapshot load and validation.
Definition chainparams.h:46
const AssumeutxoHash hash_serialized
The expected hash of the deserialized UTXO set.
Definition chainparams.h:48
const unsigned int nChainTx
Used to populate the nChainTx value, which is used during BlockManager::LoadBlockIndex().
Definition chainparams.h:56
AssumeutxoHash(const uint256 &hash)
Definition chainparams.h:38
MapCheckpoints mapCheckpoints
Definition chainparams.h:34
Holds various statistics on transactions within a chain.
Definition chainparams.h:67
double dTxRate
Definition chainparams.h:70
int64_t nTime
Definition chainparams.h:68
int64_t nTxCount
Definition chainparams.h:69
Parameters that influence chain consensus.
Definition params.h:34
bool fPowNoRetargeting
Definition params.h:78
uint16_t port
Definition chainparams.h:28
uint8_t addr[16]
Definition chainparams.h:27