Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

chainparams.cpp File Reference
#include <chainparams.h>
#include <consensus/merkle.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
#include <arith_uint256.h>
#include <assert.h>
#include <memory>
#include <chainparamsseeds.h>
+ Include dependency graph for chainparams.cpp:

Go to the source code of this file.

Classes

class  CMainParams
 Main network. More...
 
class  CTestNetParams
 Testnet (v3) More...
 
class  CDevNetParams
 Devnet. More...
 
class  CRegTestParams
 Regression test. More...
 

Functions

static CBlock CreateGenesisBlock (const char *pszTimestamp, const CScript &genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount &genesisReward)
 
static CBlock CreateDevNetGenesisBlock (const uint256 &prevBlockHash, const std::string &devNetName, uint32_t nTime, uint32_t nNonce, uint32_t nBits, const CAmount &genesisReward)
 
static CBlock CreateGenesisBlock (uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount &genesisReward)
 Build the genesis block. More...
 
static CBlock FindDevNetGenesisBlock (const CBlock &prevBlock, const CAmount &reward)
 
const CChainParamsParams ()
 Return the currently selected parameters. More...
 
std::unique_ptr< CChainParamsCreateChainParams (const std::string &chain)
 Creates and returns a std::unique_ptr<CChainParams> of the chosen chain. More...
 
void SelectParams (const std::string &network)
 Sets the params returned by Params() to those for the given BIP70 chain name. More...
 
void UpdateVersionBitsParameters (Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThresholdStart, int64_t nThresholdMin, int64_t nFalloffCoeff)
 Allows modifying the Version Bits regtest parameters. More...
 
void UpdateDIP3Parameters (int nActivationHeight, int nEnforcementHeight)
 Allows modifying the DIP3 activation and enforcement height. More...
 
void UpdateBudgetParameters (int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
 Allows modifying the budget regtest parameters. More...
 
void UpdateDevnetSubsidyAndDiffParams (int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor)
 Allows modifying the subsidy and difficulty devnet parameters. More...
 
void UpdateDevnetLLMQChainLocks (Consensus::LLMQType llmqType)
 Allows modifying the LLMQ type for ChainLocks. More...
 
void UpdateLLMQTestParams (int size, int threshold)
 Allows modifying parameters of the test LLMQ. More...
 
void UpdateLLMQDevnetParams (int size, int threshold)
 Allows modifying parameters of the devnet LLMQ. More...
 

Variables

static Consensus::LLMQParams llmq_test
 
static Consensus::LLMQParams llmq_devnet
 
static Consensus::LLMQParams llmq50_60
 
static Consensus::LLMQParams llmq400_60
 
static Consensus::LLMQParams llmq400_85
 
static std::unique_ptr< CChainParamsglobalChainParams
 

Function Documentation

◆ CreateChainParams()

std::unique_ptr<CChainParams> CreateChainParams ( const std::string &  chain)

Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.

Returns
a CChainParams* of the chosen chain.
Exceptions
astd::runtime_error if the chain is not supported.

Definition at line 952 of file chainparams.cpp.

References CBaseChainParams::DEVNET, CBaseChainParams::MAIN, CBaseChainParams::REGTEST, strprintf, and CBaseChainParams::TESTNET.

Referenced by CheckService(), DeserializeAndCheckBlockTest(), HelpMessage(), PaymentServer::ipcParseCommandLine(), and SelectParams().

◆ CreateDevNetGenesisBlock()

static CBlock CreateDevNetGenesisBlock ( const uint256 prevBlockHash,
const std::string &  devNetName,
uint32_t  nTime,
uint32_t  nNonce,
uint32_t  nBits,
const CAmount genesisReward 
)
static

◆ CreateGenesisBlock() [1/2]

◆ CreateGenesisBlock() [2/2]

static CBlock CreateGenesisBlock ( uint32_t  nTime,
uint32_t  nNonce,
uint32_t  nBits,
int32_t  nVersion,
const CAmount genesisReward 
)
static

Build the genesis block.

Note that the output of its generation transaction cannot be spent since it did not originally exist in the database.

CBlock(hash=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1390095618, nBits=1e0ffff0, nNonce=28917698, vtx=1) CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0) CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73) CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF) vMerkleTree: e0028e

Definition at line 77 of file chainparams.cpp.

References CreateGenesisBlock(), OP_CHECKSIG, and ParseHex().

◆ FindDevNetGenesisBlock()

static CBlock FindDevNetGenesisBlock ( const CBlock prevBlock,
const CAmount reward 
)
static

◆ Params()

const CChainParams& Params ( )

Return the currently selected parameters.

This won't change after app startup, except for unit tests.

Definition at line 947 of file chainparams.cpp.

References globalChainParams.

