1 // Copyright (c) 2014-2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_CHAINPARAMSBASE_H
6 #define BITCOIN_CHAINPARAMSBASE_H
13 * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
14 * of a given instance of the Bitcoin system.
16 class CBaseChainParams
19 /** BIP70 chain name strings (main, test or regtest) */
20 static const std::string MAIN
;
21 static const std::string TESTNET
;
22 static const std::string REGTEST
;
24 const std::string
& DataDir() const { return strDataDir
; }
25 int RPCPort() const { return nRPCPort
; }
31 std::string strDataDir
;
35 * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
36 * @returns a CBaseChainParams* of the chosen chain.
37 * @throws a std::runtime_error if the chain is not supported.
39 std::unique_ptr
<CBaseChainParams
> CreateBaseChainParams(const std::string
& chain
);
42 * Append the help messages for the chainparams options to the
45 void AppendParamsHelpMessages(std::string
& strUsage
, bool debugHelp
=true);
48 * Return the currently selected parameters. This won't change after app
49 * startup, except for unit tests.
51 const CBaseChainParams
& BaseParams();
53 /** Sets the params returned by Params() to those for the given network. */
54 void SelectBaseParams(const std::string
& chain
);
57 * Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
58 * @return CBaseChainParams::MAX_NETWORK_TYPES if an invalid combination is given. CBaseChainParams::MAIN by default.
60 std::string
ChainNameFromCommandLine();
62 #endif // BITCOIN_CHAINPARAMSBASE_H