Fabcoin Core  0.16.2
P2P Digital Currency
chainparams.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2017 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 FABCOIN_CHAINPARAMS_H
7 #define FABCOIN_CHAINPARAMS_H
8 
9 #include <chainparamsbase.h>
10 #include <consensus/params.h>
11 #include <primitives/block.h>
12 #include <protocol.h>
13 
14 #include <memory>
15 #include <vector>
16 
17 struct CDNSSeedData {
18  std::string host;
20  CDNSSeedData(const std::string &strHost, bool supportsServiceBitsFilteringIn) : host(strHost), supportsServiceBitsFiltering(supportsServiceBitsFilteringIn) {}
21 };
22 
23 struct SeedSpec6 {
24  uint8_t addr[16];
25  uint16_t port;
26 };
27 
28 typedef std::map<int, uint256> MapCheckpoints;
29 
32 };
33 
34 struct ChainTxData {
35  int64_t nTime;
36  int64_t nTxCount;
37  double dTxRate;
38 };
39 
48 {
49 public:
50  enum Base58Type {
56 
57  MAX_BASE58_TYPES
58  };
59 
60  const Consensus::Params& GetConsensus() const { return consensus; }
61  const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
62  int GetDefaultPort() const { return nDefaultPort; }
63 
64  const CBlock& GenesisBlock() const { return genesis; }
66  bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
68  bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
70  bool RequireStandard() const { return fRequireStandard; }
71  uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
72  unsigned int EquihashN(uint32_t nHeight = 0) const { return (nHeight < consensus.EquihashFABHeight) /*|| (strNetworkID != CBaseChainParams::MAIN)*/ ? nEquihashN : 184; }
73  unsigned int EquihashK(uint32_t nHeight = 0) const { return (nHeight < consensus.EquihashFABHeight) /*|| (strNetworkID != CBaseChainParams::MAIN)*/ ? nEquihashK : 7; }
74  int64_t GetnPowTargetSpacing( uint32_t nHeight = 0 ) const { return (nHeight < consensus.EquihashFABHeight) ? consensus.nPowTargetSpacing : 2* consensus.nPowTargetSpacing; }
76  bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
78  std::string NetworkIDString() const { return strNetworkID; }
79  const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
80  const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
81  const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
82  const CCheckpointData& Checkpoints() const { return checkpointData; }
83  const ChainTxData& TxData() const { return chainTxData; }
84  void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
85 protected:
87 
92  unsigned int nEquihashN = 0;
93  unsigned int nEquihashK = 0;
94  std::vector<CDNSSeedData> vSeeds;
95  std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
96  std::string strNetworkID;
98  std::vector<SeedSpec6> vFixedSeeds;
105 };
106 
112 std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain);
113 
118 const CChainParams &Params();
119 const CChainParams &GetParams();
124 void SelectParams(const std::string& chain);
125 
129 void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
130 
131 #endif // FABCOIN_CHAINPARAMS_H
bool fMineBlocksOnDemand
Definition: chainparams.h:102
std::string host
Definition: chainparams.h:18
bool MineBlocksOnDemand() const
Make miner stop after a block is found.
Definition: chainparams.h:76
int nDefaultPort
Definition: chainparams.h:90
double dTxRate
Definition: chainparams.h:37
std::map< int, uint256 > MapCheckpoints
Definition: chainparams.h:28
Definition: block.h:155
unsigned int EquihashN(uint32_t nHeight=0) const
Definition: chainparams.h:72
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:60
const CChainParams & GetParams()
CChainParams defines various tweakable parameters of a given instance of the Fabcoin system...
Definition: chainparams.h:47
CBlock genesis
Definition: chainparams.h:97
int64_t nTime
Definition: chainparams.h:35
CMessageHeader::MessageStartChars pchMessageStart
Definition: chainparams.h:89
const std::vector< unsigned char > & Base58Prefix(Base58Type type) const
Definition: chainparams.h:80
ChainTxData chainTxData
Definition: chainparams.h:104
int64_t nTxCount
Definition: chainparams.h:36
int64_t GetnPowTargetSpacing(uint32_t nHeight=0) const
Definition: chainparams.h:74
std::string NetworkIDString() const
Return the BIP70 network string (main, test or regtest)
Definition: chainparams.h:78
bool supportsServiceBitsFiltering
Definition: chainparams.h:19
uint64_t PruneAfterHeight() const
Definition: chainparams.h:71
uint16_t port
Definition: chainparams.h:25
int GetDefaultPort() const
Definition: chainparams.h:62
DeploymentPos
Definition: params.h:15
bool fRequireStandard
Definition: chainparams.h:101
void SelectParams(const std::string &chain)
Sets the params returned by Params() to those for the given BIP70 chain name.
const ChainTxData & TxData() const
Definition: chainparams.h:83
const CMessageHeader::MessageStartChars & MessageStart() const
Definition: chainparams.h:61
Parameters that influence chain consensus.
Definition: params.h:39
std::vector< CDNSSeedData > vSeeds
Definition: chainparams.h:94
unsigned char MessageStartChars[MESSAGE_START_SIZE]
Definition: protocol.h:40
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
Allows modifying the Version Bits regtest parameters.
const CChainParams & Params()
Return the currently selected parameters.
std::vector< SeedSpec6 > vFixedSeeds
Definition: chainparams.h:98
bool fRequireStandard
Definition: validation.cpp:92
MapCheckpoints mapCheckpoints
Definition: chainparams.h:31
PlatformStyle::TableColorType type
Definition: rpcconsole.cpp:61
const CBlock & GenesisBlock() const
Definition: chainparams.h:64
Consensus::Params consensus
Definition: chainparams.h:88
std::string strNetworkID
Definition: chainparams.h:96
bool fMiningRequiresPeers
Definition: chainparams.h:99
bool RequireStandard() const
Policy: Filter transactions that do not match well-defined patterns.
Definition: chainparams.h:70
uint64_t nPruneAfterHeight
Definition: chainparams.h:91
bool DefaultConsistencyChecks() const
Default value for -checkmempool and -checkblockindex argument.
Definition: chainparams.h:68
#define d(i)
Definition: sha.cpp:732
bool MiningRequiresPeers() const
Make miner wait to have peers to avoid wasting work.
Definition: chainparams.h:66
CCheckpointData checkpointData
Definition: chainparams.h:103
std::unique_ptr< CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
const std::vector< CDNSSeedData > & DNSSeeds() const
Definition: chainparams.h:79
CDNSSeedData(const std::string &strHost, bool supportsServiceBitsFilteringIn)
Definition: chainparams.h:20
unsigned int EquihashK(uint32_t nHeight=0) const
Definition: chainparams.h:73
const std::vector< SeedSpec6 > & FixedSeeds() const
Definition: chainparams.h:81
const CCheckpointData & Checkpoints() const
Definition: chainparams.h:82
bool fDefaultConsistencyChecks
Definition: chainparams.h:100