Referenced by AcceptToMemoryPool(), CNetFulfilledRequestManager::AddFulfilledRequest(), AddLocal(), AppInitMain(), AppInitParameterInteraction(), llmq::CSigningManager::AsyncSignIfMember(), BuildDMNListEntry(), CDeterministicMNManager::BuildNewListFromBlock(), BuildSimplifiedMNListDiff(), CalcCbTxMerkleRootQuorums(), CBitcoinExtKeyBase< K, Size, Type >::CBitcoinExtKeyBase(), llmq::CDKGSessionManager::CDKGSessionManager(), llmq::CChainLocksHandler::CheckActiveState(), CheckCbTx(), llmq::CheckLLMQCommitment(), CGovernanceManager::CheckPostponedObjects(), CheckService(), CGovernanceVote::CheckSignature(), CSporkMessage::CheckSignature(), CheckSpecialTx(), llmq::CChainLocksHandler::Cleanup(), CDeterministicMNManager::CleanupCache(), llmq::CSigSharesManager::CollectSigSharesToAnnounce(), llmq::CSigSharesManager::CollectSigSharesToRequest(), CChainState::ConnectBlock(), CConnman::ConnectNode(), ContextualCheckBlockHeader(), BlockAssembler::CreateNewBlock(), llmq::CRecoveredSigsDb::CRecoveredSigsDb(), CHDChain::DeriveChildExtKey(), BitcoinUnits::description(), CChainState::DisconnectBlock(), CPrivateSendClientSession::DoAutomaticDenominating(), llmq::CChainLocksHandler::DoInvalidateBlock(), llmq::CChainLocksHandler::EnforceBestChainLock(), llmq::CQuorumManager::EnsureQuorumConnections(), PartiallyDownloadedBlock::FillBlock(), FlushStateToDisk(), CConnman::GetAddedNodeInfo(), llmq::CLLMQUtils::GetAllQuorumMembers(), getblockchaininfo(), GetBlockChecked(), getblockstats(), GetBlockSubsidy(), getblocktemplate(), CMasternodePayments::GetBlockTxOuts(), llmq::CChainLocksHandler::GetBlockTxs(), getchaintxstats(), llmq::CQuorumBlockProcessor::GetCommitmentsFromBlock(), getgovernanceinfo(), CHDPubKey::GetKeyPath(), ClientModel::getLastBlockDate(), ClientModel::getLastBlockHash(), GetListenPort(), CDeterministicMNManager::GetListForBlock(), CActiveMasternodeManager::GetLocalAddress(), GetMasternodePayment(), CPrivateSend::GetMaxPoolParticipants(), getmerkleblocks(), llmq::CQuorumBlockProcessor::GetMinableCommitment(), llmq::CQuorumBlockProcessor::GetMinedAndActiveCommitmentsUntilBlock(), getmininginfo(), CPrivateSend::GetMinPoolParticipants(), CSuperblock::GetNearestSuperblocksHeights(), GetNetworkHashPS(), CSuperblock::GetPaymentsLimit(), llmq::CQuorumManager::GetQuorum(), llmq::CQuorumBlockProcessor::GetQuorumBlockHash(), llmq::CLLMQUtils::GetQuorumConnections(), getrawtransaction(), CSporkMessage::GetSignerKeyID(), gettxoutproof(), ClientModel::getVerificationProgress(), llmq::CInstantSendManager::HandleFullyConfirmedBlock(), llmq::CInstantSendManager::HandleNewInputLockRecoveredSig(), llmq::CInstantSendManager::HandleNewRecoveredSig(), CNetFulfilledRequestManager::HasFulfilledRequest(), CActiveMasternodeManager::Init(), llmq::CDKGDebugManager::InitLocalSessionStatus(), llmq::CDKGSessionHandler::InitNewQuorum(), llmq::InitSession(), invalidateblock(), IsBlockPayeeValid(), IsBlockValueValid(), CGovernanceObject::IsCollateralValid(), CDeterministicMNManager::IsDIP3Enforced(), CSuperblock::IsExpired(), IsInitialBlockDownload(), llmq::CQuorumBlockProcessor::IsMiningPhase(), IsOldBudgetBlockValueValid(), llmq::CLLMQUtils::IsQuorumActive(), CBitcoinSecret::IsValid(), CSuperblock::IsValidBlockHeight(), CActiveMasternodeManager::IsValidNetAddr(), listsinceblock(), LoadMempool(), main(), CGovernanceManager::MasternodeRateCheck(), BitcoinUnits::name(), CZMQPublishRawBlockNotifier::NotifyBlock(), CZMQPublishRawChainLockNotifier::NotifyChainLock(), CZMQPublishRawChainLockSigNotifier::NotifyChainLock(), CConnman::OpenNetworkConnection(), PeerLogicValidation::PeerLogicValidation(), preciousblock(), llmq::CSigningManager::PreVerifyRecoveredSig(), llmq::CQuorumBlockProcessor::ProcessBlock(), CDeterministicMNManager::ProcessBlock(), llmq::CQuorumBlockProcessor::ProcessCommitment(), ProcessGetBlockData(), llmq::CInstantSendManager::ProcessInstantSendLock(), llmq::CQuorumBlockProcessor::ProcessMessage(), CMNAuth::ProcessMessage(), ProcessMessage(), PeerLogicValidation::ProcessMessages(), llmq::CSigSharesManager::ProcessMessageSigSesAnn(), llmq::CChainLocksHandler::ProcessNewChainLock(), llmq::CInstantSendManager::ProcessNewTransaction(), llmq::CInstantSendManager::ProcessPendingInstantSendLocks(), llmq::CInstantSendManager::ProcessPendingRetryLockTxs(), CMasternodeSync::ProcessTick(), PruneAndFlush(), pruneblockchain(), PruneBlockFilesManual(), CConnman::PushMessage(), CMNAuth::PushMNAUTH(), quorum_dkgstatus(), quorum_info(), quorum_list(), quorum_memberof(), quorum_selectquorum(), quorum_sigs_cmd(), CFlatDB< T >::Read(), CNode::ReceiveMsgBytes(), reconsiderblock(), CNetFulfilledRequestManager::RemoveAllFulfilledRequests(), CNetFulfilledRequestManager::RemoveFulfilledRequest(), CGovernanceManager::RequestGovernanceObject(), CGovernanceManager::RequestGovernanceObjectVotes(), llmq::CInstantSendManager::ResolveBlockConflicts(), rest_block(), rest_tx(), CWallet::ScanForWalletTransactions(), llmq::CQuorumManager::ScanQuorums(), llmq::CSigningManager::SelectQuorumForSigning(), PeerLogicValidation::SendMessages(), RPCConsole::setClientModel(), CBitcoinSecret::SetKey(), CBitcoinExtKeyBase< K, Size, Type >::SetKey(), setmocktime(), SendCoinsDialog::setModel(), GUIUtil::setupAddressWidget(), CGovernanceVote::Sign(), CSporkMessage::Sign(), llmq::CDKGSessionHandler::SleepBeforePhase(), submitblock(), CConnman::ThreadDNSAddressSeed(), ThreadImport(), CConnman::ThreadOpenConnections(), CConnman::ThreadOpenMasternodeConnections(), ModalOverlay::tipUpdate(), llmq::CDKGDebugSessionStatus::ToJson(), llmq::CDKGDebugStatus::ToJson(), llmq::CInstantSendManager::TruncateRecoveredSigsForInputs(), llmq::CChainLocksHandler::TrySignChainTip(), llmq::CInstantSendManager::TrySignInstantSendLock(), CDeterministicMNManager::UndoBlock(), CGovernanceManager::UpdateCachesAndClean(), CDSNotificationInterface::UpdatedBlockTip(), llmq::CDKGSessionManager::UpdatedBlockTip(), llmq::CQuorumManager::UpdatedBlockTip(), llmq::CInstantSendManager::UpdatedBlockTip(), BitcoinGUI::updateHeadersSyncProgressLabel(), CGovernanceObject::UpdateSentinelVariables(), llmq::CQuorumBlockProcessor::UpgradeDB(), CDeterministicMNManager::UpgradeDBIfNeeded(), llmq::CFinalCommitment::Verify(), verifychain(), PaymentServer::verifyNetwork(), llmq::CFinalCommitment::VerifyNull(), llmq::CSigSharesManager::VerifySigSharesInv(), and CFlatDB< T >::Write().

