24 #include <boost/tokenizer.hpp>
46 throw std::runtime_error(
48 "\nSend masternode ping. Only for remote masternodes on Regtest\n"
52 " \"sent\": (string YES|NO) Whether the ping was sent and, if not, the error.\n"
59 if (!
Params().IsRegTestNet()) {
77 throw std::runtime_error(
78 "initmasternode \"privkey\" ( \"address\" )\n"
79 "\nInitialize masternode on demand if it's not already initialized.\n"
81 "1. privkey (string, required) The masternode private key.\n"
82 "2. address (string, optional) The IP:Port of the masternode. (Only needed for legacy masternodes)\n"
85 " success (string) if the masternode initialization succeeded.\n"
88 HelpExampleCli(
"initmasternode",
"\"9247iC59poZmqBYt9iDh9wDam6v9S1rW5XekjLGyPnDhrDkP4AK\" \"187.24.32.124:51472\"") +
89 HelpExampleRpc(
"initmasternode",
"\"bls-sk1xye8es37kk7y2mz7mad6yz7fdygttexqwhypa0u86hzw2crqgxfqy29ajm\""));
92 std::string _strMasterNodePrivKey = request.
params[0].
get_str();
95 const auto& params =
Params();
97 if (isDeterministic) {
103 if (!res)
throw std::runtime_error(res.getError());
113 std::string _strMasterNodeAddr = request.
params[1].
get_str();
114 auto res =
initMasternode(_strMasterNodePrivKey, _strMasterNodeAddr,
false);
115 if (!res)
throw std::runtime_error(res.getError());
122 throw std::runtime_error(
123 "getcachedblockhashes \n"
124 "\nReturn the block hashes cached in the masternode manager\n"
129 " \"xxxx\", (string) hash at Index d (height modulo max cache size)\n"
138 for (
int i = 0; (unsigned) i < vCacheCopy.size(); i++) {
144 static inline bool filter(
const std::string& str,
const std::string& strFilter)
146 return str.find(strFilter) != std::string::npos;
149 static inline bool filterMasternode(
const UniValue& dmno,
const std::string& strFilter,
bool fEnabled)
151 return strFilter.empty() || (filter(
"ENABLED", strFilter) &&
fEnabled)
152 || (filter(
"POSE_BANNED", strFilter) && !
fEnabled)
153 || (filter(dmno[
"proTxHash"].get_str(), strFilter))
154 || (filter(dmno[
"collateralHash"].get_str(), strFilter))
155 || (filter(dmno[
"collateralAddress"].get_str(), strFilter))
156 || (filter(dmno[
"dmnstate"][
"ownerAddress"].get_str(), strFilter))
157 || (filter(dmno[
"dmnstate"][
"operatorPubKey"].get_str(), strFilter))
158 || (filter(dmno[
"dmnstate"][
"votingAddress"].get_str(), strFilter));
164 throw std::runtime_error(
165 "listmasternodes ( \"filter\" )\n"
166 "\nGet a ranked list of masternodes\n"
169 "1. \"filter\" (string, optional) Filter search text. Partial match by txhash, status, or addr.\n"
175 " \"rank\": n, (numeric) Masternode Rank (or 0 if not enabled)\n"
176 " \"type\": \"legacy\"|\"deterministic\", (string) type of masternode\n"
177 " \"txhash\": \"hash\", (string) Collateral transaction hash\n"
178 " \"outidx\": n, (numeric) Collateral transaction output index\n"
179 " \"pubkey\": \"key\", (string) Masternode public key used for message broadcasting\n"
180 " \"status\": s, (string) Status (ENABLED/EXPIRED/REMOVE/etc)\n"
181 " \"addr\": \"addr\", (string) Masternode PIVX address\n"
182 " \"version\": v, (numeric) Masternode protocol version\n"
183 " \"lastseen\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last seen\n"
184 " \"activetime\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) masternode has been active\n"
185 " \"lastpaid\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) masternode was last paid\n"
201 if (filterMasternode(obj, strFilter, !dmn->IsPoSeBanned())) {
210 if (!chainTip)
return "[]";
211 int nHeight = chainTip->
nHeight;
216 for (
int pos=0; pos < (int) vMasternodeRanks.size(); pos++) {
217 const auto& s = vMasternodeRanks[pos];
223 auto dmn = mnList.GetMNByCollateral(mn.
vin.
prevout);
226 bool fEnabled = !dmn->IsPoSeBanned();
227 if (filterMasternode(obj, strFilter,
fEnabled)) {
229 obj.
pushKV(
"type",
"deterministic");
230 obj.
pushKV(
"txhash", obj[
"proTxHash"].get_str());
231 obj.
pushKV(
"addr", obj[
"dmnstate"][
"payoutAddress"].get_str());
244 if (strFilter !=
"" && strTxHash.find(strFilter) == std::string::npos &&
245 mn.
Status().find(strFilter) == std::string::npos &&
248 std::string strStatus = mn.
Status();
256 obj.
pushKV(
"rank", (strStatus ==
"ENABLED" ? pos : -1));
257 obj.
pushKV(
"type",
"legacy");
258 obj.
pushKV(
"network", strNetwork);
259 obj.
pushKV(
"txhash", strTxHash);
260 obj.
pushKV(
"outidx", (uint64_t)oIdx);
262 obj.
pushKV(
"status", strStatus);
278 throw std::runtime_error(
279 "getmasternodecount\n"
280 "\nGet masternode count values\n"
284 " \"total\": n, (numeric) Total masternodes\n"
285 " \"stable\": n, (numeric) Stable count\n"
286 " \"enabled\": n, (numeric) Enabled masternodes\n"
287 " \"inqueue\": n, (numeric) Masternodes in queue\n"
288 " \"ipv4\": n, (numeric) Number of IPv4 masternodes\n"
289 " \"ipv6\": n, (numeric) Number of IPv6 masternodes\n"
290 " \"onion\": n (numeric) Number of Tor masternodes\n"
299 if (!pChainTip)
return "unknown";
304 obj.
pushKV(
"total", infoMNs.total);
305 obj.
pushKV(
"stable", infoMNs.stableSize);
306 obj.
pushKV(
"enabled", infoMNs.enabledSize);
307 obj.
pushKV(
"inqueue", nCount);
308 obj.
pushKV(
"ipv4", infoMNs.ipv4);
309 obj.
pushKV(
"ipv6", infoMNs.ipv6);
310 obj.
pushKV(
"onion", infoMNs.onion);
318 throw std::runtime_error(
319 "masternodecurrent\n"
320 "\nGet current masternode winner (scheduled to be paid next).\n"
324 " \"protocol\": xxxx, (numeric) Protocol version\n"
325 " \"txhash\": \"xxxx\", (string) Collateral transaction hash\n"
326 " \"pubkey\": \"xxxx\", (string) MN Public key\n"
327 " \"lastseen\": xxx, (numeric) Time since epoch of last seen\n"
328 " \"activeseconds\": xxx, (numeric) Seconds MN has been active\n"
335 if (!pChainTip)
return "unknown";
341 obj.
pushKV(
"protocol", (int64_t)winner->protocolVersion);
342 obj.
pushKV(
"txhash", winner->vin.prevout.hash.ToString());
344 obj.
pushKV(
"lastseen", winner->lastPing.IsNull() ? winner->sigTime : (int64_t)winner->lastPing.sigTime);
345 obj.
pushKV(
"activeseconds", winner->lastPing.IsNull() ? 0 : (int64_t)(winner->lastPing.sigTime - winner->sigTime));
349 throw std::runtime_error(
"unknown");
361 if (pmn !=
nullptr) {
362 if (strCommand ==
"missing")
return false;
363 if (strCommand ==
"disabled" && pmn->
IsEnabled())
return false;
369 statusObjRet.
pushKV(
"result", fSuccessRet ?
"success" :
"failed");
370 statusObjRet.
pushKV(
"error", fSuccessRet ?
"" : errorMessage);
388 int successful = 0, failed = 0;
389 return RelayMNB(mnb, fSucces, successful, failed);
395 int version = isBIP155 ? PROTOCOL_VERSION | ADDRV2_FORMAT : PROTOCOL_VERSION;
408 int successful = 0, failed = 0;
409 return SerializeMNB(statusObjRet, mnb, fSuccess, successful, failed);
424 std::string strCommand;
429 if (strCommand ==
"local")
431 if (strCommand ==
"many")
435 (strCommand ==
"alias" && request.
params.
size() < 3))
436 throw std::runtime_error(
437 "startmasternode \"all|missing|disabled|alias\" lock_wallet ( \"alias\" reload_conf )\n"
438 "\nAttempts to start one or more masternode(s)\n" +
442 "1. set (string, required) Specify which set of masternode(s) to start.\n"
443 "2. lock_wallet (boolean, required) Lock wallet after completion.\n"
444 "3. alias (string, optional) Masternode alias. Required if using 'alias' as the set.\n"
445 "4. reload_conf (boolean, optional, default=False) reload the masternodes.conf data from disk"
449 " \"overall\": \"xxxx\", (string) Overall status message\n"
452 " \"alias\": \"xxxx\", (string) Node alias\n"
453 " \"result\": \"xxxx\", (string) 'success' or 'failed'\n"
454 " \"error\": \"xxxx\" (string) Error message, if failed\n"
463 RPCTypeCheck(request.
params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VSTR, UniValue::VBOOL},
true);
475 throw std::runtime_error(
"Error reloading masternode.conf, " +
error);
479 if (strCommand ==
"all" || strCommand ==
"missing" || strCommand ==
"disabled") {
480 if ((strCommand ==
"missing" || strCommand ==
"disabled") &&
483 throw std::runtime_error(
"You can't use this command until masternode list is synced\n");
494 std::string errorMessage;
495 bool fSuccess =
false;
499 RelayMNB(mnb, fSuccess, successful, failed);
505 returnObj.
pushKV(
"overall",
strprintf(
"Successfully started %d masternodes, failed to start %d, total %d", successful, failed, successful + failed));
506 returnObj.
pushKV(
"detail", resultsObj);
511 if (strCommand ==
"alias") {
520 if (mne.getAlias() == alias) {
523 std::string errorMessage;
524 bool fSuccess =
false;
536 statusObj.
pushKV(
"alias", alias);
537 statusObj.
pushKV(
"result",
"failed");
538 statusObj.
pushKV(
"error",
"Could not find alias in config. Verify with listmasternodeconf.");
549 throw std::runtime_error(
550 "createmasternodekey\n"
551 "\nCreate a new masternode private key\n"
554 "\"key\" (string) Masternode private key\n"
573 throw std::runtime_error(
574 "getmasternodeoutputs\n"
575 "\nPrint all masternode transaction outputs\n"
580 " \"txhash\": \"xxxx\", (string) output transaction hash\n"
581 " \"outputidx\": n (numeric) output index number\n"
595 std::vector<COutput> possibleCoins;
599 for (
COutput& out : possibleCoins) {
601 obj.
pushKV(
"txhash", out.tx->GetHash().ToString());
602 obj.
pushKV(
"outputidx", out.i);
611 std::string strFilter =
"";
616 throw std::runtime_error(
617 "listmasternodeconf ( \"filter\" )\n"
618 "\nPrint masternode.conf in JSON format\n"
621 "1. \"filter\" (string, optional) Filter search text. Partial match on alias, address, txHash, or status.\n"
626 " \"alias\": \"xxxx\", (string) masternode alias\n"
627 " \"address\": \"xxxx\", (string) masternode IP address\n"
628 " \"privateKey\": \"xxxx\", (string) masternode private key\n"
629 " \"txHash\": \"xxxx\", (string) transaction hash\n"
630 " \"outputIndex\": n, (numeric) transaction output index\n"
631 " \"status\": \"xxxx\" (string) masternode status\n"
639 std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
646 if(!mne.castOutputIndex(nIndex))
651 std::string strStatus = pmn ? pmn->
Status() :
"MISSING";
653 if (strFilter !=
"" && mne.getAlias().find(strFilter) == std::string::npos &&
654 mne.getIp().find(strFilter) == std::string::npos &&
655 mne.getTxHash().find(strFilter) == std::string::npos &&
656 strStatus.find(strFilter) == std::string::npos)
continue;
659 mnObj.
pushKV(
"alias", mne.getAlias());
660 mnObj.
pushKV(
"address", mne.getIp());
661 mnObj.
pushKV(
"privateKey", mne.getPrivKey());
662 mnObj.
pushKV(
"txHash", mne.getTxHash());
663 mnObj.
pushKV(
"outputIndex", mne.getOutputIndex());
664 mnObj.
pushKV(
"status", strStatus);
674 throw std::runtime_error(
675 "getmasternodestatus\n"
676 "\nPrint masternode status\n"
678 "\nResult (if legacy masternode):\n"
680 " \"txhash\": \"xxxx\", (string) Collateral transaction hash\n"
681 " \"outputidx\": n, (numeric) Collateral transaction output index number\n"
682 " \"netaddr\": \"xxxx\", (string) Masternode network address\n"
683 " \"addr\": \"xxxx\", (string) PIVX address for masternode payments\n"
684 " \"status\": \"xxxx\", (string) Masternode status\n"
685 " \"message\": \"xxxx\" (string) Masternode status message\n"
688 "\nResult (if deterministic masternode):\n"
702 if (!fLegacyMN && !fDeterministicMN) {
706 if (fDeterministicMN) {
739 throw std::runtime_error(
"Masternode not found in the list of available masternodes. Current status: "
746 throw std::runtime_error(
747 "getmasternodewinners ( blocks \"filter\" )\n"
748 "\nPrint the masternode winners for the last n blocks\n"
751 "1. blocks (numeric, optional) Number of previous blocks to show (default: 10)\n"
752 "2. filter (string, optional) Search filter matching MN address\n"
754 "\nResult (single winner):\n"
757 " \"nHeight\": n, (numeric) block height\n"
759 " \"address\": \"xxxx\", (string) PIVX MN Address\n"
760 " \"nVotes\": n, (numeric) Number of votes for winner\n"
766 "\nResult (multiple winners):\n"
769 " \"nHeight\": n, (numeric) block height\n"
772 " \"address\": \"xxxx\", (string) PIVX MN Address\n"
773 " \"nVotes\": n, (numeric) Number of votes for winner\n"
785 if (nHeight < 0)
return "[]";
788 std::string strFilter =
"";
798 for (
int i = nHeight - nLast; i < nHeight + 20; i++) {
803 if (strFilter !=
"" && strPayment.find(strFilter) == std::string::npos)
continue;
805 if (strPayment.find(
',') != std::string::npos) {
807 boost::char_separator<char> sep(
",");
808 boost::tokenizer< boost::char_separator<char> > tokens(strPayment, sep);
809 for (
const std::string& t : tokens) {
811 std::size_t pos = t.find(
":");
812 std::string strAddress = t.substr(0,pos);
813 uint64_t nVotes =
atoi(t.substr(pos+1));
814 addr.
pushKV(
"address", strAddress);
815 addr.
pushKV(
"nVotes", nVotes);
818 obj.
pushKV(
"winner", winner);
819 }
else if (strPayment.find(
"Unknown") == std::string::npos) {
821 std::size_t pos = strPayment.find(
":");
822 std::string strAddress = strPayment.substr(0,pos);
823 uint64_t nVotes =
atoi(strPayment.substr(pos+1));
824 winner.
pushKV(
"address", strAddress);
825 winner.
pushKV(
"nVotes", nVotes);
826 obj.
pushKV(
"winner", winner);
829 winner.
pushKV(
"address", strPayment);
830 winner.
pushKV(
"nVotes", 0);
831 obj.
pushKV(
"winner", winner);
843 throw std::runtime_error(
844 "getmasternodescores ( blocks )\n"
845 "\nPrint list of winning masternode by score\n"
848 "1. blocks (numeric, optional) Show the last n blocks (default 10)\n"
852 " xxxx: \"xxxx\" (numeric : string) Block height : Masternode hash\n"
864 }
catch (
const std::invalid_argument&) {
865 throw std::runtime_error(
"Exception on param 2");
870 if (vMnScores.empty())
return "unknown";
873 for (
const auto& p : vMnScores) {
875 const int nHeight = p.second;
876 obj.
pushKV(
strprintf(
"%d", nHeight), mn->vin.prevout.hash.ToString().c_str());
882 std::vector<unsigned char> mnbData(
ParseHex(strHexMnb));
887 catch (
const std::exception&) {
896 if (!
IsHex(strHexMnb))
901 std::vector<unsigned char> mnbData(
ParseHex(strHexMnb));
906 catch (
const std::exception&) {
921 std::string strCommand;
924 if (request.
fHelp || (strCommand !=
"alias" && strCommand !=
"all") || (strCommand ==
"alias" && request.
params.
size() < 2))
925 throw std::runtime_error(
926 "createmasternodebroadcast \"command\" ( \"alias\")\n"
927 "\nCreates a masternode broadcast message for one or all masternodes configured in masternode.conf\n" +
931 "1. \"command\" (string, required) \"alias\" for single masternode, \"all\" for all masternodes\n"
932 "2. \"alias\" (string, required if command is \"alias\") Alias of the masternode\n"
936 " \"overall\": \"xxx\", (string) Overall status message indicating number of successes.\n"
937 " \"detail\": [ (array) JSON array of broadcast objects.\n"
939 " \"alias\": \"xxx\", (string) Alias of the masternode.\n"
940 " \"success\": true|false, (boolean) Success status.\n"
941 " \"hex\": \"xxx\" (string, if success=true) Hex encoded broadcast message.\n"
942 " \"error_message\": \"xxx\" (string, if success=false) Error message, if any.\n"
948 "\nResult (alias):\n"
950 " \"alias\": \"xxx\", (string) Alias of the masternode.\n"
951 " \"success\": true|false, (boolean) Success status.\n"
952 " \"hex\": \"xxx\" (string, if success=true) Hex encoded broadcast message.\n"
953 " \"error_message\": \"xxx\" (string, if success=false) Error message, if any.\n"
961 if (strCommand ==
"alias")
971 statusObj.
pushKV(
"alias", alias);
974 if(mne.getAlias() == alias) {
977 std::string errorMessage;
978 bool fSuccess =
false;
987 statusObj.
pushKV(
"success",
false);
988 statusObj.
pushKV(
"error_message",
"Could not find alias in config. Verify with listmasternodeconf.");
994 if (strCommand ==
"all")
1008 std::string errorMessage;
1009 bool fSuccess =
false;
1012 SerializeMNB(statusObj, mnb, fSuccess, successful, failed);
1017 returnObj.
pushKV(
"overall",
strprintf(
"Successfully created broadcast messages for %d masternodes, failed to create %d, total %d", successful, failed, successful + failed));
1018 returnObj.
pushKV(
"detail", resultsObj);
1028 throw std::runtime_error(
1029 "decodemasternodebroadcast \"hexstring\"\n"
1030 "\nCommand to decode masternode broadcast messages\n"
1033 "1. \"hexstring\" (string) The hex encoded masternode broadcast message\n"
1037 " \"vin\": \"xxxx\" (string) The unspent output which is holding the masternode collateral\n"
1038 " \"addr\": \"xxxx\" (string) IP address of the masternode\n"
1039 " \"pubkeycollateral\": \"xxxx\" (string) Collateral address's public key\n"
1040 " \"pubkeymasternode\": \"xxxx\" (string) Masternode's public key\n"
1041 " \"vchsig\": \"xxxx\" (string) Base64-encoded signature of this message (verifiable via pubkeycollateral)\n"
1042 " \"sigtime\": \"nnn\" (numeric) Signature timestamp\n"
1043 " \"sigvalid\": \"xxx\" (string) \"true\"/\"false\" whether or not the mnb signature checks out.\n"
1044 " \"protocolversion\": \"nnn\" (numeric) Masternode's protocol version\n"
1045 " \"nMessVersion\": \"nnn\" (numeric) MNB Message version number\n"
1046 " \"lastping\" : { (object) JSON object with information about the masternode's last ping\n"
1047 " \"vin\": \"xxxx\" (string) The unspent output of the masternode which is signing the message\n"
1048 " \"blockhash\": \"xxxx\" (string) Current chaintip blockhash minus 12\n"
1049 " \"sigtime\": \"nnn\" (numeric) Signature time for this ping\n"
1050 " \"sigvalid\": \"xxx\" (string) \"true\"/\"false\" whether or not the mnp signature checks out.\n"
1051 " \"vchsig\": \"xxxx\" (string) Base64-encoded signature of this ping (verifiable via pubkeymasternode)\n"
1052 " \"nMessVersion\": \"nnn\" (numeric) MNP Message version number\n"
1084 resultObj.
pushKV(
"lastping", lastPingObj);
1092 throw std::runtime_error(
1093 "relaymasternodebroadcast \"hexstring\"\n"
1094 "\nCommand to relay masternode broadcast messages\n"
1097 "1. \"hexstring\" (string) The hex encoded masternode broadcast message\n"
1129 {
"masternode",
"initmasternode", &
initmasternode,
true, {
"privkey",
"address",
"deterministic"} },
1131 {
"masternode",
"listmasternodes", &
listmasternodes,
true, {
"filter"} },
1134 {
"masternode",
"startmasternode", &
startmasternode,
true, {
"set",
"lock_wallet",
"alias",
"reload_conf"} },
1138 {
"hidden",
"mnping", &
mnping,
true, {} },
1144 for (
unsigned int vcidx = 0; vcidx <
ARRAYLEN(commands); vcidx++)
OperationResult initMasternode(const std::string &_strMasterNodePrivKey, const std::string &_strMasterNodeAddr, bool isFromInit)
CActiveDeterministicMasternodeManager * activeMasternodeManager
const CChainParams & Params()
Return the currently selected parameters.
std::string ToStringShort() const
masternode_state_t GetState() const
std::string GetStatus() const
OperationResult SetOperatorKey(const std::string &strMNOperatorPrivKey)
const CActiveMasternodeInfo * GetInfo() const
void Init(const CBlockIndex *pindexTip)
std::string GetStatusMessage() const
bool SendMasternodePing(std::string &errorMessage)
Ping Masternode.
The block chain is a tree shaped structure starting with the genesis block at the root,...
int nHeight
height of the entry in the chain. The genesis block has height 0
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or nullptr if none.
int Height() const
Return the maximal height in the chain.
const Consensus::Params & GetConsensus() const
An encapsulated private key.
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
static bool Create(const CTxIn &vin, const CService &service, const CKey &keyCollateralAddressNew, const CPubKey &pubKeyCollateralAddressNew, const CKey &keyMasternodeNew, const CPubKey &pubKeyMasternodeNew, std::string &strErrorRet, CMasternodeBroadcast &mnbRet)
Create Masternode broadcast, needs to be relayed manually after that.
bool CheckSignature() const
const std::string & getTxHash() const
const std::string & getOutputIndex() const
const std::string & getIp() const
bool castOutputIndex(int &n) const
const std::string & getPrivKey() const
const std::string & getAlias() const
bool read(std::string &strErr)
std::vector< CMasternodeEntry > getEntries()
std::string Status() const
CPubKey pubKeyCollateralAddress
void UpdateMasternodeList(CMasternodeBroadcast &mnb)
Update masternode list and maps using provided CMasternodeBroadcast.
int CountEnabled(bool only_legacy=false) const
std::vector< std::pair< int64_t, MasternodeRef > > GetMasternodeRanks(int nBlockHeight) const
std::vector< std::pair< MasternodeRef, int > > GetMnScores(int nLast) const
vector of pairs <masternode winner, height>
MasternodeRef GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, int &nCount, const CBlockIndex *pChainTip=nullptr) const
Find an entry in the masternode list that is next to be paid.
int GetBestHeight() const
int64_t GetLastPaid(const MasternodeRef &mn, int count_enabled, const CBlockIndex *BlockReading) const
Get the time a masternode was last paid.
CMasternodeMan::MNsInfo getMNsInfo() const
CMasternode * Find(const COutPoint &collateralOut)
Find an entry.
std::vector< uint256 > GetCachedBlocks() const
enum Network GetNetwork() const
bool IsAddrV1Compatible() const
Check if the current object can be serialized in pre-ADDRv2/BIP155 format.
std::string ToString() const
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
PIVX RPC command dispatcher.
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
std::string ToString() const
bool CheckSignature(const CKeyID &keyID) const
std::string GetSignatureBase64() const
An input of a transaction.
std::string ToString() const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
CTxOut out
unspent transaction output
const std::string & get_str() const
bool push_back(const UniValue &val)
bool pushKV(const std::string &key, const UniValue &val)
std::string ToString() const
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
std::shared_ptr< const CDeterministicMN > CDeterministicMNCPtr
bool AvailableCoins(std::vector< COutput > *pCoins, const CCoinControl *coinControl=nullptr, AvailableCoinsFilter coinsFilter=AvailableCoinsFilter()) const
populate vCoins with vector of available COutputs.
std::string GetRequiredPaymentsString(int nBlockHeight)
std::shared_ptr< CMasternode > MasternodeRef
CMasternodeConfig masternodeConfig
CMasternodeMan mnodeman
Masternode manager.
CActiveMasternode activeMasternode
Keep track of the active Masternode.
std::string EncodeSecret(const CKey &key)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
RecursiveMutex cs_main
Global state.
void SplitHostPort(std::string in, int &portOut, std::string &hostOut)
std::string GetNetworkName(enum Network net)
bool LookupHost(const std::string &name, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup)
UniValue getmasternodewinners(const JSONRPCRequest &request)
UniValue initmasternode(const JSONRPCRequest &request)
UniValue createmasternodebroadcast(const JSONRPCRequest &request)
void RegisterMasternodeRPCCommands(CRPCTable &tableRPC)
Register masternode RPC commands.
bool DecodeHexMnb(CMasternodeBroadcast &mnb, std::string strHexMnb)
UniValue relaymasternodebroadcast(const JSONRPCRequest &request)
UniValue masternodecurrent(const JSONRPCRequest &request)
UniValue getmasternodeoutputs(const JSONRPCRequest &request)
bool StartMasternodeEntry(UniValue &statusObjRet, CMasternodeBroadcast &mnbRet, bool &fSuccessRet, const CMasternodeConfig::CMasternodeEntry &mne, std::string &errorMessage, std::string strCommand="")
UniValue createmasternodekey(const JSONRPCRequest &request)
UniValue decodemasternodebroadcast(const JSONRPCRequest &request)
void SerializeMNB(UniValue &statusObjRet, const CMasternodeBroadcast &mnb, const bool fSuccess, int &successful, int &failed)
UniValue startmasternode(const JSONRPCRequest &request)
UniValue getmasternodescores(const JSONRPCRequest &request)
bool DecodeAddrV1(CMasternodeBroadcast &mnb, std::string strHexMnb)
UniValue listmasternodes(const JSONRPCRequest &request)
UniValue getmasternodecount(const JSONRPCRequest &request)
UniValue mnping(const JSONRPCRequest &request)
UniValue listmasternodeconf(const JSONRPCRequest &request)
UniValue getmasternodestatus(const JSONRPCRequest &request)
UniValue getcachedblockhashes(const JSONRPCRequest &request)
void RelayMNB(CMasternodeBroadcast &mnb, const bool fSuccess, int &successful, int &failed)
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors.
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
@ RPC_DESERIALIZATION_ERROR
Database error.
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
std::string HelpRequiringPassphrase(CWallet *const pwallet)
void EnsureWalletIsUnlocked(CWallet *const pwallet, bool fAllowAnonOnly)
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException)
std::string HelpExampleCli(std::string methodname, std::string args)
void RPCTypeCheck(const UniValue ¶ms, const std::list< UniValue::VType > &typesExpected, bool fAllowNull)
Type-check arguments; throws JSONRPCError if wrong type given.
std::string HelpExampleRpc(std::string methodname, std::string args)
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet, bool fColdStake)
Parse a standard scriptPubKey for the destination address.
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
CBLSPublicKey pubKeyOperator
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
std::atomic< bool > fMasterNode
bool error(const char *fmt, const Args &... args)
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a Optional result.
TierTwoSyncState g_tiertwo_sync_state
#define MASTERNODE_SYNC_FAILED
#define MASTERNODE_SYNC_LIST
uint256 uint256S(const char *str)
const UniValue NullUniValue
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
std::vector< unsigned char > ParseHex(const char *psz)
bool IsHex(const std::string &str)
int atoi(const std::string &str)
std::unique_ptr< CCoinsViewCache > pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
std::atomic< bool > fImporting
CBlockIndex * GetChainTip()
Return a reliable pointer (in mapBlockIndex) to the chain's tip index.
std::atomic< bool > fReindex
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.