Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2014-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_CHAINPARAMSBASE_H6#define BITCOIN_CHAINPARAMSBASE_H8#include <util/chaintype.h>10#include <cstdint>11#include <memory>12#include <string>14class ArgsManager;16/**17* CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)18* of a given instance of the Bitcoin system.19*/20class CBaseChainParams21{22public:23const std::string& DataDir() const { return strDataDir; }24uint16_t RPCPort() const { return m_rpc_port; }26CBaseChainParams() = delete;27CBaseChainParams(const std::string& data_dir, uint16_t rpc_port)28: m_rpc_port(rpc_port), strDataDir(data_dir) {}30private:31const uint16_t m_rpc_port;32std::string strDataDir;33};35/**36* Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.37*/38std::unique_ptr<CBaseChainParams> CreateBaseChainParams(ChainType chain);40/**41*Set the arguments for chainparams42*/43void SetupChainParamsBaseOptions(ArgsManager& argsman);45/**46* Return the currently selected parameters. This won't change after app47* startup, except for unit tests.48*/49const CBaseChainParams& BaseParams();51/** Sets the params returned by Params() to those for the given chain. */52void SelectBaseParams(ChainType chain);54/** List of possible chain / network names */55#define LIST_CHAIN_NAMES "main, test, testnet4, signet, regtest"57#endif // BITCOIN_CHAINPARAMSBASE_H