◆ SelectParams()

void SelectParams ( const std::string &  chain)

Sets the params returned by Params() to those for the given BIP70 chain name.

Exceptions
std::runtime_errorwhen the chain is not supported.

Definition at line 965 of file chainparams.cpp.

References CreateChainParams(), globalChainParams, and SelectBaseParams().

Referenced by AppInit(), AppInitRawTx(), PaymentServer::ipcParseCommandLine(), and main().

◆ UpdateBudgetParameters()

void UpdateBudgetParameters ( int  nMasternodePaymentsStartBlock,
int  nBudgetPaymentsStartBlock,
int  nSuperblockStartBlock 
)

Allows modifying the budget regtest parameters.

Definition at line 981 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

◆ UpdateDevnetLLMQChainLocks()

void UpdateDevnetLLMQChainLocks ( Consensus::LLMQType  llmqType)

Allows modifying the LLMQ type for ChainLocks.

Definition at line 991 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

◆ UpdateDevnetSubsidyAndDiffParams()

void UpdateDevnetSubsidyAndDiffParams ( int  nMinimumDifficultyBlocks,
int  nHighSubsidyBlocks,
int  nHighSubsidyFactor 
)

Allows modifying the subsidy and difficulty devnet parameters.

Definition at line 986 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

◆ UpdateDIP3Parameters()

