 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
19 #include <boost/tokenizer.hpp>
26 std::string strCommand;
27 if (params.
size() >= 1)
28 strCommand = params[0].
get_str();
31 (strCommand !=
"start" && strCommand !=
"start-alias" && strCommand !=
"start-many" && strCommand !=
"start-all" && strCommand !=
"start-missing" &&
32 strCommand !=
"start-disabled" && strCommand !=
"list" && strCommand !=
"list-conf" && strCommand !=
"count" && strCommand !=
"enforce" &&
33 strCommand !=
"debug" && strCommand !=
"current" && strCommand !=
"winners" && strCommand !=
"genkey" && strCommand !=
"connect" &&
34 strCommand !=
"outputs" && strCommand !=
"status" && strCommand !=
"calcscore"))
35 throw std::runtime_error(
36 "masternode \"command\"...\n"
37 "\nSet of commands to execute masternode related actions\n"
38 "This command is depreciated, please see individual command documentation for future reference\n\n"
41 "1. \"command\" (string or set of strings, required) The command to execute\n"
43 "\nAvailable commands:\n"
44 " count - Print count information of all known masternodes\n"
45 " current - Print info on current masternode winner\n"
46 " debug - Print masternode status\n"
47 " genkey - Generate new masternodeprivkey\n"
48 " outputs - Print masternode compatible outputs\n"
49 " start - Start masternode configured in prcycoin.conf\n"
50 " start-alias - Start single masternode by assigned alias configured in masternode.conf\n"
51 " start-<mode> - Start masternodes configured in masternode.conf (<mode>: 'all', 'missing', 'disabled')\n"
52 " status - Print masternode status information\n"
53 " list - Print list of all known masternodes (see masternodelist for more info)\n"
54 " list-conf - Print masternode.conf in JSON format\n"
55 " winners - Print list of masternode winners\n");
57 if (strCommand ==
"list") {
60 for (
unsigned int i = 1; i < params.
size(); i++) {
66 if (strCommand ==
"connect") {
69 for (
unsigned int i = 1; i < params.
size(); i++) {
74 if (strCommand ==
"count") {
77 for (
unsigned int i = 1; i < params.
size(); i++) {
83 if (strCommand ==
"current") {
86 for (
unsigned int i = 1; i < params.
size(); i++) {
92 if (strCommand ==
"start" || strCommand ==
"start-alias" || strCommand ==
"start-many" || strCommand ==
"start-all" || strCommand ==
"start-missing" || strCommand ==
"start-disabled") {
96 if (strCommand ==
"genkey") {
99 for (
unsigned int i = 1; i < params.
size(); i++) {
105 if (strCommand ==
"list-conf") {
108 for (
unsigned int i = 1; i < params.
size(); i++) {
114 if (strCommand ==
"outputs") {
117 for (
unsigned int i = 1; i < params.
size(); i++) {
123 if (strCommand ==
"status") {
126 for (
unsigned int i = 1; i < params.
size(); i++) {
132 if (strCommand ==
"winners") {
135 for (
unsigned int i = 1; i < params.
size(); i++) {
141 if (strCommand ==
"calcscore") {
144 for (
unsigned int i = 1; i < params.
size(); i++) {
155 std::string strFilter =
"";
157 if (params.
size() == 1) strFilter = params[0].
get_str();
159 if (fHelp || (params.
size() > 1))
160 throw std::runtime_error(
161 "listmasternodes ( \"filter\" )\n"
162 "\nGet a ranked list of masternodes\n"
165 "1. \"filter\" (string, optional) Filter search text. Partial match by txhash, status, or addr.\n"
170 " \"rank\": n, (numeric) Masternode Rank (or 0 if not enabled)\n"
171 " \"txhash\": \"hash\", (string) Collateral transaction hash\n"
172 " \"outidx\": n, (numeric) Collateral transaction output index\n"
173 " \"pubkey\": \"key\", (string) Masternode public key used for message broadcasting\n"
174 " \"status\": s, (string) Status (ENABLED/EXPIRED/REMOVE/etc)\n"
175 " \"addr\": \"addr\", (string) Masternode PRCY address\n"
176 " \"version\": v, (numeric) Masternode protocol version\n"
177 " \"lastseen\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last seen\n"
178 " \"activetime\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) masternode has been active\n"
179 " \"lastpaid\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) masternode was last paid\n"
191 if(!pindex)
return 0;
197 std::string strVin = s.second.vin.prevout.ToStringShort();
198 std::string strTxHash = s.second.vin.prevout.hash.ToString();
199 uint32_t oIdx = s.second.vin.prevout.n;
204 if (strFilter !=
"" && strTxHash.find(strFilter) == std::string::npos &&
205 mn->
Status().find(strFilter) == std::string::npos &&
208 std::string strStatus = mn->
Status();
216 obj.
push_back(Pair(
"rank", (strStatus ==
"ENABLED" ? s.first : 0)));
217 obj.
push_back(Pair(
"network", strNetwork));
218 obj.
push_back(Pair(
"txhash", strTxHash));
219 obj.
push_back(Pair(
"outidx", (uint64_t)oIdx));
221 obj.
push_back(Pair(
"status", strStatus));
224 obj.
push_back(Pair(
"stealthaddress", mnStealth));
240 throw std::runtime_error(
241 "getmasternodecount\n"
242 "\nGet masternode count values\n"
246 " \"total\": n, (numeric) Total masternodes\n"
247 " \"stable\": n, (numeric) Stable count\n"
248 " \"enabled\": n, (numeric) Enabled masternodes\n"
249 " \"inqueue\": n (numeric) Masternodes in queue\n"
256 int ipv4 = 0, ipv6 = 0, onion = 0;
276 if (fHelp || (params.
size() != 0))
277 throw std::runtime_error(
278 "masternodecurrent\n"
279 "\nGet current masternode winner (scheduled to be paid next).\n"
283 " \"protocol\": xxxx, (numeric) Protocol version\n"
284 " \"txhash\": \"xxxx\", (string) Collateral transaction hash\n"
285 " \"pubkey\": \"xxxx\", (string) MN Public key\n"
286 " \"lastseen\": xxx, (numeric) Time since epoch of last seen\n"
287 " \"activeseconds\": xxx, (numeric) Seconds MN has been active\n"
305 throw std::runtime_error(
"unknown");
318 if (strCommand ==
"missing")
return false;
319 if (strCommand ==
"disabled" && pmn->
IsEnabled())
return false;
325 statusObjRet.
push_back(Pair(
"result", fSuccessRet ?
"success" :
"failed"));
326 statusObjRet.
push_back(Pair(
"error", fSuccessRet ?
"" : errorMessage));
344 int successful = 0, failed = 0;
345 return RelayMNB(mnb, fSucces, successful, failed);
362 int successful = 0, failed = 0;
363 return SerializeMNB(statusObjRet, mnb, fSuccess, successful, failed);
368 std::string strCommand;
369 if (params.
size() >= 1) {
370 strCommand = params[0].
get_str();
373 if (strCommand ==
"start") strCommand =
"local";
374 if (strCommand ==
"start-alias") strCommand =
"alias";
375 if (strCommand ==
"start-all") strCommand =
"all";
376 if (strCommand ==
"start-many") strCommand =
"many";
377 if (strCommand ==
"start-missing") strCommand =
"missing";
378 if (strCommand ==
"start-disabled") strCommand =
"disabled";
381 if (fHelp || params.
size() < 2 || params.
size() > 3 ||
382 (params.
size() == 2 && (strCommand !=
"local" && strCommand !=
"all" && strCommand !=
"many" && strCommand !=
"missing" && strCommand !=
"disabled")) ||
383 (params.
size() == 3 && strCommand !=
"alias"))
384 throw std::runtime_error(
385 "startmasternode \"local|all|many|missing|disabled|alias\" lockwallet ( \"alias\" )\n"
386 "\nAttempts to start one or more masternode(s)\n"
389 "1. set (string, required) Specify which set of masternode(s) to start.\n"
390 "2. lockwallet (boolean, required) Lock wallet after completion.\n"
391 "3. alias (string) Masternode alias. Required if using 'alias' as the set.\n"
393 "\nResult: (for 'local' set):\n"
394 "\"status\" (string) Masternode status message\n"
396 "\nResult: (for other sets):\n"
398 " \"overall\": \"xxxx\", (string) Overall status message\n"
401 " \"node\": \"xxxx\", (string) Node name or alias\n"
402 " \"result\": \"xxxx\", (string) 'success' or 'failed'\n"
403 " \"error\": \"xxxx\" (string) Error message, if failed\n"
412 bool fLock = (params[1].
get_str() ==
"true" ? true :
false);
416 if (strCommand ==
"local") {
417 if (!
fMasterNode)
throw std::runtime_error(
"you must set masternode=1 in the configuration\n");
428 if (strCommand ==
"all" || strCommand ==
"many" || strCommand ==
"missing" || strCommand ==
"disabled") {
429 if ((strCommand ==
"missing" || strCommand ==
"disabled") &&
432 throw std::runtime_error(
"You can't use this command until masternode list is synced\n");
435 std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
446 std::string errorMessage;
447 bool fSuccess =
false;
451 RelayMNB(mnb, fSuccess, successful, failed);
457 returnObj.
push_back(Pair(
"overall",
strprintf(
"Successfully started %d masternodes, failed to start %d, total %d", successful, failed, successful + failed)));
458 returnObj.
push_back(Pair(
"detail", resultsObj));
463 if (strCommand ==
"alias") {
464 std::string alias = params[2].
get_str();
472 if (mne.getAlias() == alias) {
475 std::string errorMessage;
476 bool fSuccess =
false;
488 statusObj.
push_back(Pair(
"success",
false));
489 statusObj.
push_back(Pair(
"error_message",
"Could not find alias in config. Verify with list-conf."));
499 if (fHelp || (params.
size() != 0))
500 throw std::runtime_error(
502 "\nCreate a new masternode collteral transaction, genkey, and locks the output\n"
505 "\"txhash\" (string) output transaction hash\n"
506 "\"outputidx\" (numeric) output index numberh\n"
507 "\"genkey\" (string) Masternode private key\n"
514 std::string myAddress;
525 "Cannot create Masternode colltaeral transaction.");
533 for (
int i=0; i < (int)wtx.
vout.size(); i++) {
537 if (value ==
Params().MNCollateralAmt()) {
546 obj.
push_back(Pair(
"outputidx", indexOut));
557 if (fHelp || (params.
size() != 0))
558 throw std::runtime_error(
559 "createmasternodekey\n"
560 "\nCreate a new masternode private key\n"
563 "\"key\" (string) Masternode private key\n"
575 if (fHelp || (params.
size() != 0))
576 throw std::runtime_error(
577 "getmasternodeoutputs\n"
578 "\nPrint all masternode transaction outputs\n"
583 " \"txhash\": \"xxxx\", (string) output transaction hash\n"
584 " \"outputidx\": n (numeric) output index number\n"
593 std::vector<COutput> possibleCoins;
597 for (
COutput& out : possibleCoins) {
599 obj.
push_back(Pair(
"txhash", out.tx->GetHash().ToString()));
609 std::string strFilter =
"";
611 if (params.
size() == 1) strFilter = params[0].
get_str();
613 if (fHelp || (params.
size() > 1))
614 throw std::runtime_error(
615 "listmasternodeconf ( \"filter\" )\n"
616 "\nPrint masternode.conf in JSON format\n"
619 "1. \"filter\" (string, optional) Filter search text. Partial match on alias, address, txHash, or status.\n"
624 " \"alias\": \"xxxx\", (string) masternode alias\n"
625 " \"address\": \"xxxx\", (string) masternode IP address\n"
626 " \"privateKey\": \"xxxx\", (string) masternode private key\n"
627 " \"txHash\": \"xxxx\", (string) transaction hash\n"
628 " \"outputIndex\": n, (numeric) transaction output index\n"
629 " \"status\": \"xxxx\" (string) masternode status\n"
637 std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
644 if(!mne.castOutputIndex(nIndex))
649 std::string strStatus = pmn ? pmn->
Status() :
"MISSING";
651 if (strFilter !=
"" && mne.getAlias().find(strFilter) == std::string::npos &&
652 mne.getIp().find(strFilter) == std::string::npos &&
653 mne.getTxHash().find(strFilter) == std::string::npos &&
654 strStatus.find(strFilter) == std::string::npos)
continue;
657 mnObj.
push_back(Pair(
"alias", mne.getAlias()));
658 mnObj.
push_back(Pair(
"address", mne.getIp()));
659 mnObj.
push_back(Pair(
"privateKey", mne.getPrivKey()));
660 mnObj.
push_back(Pair(
"txHash", mne.getTxHash()));
661 mnObj.
push_back(Pair(
"outputIndex", mne.getOutputIndex()));
662 mnObj.
push_back(Pair(
"status", strStatus));
671 if (fHelp || (params.
size() != 0))
672 throw std::runtime_error(
673 "getmasternodestatus\n"
674 "\nPrint masternode status\n"
678 " \"txhash\": \"xxxx\", (string) Collateral transaction hash\n"
679 " \"outputidx\": n, (numeric) Collateral transaction output index number\n"
680 " \"netaddr\": \"xxxx\", (string) Masternode network address\n"
681 " \"addr\": \"xxxx\", (string) PRCY address for masternode payments\n"
682 " \"status\": \"xxxx\", (string) Masternode status\n"
683 " \"message\": \"xxxx\" (string) Masternode status message\n"
689 if (!
fMasterNode)
throw std::runtime_error(
"This is not a masternode");
705 throw std::runtime_error(
"Masternode not found in the list of available masternodes. Current status: "
711 if (fHelp || params.
size() > 3)
712 throw std::runtime_error(
713 "getmasternodewinners ( blocks \"filter\" )\n"
714 "\nPrint the masternode winners for the last n blocks\n"
717 "1. blocks (numeric, optional) Number of previous blocks to show (default: 10)\n"
718 "2. filter (string, optional) Search filter matching MN address\n"
720 "\nResult (single winner):\n"
723 " \"nHeight\": n, (numeric) block height\n"
725 " \"address\": \"xxxx\", (string) PRCY MN Address\n"
726 " \"nVotes\": n, (numeric) Number of votes for winner\n"
732 "\nResult (multiple winners):\n"
735 " \"nHeight\": n, (numeric) block height\n"
738 " \"address\": \"xxxx\", (string) PRCY MN Address\n"
739 " \"nVotes\": n, (numeric) Number of votes for winner\n"
753 if(!pindex)
return 0;
758 std::string strFilter =
"";
760 if (params.
size() >= 1)
761 nLast =
atoi(params[0].get_str());
763 if (params.
size() == 2)
764 strFilter = params[1].
get_str();
768 for (
int i = nHeight - nLast; i < nHeight + 20; i++) {
773 if (strFilter !=
"" && strPayment.find(strFilter) == std::string::npos)
continue;
775 if (strPayment.find(
',') != std::string::npos) {
777 boost::char_separator<char> sep(
",");
778 boost::tokenizer< boost::char_separator<char> > tokens(strPayment, sep);
779 for (
const std::string& t : tokens) {
781 std::size_t pos = t.find(
":");
782 std::string strAddress = t.substr(0,pos);
783 uint64_t nVotes =
atoi(t.substr(pos+1));
784 addr.
push_back(Pair(
"address", strAddress));
789 }
else if (strPayment.find(
"Unknown") == std::string::npos) {
791 std::size_t pos = strPayment.find(
":");
792 std::string strAddress = strPayment.substr(0,pos);
793 uint64_t nVotes =
atoi(strPayment.substr(pos+1));
794 winner.
push_back(Pair(
"address", strAddress));
795 winner.
push_back(Pair(
"nVotes", nVotes));
799 winner.
push_back(Pair(
"address", strPayment));
812 if (fHelp || params.
size() > 1)
813 throw std::runtime_error(
814 "getmasternodescores ( blocks )\n"
815 "\nPrint list of winning masternode by score\n"
818 "1. blocks (numeric, optional) Show the last n blocks (default 10)\n"
822 " xxxx: \"xxxx\" (numeric : string) Block height : Masternode hash\n"
830 if (params.
size() == 1) {
832 nLast = std::stoi(params[0].get_str());
833 }
catch (
const std::invalid_argument&) {
834 throw std::runtime_error(
"Exception on param 2");
844 uint256 n = mn.CalculateScore(1, nHeight - 100);
847 pBestMasternode = &mn;
860 throw std::runtime_error(
861 "getcurrentseesawratio\n"
862 "\nPrint Current See Saw Reward Ratio\n"
864 "\nNo Arguments needed\n"
868 " SeeSaw reward ratio: Masternode-Staking node : xx-xx\n"
875 int ipv4 = 0, ipv6 = 0, onion = 0;
881 CAmount stakingnodeReward = nReward - masternodeReward;
890 if (fHelp || params.
size() > 1)
891 throw std::runtime_error(
892 "getseesawrewardwithheight\n"
893 "\nPrint See Saw Reward With Specific block height\n"
896 "1. Height of block\n"
899 " SeeSaw reward: Masternode-Staking node : xx-xx\n"
906 if (params.
size() == 1) {
907 nblockHeight = params[0].
get_int();
911 int ipv4 = 0, ipv6 = 0, onion = 0;
916 CAmount stakingnodeReward = nReward - masternodeReward;
917 obj.
push_back(Pair(
"Block Height", nblockHeight));
927 throw std::runtime_error(
928 "getseesawrewardratio\n"
929 "\nPrint See Saw Reward Ratio\n"
934 " SeeSaw reward Ratio: Masternode-Staking node : xx-xx\n"
943 int ipv4 = 0, ipv6 = 0, onion = 0;
948 int masternodeRatio = (masternodeReward * 100)/nReward;
949 obj.
push_back(Pair(
"Masternode Reward Ratio", masternodeRatio));
950 obj.
push_back(Pair(
"Staking Reward Ratio", 100 - masternodeRatio));
956 if (!
IsHex(strHexMnb))
959 std::vector<unsigned char> mnbData(
ParseHex(strHexMnb));
964 catch (
const std::exception&) {
973 std::string strCommand;
974 if (params.
size() >= 1)
975 strCommand = params[0].
get_str();
976 if (fHelp || (strCommand !=
"alias" && strCommand !=
"all") || (strCommand ==
"alias" && params.
size() < 2))
977 throw std::runtime_error(
978 "createmasternodebroadcast \"command\" ( \"alias\")\n"
979 "\nCreates a masternode broadcast message for one or all masternodes configured in masternode.conf\n" +
983 "1. \"command\" (string, required) \"alias\" for single masternode, \"all\" for all masternodes\n"
984 "2. \"alias\" (string, required if command is \"alias\") Alias of the masternode\n"
988 " \"overall\": \"xxx\", (string) Overall status message indicating number of successes.\n"
989 " \"detail\": [ (array) JSON array of broadcast objects.\n"
991 " \"alias\": \"xxx\", (string) Alias of the masternode.\n"
992 " \"success\": true|false, (boolean) Success status.\n"
993 " \"hex\": \"xxx\" (string, if success=true) Hex encoded broadcast message.\n"
994 " \"error_message\": \"xxx\" (string, if success=false) Error message, if any.\n"
1000 "\nResult (alias):\n"
1002 " \"alias\": \"xxx\", (string) Alias of the masternode.\n"
1003 " \"success\": true|false, (boolean) Success status.\n"
1004 " \"hex\": \"xxx\" (string, if success=true) Hex encoded broadcast message.\n"
1005 " \"error_message\": \"xxx\" (string, if success=false) Error message, if any.\n"
1013 if (strCommand ==
"alias")
1019 std::string alias = params[1].
get_str();
1023 statusObj.
push_back(Pair(
"alias", alias));
1026 if(mne.getAlias() == alias) {
1029 std::string errorMessage;
1030 bool fSuccess =
false;
1039 statusObj.
push_back(Pair(
"success",
false));
1040 statusObj.
push_back(Pair(
"error_message",
"Could not find alias in config. Verify with list-conf."));
1046 if (strCommand ==
"all")
1052 std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
1063 std::string errorMessage;
1064 bool fSuccess =
false;
1067 SerializeMNB(statusObj, mnb, fSuccess, successful, failed);
1072 returnObj.
push_back(Pair(
"overall",
strprintf(
"Successfully created broadcast messages for %d masternodes, failed to create %d, total %d", successful, failed, successful + failed)));
1073 returnObj.
push_back(Pair(
"detail", resultsObj));
1082 if (fHelp || params.
size() != 1)
1083 throw std::runtime_error(
1084 "decodemasternodebroadcast \"hexstring\"\n"
1085 "\nCommand to decode masternode broadcast messages\n"
1088 "1. \"hexstring\" (string) The hex encoded masternode broadcast message\n"
1092 " \"vin\": \"xxxx\" (string) The unspent output which is holding the masternode collateral\n"
1093 " \"addr\": \"xxxx\" (string) IP address of the masternode\n"
1094 " \"pubkeycollateral\": \"xxxx\" (string) Collateral address's public key\n"
1095 " \"pubkeymasternode\": \"xxxx\" (string) Masternode's public key\n"
1096 " \"vchsig\": \"xxxx\" (string) Base64-encoded signature of this message (verifiable via pubkeycollateral)\n"
1097 " \"sigtime\": \"nnn\" (numeric) Signature timestamp\n"
1098 " \"protocolversion\": \"nnn\" (numeric) Masternode's protocol version\n"
1099 " \"nlastdsq\": \"nnn\" (numeric) The last time the masternode sent a DSQ message (for mixing) (DEPRECATED)\n"
1100 " \"lastping\" : { (object) JSON object with information about the masternode's last ping\n"
1101 " \"vin\": \"xxxx\" (string) The unspent output of the masternode which is signing the message\n"
1102 " \"blockhash\": \"xxxx\" (string) Current chaintip blockhash minus 12\n"
1103 " \"sigtime\": \"nnn\" (numeric) Signature time for this ping\n"
1104 " \"vchsig\": \"xxxx\" (string) Base64-encoded signature of this ping (verifiable via pubkeymasternode)\n"
1135 resultObj.
push_back(Pair(
"lastping", lastPingObj));
1142 if (fHelp || params.
size() != 1)
1143 throw std::runtime_error(
1144 "relaymasternodebroadcast \"hexstring\"\n"
1145 "\nCommand to relay masternode broadcast messages\n"
1148 "1. \"hexstring\" (string) The hex encoded masternode broadcast message\n"
const std::string & getAlias() const
void LockCoin(COutPoint &output)
bool StartMasternodeEntry(UniValue &statusObjRet, CMasternodeBroadcast &mnbRet, bool &fSuccessRet, const CMasternodeConfig::CMasternodeEntry &mne, std::string &errorMessage, std::string strCommand="")
An input of a transaction.
std::atomic< bool > fImporting
UniValue createmasternode(const UniValue ¶ms, bool fHelp)
UniValue getmasternodeoutputs(const UniValue ¶ms, bool fHelp)
void SplitHostPort(std::string in, int &portOut, std::string &hostOut)
int CountEnabled(int protocolVersion=-1)
void UpdateMasternodeList(CMasternodeBroadcast mnb)
Update masternode list and maps using provided CMasternodeBroadcast.
CActiveMasternode activeMasternode
Keep track of the active Masternode.
UniValue masternodecurrent(const UniValue ¶ms, bool fHelp)
int RequestedMasternodeAssets
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
std::vector< unsigned char > ParseHex(const char *psz)
const_iterator begin() const
std::string GetHex() const
std::string GetRequiredPaymentsString(int nBlockHeight)
UniValue getmasternodewinners(const UniValue ¶ms, bool fHelp)
static bool Create(CTxIn vin, CService service, CKey keyCollateralAddressNew, CPubKey pubKeyCollateralAddressNew, CKey keyMasternodeNew, CPubKey pubKeyMasternodeNew, std::string &strErrorRet, CMasternodeBroadcast &mnbRet)
Create Masternode broadcast, needs to be relayed manually after that.
UniValue ValueFromAmount(const CAmount &amount)
CChain chainActive
The currently-connected chain of blocks.
const UniValue NullUniValue
UniValue decodemasternodebroadcast(const UniValue ¶ms, bool fHelp)
base58-encoded PRCY addresses.
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
CMasternode * Find(const CScript &payee)
Find an entry.
int nHeight
height of the entry in the chain. The genesis block has height 0
UniValue masternode(const UniValue ¶ms, bool fHelp)
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
int size()
Return the number of (unique) Masternodes.
CMasternode * GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, int &nCount)
Find an entry in the masternode list that is next to be paid.
UniValue createmasternodebroadcast(const UniValue ¶ms, bool fHelp)
bool ComputeStealthPublicAddress(const std::string &accountName, std::string &pubAddress)
UniValue getmasternodecount(const UniValue ¶ms, bool fHelp)
std::string ToString() const
UniValue startmasternode(const UniValue ¶ms, bool fHelp)
UniValue getmasternodestatus(const UniValue ¶ms, bool fHelp)
int stable_size()
Return the number of Masternodes older than (default) 8000 seconds.
UniValue getseesawrewardwithheight(const UniValue ¶ms, bool fHelp)
std::vector< std::pair< int, CMasternode > > GetMasternodeRanks(int64_t nBlockHeight, int minProtocol=0)
std::vector< unsigned char > masternodeStealthAddress
CAmount GetSeeSaw(const CAmount &blockValue, int nMasternodeCount, int nHeight)
A base58-encoded secret key.
int atoi(const std::string &str)
UniValue listmasternodeconf(const UniValue ¶ms, bool fHelp)
std::string HelpRequiringPassphrase()
CMasternodeSync masternodeSync
const std::string & getTxHash() const
std::vector< CMasternode > GetFullMasternodeVector()
const std::string & get_str() const
RecursiveMutex cs_main
Global state.
@ RPC_DESERIALIZATION_ERROR
Database error.
int ActiveProtocol()
See whether the protocol update is enforced for connected nodes.
const std::string & getPrivKey() const
void RelayMNB(CMasternodeBroadcast &mnb, const bool fSuccess, int &successful, int &failed)
enum Network GetNetwork() const
CMasternodeMan mnodeman
Masternode manager.
std::string ToString() const
UniValue getmasternodescores(const UniValue ¶ms, bool fHelp)
bool IsHex(const std::string &str)
An output of a transaction.
std::vector< CTxOut > vout
bool LookupHost(const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup)
UniValue relaymasternodebroadcast(const UniValue ¶ms, bool fHelp)
const_iterator end() const
std::string GetStatusMessage() const
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
#define PAIRTYPE(t1, t2)
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
UniValue JSONRPCError(int code, const std::string &message)
int64_t CAmount
Amount in PRCY (Can be negative)
@ RPC_WALLET_ERROR
Invalid IP/Subnet.
UniValue createmasternodekey(const UniValue ¶ms, bool fHelp)
std::string HelpExampleRpc(std::string methodname, std::string args)
UniValue getcurrentseesawreward(const UniValue ¶ms, bool fHelp)
256-bit unsigned big integer.
uint256 uint256S(const char *str)
CAmount AmountFromValue(const UniValue &value)
UniValue listmasternodes(const UniValue ¶ms, bool fHelp)
#define MASTERNODE_SYNC_FAILED
bool SendToStealthAddress(const std::string &stealthAddr, CAmount nValue, CWalletTx &wtxNew, bool fUseIX=false, int ringSize=5)
std::string EncodeBase64(const unsigned char *pch, size_t len)
int Height() const
Return the maximal height in the chain.
std::string HelpExampleCli(std::string methodname, std::string args)
CMasternodeConfig masternodeConfig
bool castOutputIndex(int &n) const
std::vector< unsigned char > sig
void CountNetworks(int protocolVersion, int &ipv4, int &ipv6, int &onion)
bool AvailableCoins(std::vector< COutput > &vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl=NULL, bool fIncludeZeroValue=false, AvailableCoinsType nCoinType=ALL_COINS, bool fUseIX=false)
populate vCoins with vector of available COutputs.
UniValue getseesawrewardratio(const UniValue ¶ms, bool fHelp)
An encapsulated private key.
std::string ToString() const
std::atomic< bool > fReindex
const std::string & getIp() const
void EnsureWalletIsUnlocked(bool fAllowAnonOnly=false)
std::string ToString() const
bool DecodeHexMnb(CMasternodeBroadcast &mnb, std::string strHexMnb)
A transaction with a bunch of additional info that only the owner cares about.
void SerializeMNB(UniValue &statusObjRet, const CMasternodeBroadcast &mnb, const bool fSuccess, int &successful, int &failed)
bool push_back(const UniValue &val)
const CChainParams & Params()
Return the currently selected parameters.
CAmount GetBlockValue(int nHeight)
Double ended buffer combining vector and stream-like interfaces.
std::string ToString() const
const uint256 & GetHash() const
std::string GetNetworkName(enum Network net)
An outpoint - a combination of a transaction hash and an index n into its vout.
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or NULL if none.
const std::string & getOutputIndex() const
std::vector< unsigned char > vchSig
#define ACTIVE_MASTERNODE_STARTED
The block chain is a tree shaped structure starting with the genesis block at the root,...
#define MASTERNODE_SYNC_LIST
CAmount getCTxOutValue(const CTransaction &tx, const CTxOut &out) const
CPubKey pubKeyCollateralAddress
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
std::vector< CMasternodeEntry > & getEntries()
std::string ToString() const