void UpdateDIP3Parameters ( int  nActivationHeight,
int  nEnforcementHeight 
)

Allows modifying the DIP3 activation and enforcement height.

Definition at line 976 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

◆ UpdateLLMQDevnetParams()

void UpdateLLMQDevnetParams ( int  size,
int  threshold 
)

Allows modifying parameters of the devnet LLMQ.

Definition at line 1001 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

◆ UpdateLLMQTestParams()

void UpdateLLMQTestParams ( int  size,
int  threshold 
)

Allows modifying parameters of the test LLMQ.

Definition at line 996 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

◆ UpdateVersionBitsParameters()

void UpdateVersionBitsParameters ( Consensus::DeploymentPos  d,
int64_t  nStartTime,
int64_t  nTimeout,
int64_t  nWindowSize,
int64_t  nThresholdStart,
int64_t  nThresholdMin,
int64_t  nFalloffCoeff 
)

Allows modifying the Version Bits regtest parameters.

Definition at line 971 of file chainparams.cpp.

References globalChainParams.

Referenced by AppInitParameterInteraction().

Variable Documentation

◆ globalChainParams

◆ llmq400_60

Consensus::LLMQParams llmq400_60
static
Initial value:
= {
.name = "llmq_400_60",
.size = 400,
.minSize = 300,
.threshold = 240,
.dkgInterval = 24 * 12,
.dkgPhaseBlocks = 4,
.dkgMiningWindowStart = 20,
.dkgMiningWindowEnd = 28,
.dkgBadVotesThreshold = 300,
.signingActiveQuorumCount = 4,
.keepOldConnections = 5,
.recoveryMembers = 100,
}

Definition at line 227 of file chainparams.cpp.

Referenced by CDevNetParams::CDevNetParams(), CMainParams::CMainParams(), and CTestNetParams::CTestNetParams().

◆ llmq400_85

Consensus::LLMQParams llmq400_85
static
Initial value:
= {
.name = "llmq_400_85",
.size = 400,
.minSize = 350,
.threshold = 340,
.dkgInterval = 24 * 24,
.dkgPhaseBlocks = 4,
.dkgMiningWindowStart = 20,
.dkgMiningWindowEnd = 48,
.dkgBadVotesThreshold = 300,
.signingActiveQuorumCount = 4,
.keepOldConnections = 5,
.recoveryMembers = 100,
}

Definition at line 247 of file chainparams.cpp.

Referenced by CDevNetParams::CDevNetParams(), CMainParams::CMainParams(), and CTestNetParams::CTestNetParams().

◆ llmq50_60

Consensus::LLMQParams llmq50_60
static
Initial value:
= {
.name = "llmq_50_60",
.size = 50,
.minSize = 40,
.threshold = 30,
.dkgInterval = 24,
.dkgPhaseBlocks = 2,
.dkgMiningWindowStart = 10,
.dkgMiningWindowEnd = 18,
.dkgBadVotesThreshold = 40,
.signingActiveQuorumCount = 24,
.keepOldConnections = 25,
.recoveryMembers = 25,
}

Definition at line 208 of file chainparams.cpp.

Referenced by CDevNetParams::CDevNetParams(), CMainParams::CMainParams(), and CTestNetParams::CTestNetParams().

◆ llmq_devnet

Consensus::LLMQParams llmq_devnet
static
Initial value:
= {
.name = "llmq_devnet",
.size = 10,
.minSize = 7,
.threshold = 6,
.dkgInterval = 24,
.dkgPhaseBlocks = 2,
.dkgMiningWindowStart = 10,
.dkgMiningWindowEnd = 18,
.dkgBadVotesThreshold = 7,
.signingActiveQuorumCount = 3,
.keepOldConnections = 4,
.recoveryMembers = 6,
}

Definition at line 189 of file chainparams.cpp.

Referenced by CDevNetParams::CDevNetParams().

◆ llmq_test

Consensus::LLMQParams llmq_test
static
Initial value:
= {
.name = "llmq_test",
.size = 3,
.minSize = 2,
.threshold = 2,
.dkgInterval = 24,
.dkgPhaseBlocks = 2,
.dkgMiningWindowStart = 10,
.dkgMiningWindowEnd = 18,
.dkgBadVotesThreshold = 2,
.signingActiveQuorumCount = 2,
.keepOldConnections = 3,
.recoveryMembers = 3,
}

Definition at line 169 of file chainparams.cpp.

Referenced by CRegTestParams::CRegTestParams().

Released under the MIT license