48 bool fValid = pbudgetProposal->
IsValid();
49 bObj.
pushKV(
"IsValid", fValid);
59 if (strProposalName.size() > 20)
67 nPaymentCount = params[2].
get_int();
68 if (nPaymentCount < 1)
72 if (nPaymentCount > nMaxPayments) {
74 strprintf(
"Invalid payment count, must be <= %d", nMaxPayments));
83 int pHeight = pindexPrev->
nHeight;
85 int nBlockMin = pHeight - (pHeight % budgetCycleBlocks) + budgetCycleBlocks;
87 nBlockStart = params[3].
get_int();
88 if ((nBlockStart < nBlockMin) || ((nBlockStart % budgetCycleBlocks) != 0))
96 if (nAmount < 10 * COIN)
100 if (nAmount > nTotalBudget)
112 throw std::runtime_error(
113 "preparebudget \"name\" \"url\" npayments start \"address\" monthly_payment\n"
114 "\nPrepare proposal for network by signing and creating tx\n"
117 "1. \"name\": (string, required) Desired proposal name (20 character limit)\n"
118 "2. \"url\": (string, required) URL of proposal details (64 character limit)\n"
119 "3. npayments: (numeric, required) Total number of monthly payments\n"
120 "4. start: (numeric, required) Starting super block height\n"
121 "5. \"address\": (string, required) PIVX address to send payments to\n"
122 "6. monthly_payment: (numeric, required) Monthly payment amount\n"
125 "\"xxxx\" (string) proposal fee hash (if successful) or error message (if failed)\n"
128 HelpExampleCli(
"preparebudget",
"\"test-proposal\" \"https://forum.pivx.org/t/test-proposal\" 2 820800 \"D9oc6C3dttUbv8zd7zGNq1qKBGf4ZQ1XEE\" 500") +
129 HelpExampleRpc(
"preparebudget",
"\"test-proposal\" \"https://forum.pivx.org/t/test-proposal\" 2 820800 \"D9oc6C3dttUbv8zd7zGNq1qKBGf4ZQ1XEE\" 500"));
135 std::string strProposalName;
151 throw std::runtime_error(
"Proposal is not valid " + proposal.
IsInvalidReason());
157 throw std::runtime_error(
"Error making collateral transaction for proposal. Please check your wallet balance.");
166 auto it = pwallet->
mapWallet.find(wtx->GetHash());
168 it->second.SetComment(
"Proposal: " + strProposalName);
170 return wtx->GetHash().ToString();
176 throw std::runtime_error(
177 "submitbudget \"name\" \"url\" npayments start \"address\" monthly_payment \"fee_txid\"\n"
178 "\nSubmit proposal to the network\n"
181 "1. \"name\": (string, required) Desired proposal name (20 character limit)\n"
182 "2. \"url\": (string, required) URL of proposal details (64 character limit)\n"
183 "3. npayments: (numeric, required) Total number of monthly payments\n"
184 "4. start: (numeric, required) Starting super block height\n"
185 "5. \"address\": (string, required) PIVX address to send payments to\n"
186 "6. monthly_payment: (numeric, required) Monthly payment amount\n"
187 "7. \"fee_txid\": (string, required) Transaction hash from preparebudget command\n"
190 "\"xxxx\" (string) proposal hash (if successful) or error message (if failed)\n"
193 HelpExampleCli(
"submitbudget",
"\"test-proposal\" \"https://forum.pivx.org/t/test-proposal\" 2 820800 \"D9oc6C3dttUbv8zd7zGNq1qKBGf4ZQ1XEE\" 500") +
194 HelpExampleRpc(
"submitbudget",
"\"test-proposal\" \"https://forum.pivx.org/t/test-proposal\" 2 820800 \"D9oc6C3dttUbv8zd7zGNq1qKBGf4ZQ1XEE\" 500"));
196 std::string strProposalName;
210 throw std::runtime_error(
"Must wait for client to sync with masternode network. Try again in a minute or so.");
214 CBudgetProposal proposal(strProposalName, strURL, nPaymentCount, scriptPubKey, nAmount, nBlockStart, hash);
217 throw std::runtime_error(strError);
235 std::string strCommand;
240 if (strCommand ==
"vote") strCommand =
"local";
241 if (strCommand ==
"vote-many") strCommand =
"many";
242 if (strCommand ==
"vote-alias") strCommand =
"alias";
247 if (request.
fHelp || (request.
params.
size() == 3 && (strCommand !=
"local" && strCommand !=
"many")) || (request.
params.
size() == 4 && strCommand !=
"alias") ||
249 throw std::runtime_error(
250 "mnbudgetvote \"local|many|alias\" \"hash\" \"yes|no\" ( \"alias\" legacy )\n"
251 "\nVote on a budget proposal\n"
252 "\nAfter V6 enforcement, the deterministic masternode system is used by default. Set the \"legacy\" parameter to true to vote with legacy masternodes."
255 "1. \"mode\" (string, required) The voting mode. 'local' for voting directly from a masternode, 'many' for voting with a MN controller and casting the same vote for each MN, 'alias' for voting with a MN controller and casting a vote for a single MN\n"
256 "2. \"hash\" (string, required) The budget proposal hash\n"
257 "3. \"votecast\" (string, required) Your vote. 'yes' to vote for the proposal, 'no' to vote against\n"
258 "4. \"alias\" (string, required for 'alias' mode) The MN alias to cast a vote for (for deterministic masternodes it's the hash of the proTx transaction).\n"
259 "5. \"legacy\" (boolean, optional, default=false) Use the legacy masternode system after deterministic masternodes enforcement.\n"
263 " \"overall\": \"xxxx\", (string) The overall status message for the vote cast\n"
266 " \"node\": \"xxxx\", (string) 'local' or the MN alias\n"
267 " \"result\": \"xxxx\", (string) Either 'Success' or 'Failed'\n"
268 " \"error\": \"xxxx\", (string) Error message, if vote failed\n"
275 HelpExampleCli(
"mnbudgetvote",
"\"alias\" \"ed2f83cedee59a91406f5f47ec4d60bf5a7f9ee6293913c82976bd2d3a658041\" \"yes\" \"4f9de28fca1f0574a217c5d3c59cc51125ec671de82a2f80b6ceb69673115041\"") +
276 HelpExampleRpc(
"mnbudgetvote",
"\"alias\" \"ed2f83cedee59a91406f5f47ec4d60bf5a7f9ee6293913c82976bd2d3a658041\" \"yes\" \"4f9de28fca1f0574a217c5d3c59cc51125ec671de82a2f80b6ceb69673115041\""));
283 if (strCommand ==
"local") {
285 throw JSONRPCError(
RPC_MISC_ERROR,
_(
"\"local\" vote is no longer available with DMNs. Use \"alias\" from the wallet with the voting key."));
298 bool isAlias =
false;
299 if (strCommand ==
"many" || (isAlias = strCommand ==
"alias")) {
310 throw std::runtime_error(
311 "getbudgetvotes \"name\"\n"
312 "\nPrint vote information for a budget proposal\n"
315 "1. \"name\": (string, required) Name of the proposal\n"
320 " \"mnId\": \"xxxx-x\", (string) Masternode's outpoint collateral transaction (hash-n)\n"
321 " \"nHash\": \"xxxx\", (string) Hash of the vote\n"
322 " \"Vote\": \"YES|NO\", (string) Vote cast ('YES' or 'NO')\n"
323 " \"nTime\": xxxx, (numeric) Time in seconds since epoch the vote was cast\n"
324 " \"fValid\": true|false, (boolean) 'true' if the vote is valid, 'false' otherwise\n"
334 if (pbudgetProposal ==
nullptr)
throw std::runtime_error(
"Unknown proposal name");
341 throw std::runtime_error(
342 "getnextsuperblock\n"
343 "\nPrint the next super block height\n"
346 "n (numeric) Block height of the next super block\n"
352 if (nChainHeight < 0)
return "unknown";
355 int nNext = nChainHeight - nChainHeight % nBlocksPerCycle + nBlocksPerCycle;
362 throw std::runtime_error(
363 "getbudgetprojection\n"
364 "\nShow the projection of which proposals will be paid the next cycle\n"
365 "Proposal fee tx time need to be +24hrs old from the current time. (Testnet is 5 mins)\n"
366 "Net Votes needs to be above Masternode Count divided by 10\n"
371 " \"Name\": \"xxxx\", (string) Proposal Name\n"
372 " \"URL\": \"xxxx\", (string) Proposal URL\n"
373 " \"Hash\": \"xxxx\", (string) Proposal vote hash\n"
374 " \"FeeHash\": \"xxxx\", (string) Proposal fee hash\n"
375 " \"BlockStart\": n, (numeric) Proposal starting block\n"
376 " \"BlockEnd\": n, (numeric) Proposal ending block\n"
377 " \"TotalPaymentCount\": n, (numeric) Number of payments\n"
378 " \"RemainingPaymentCount\": n, (numeric) Number of remaining payments\n"
379 " \"PaymentAddress\": \"xxxx\", (string) PIVX address of payment\n"
380 " \"Ratio\": x.xxx, (numeric) Ratio of yeas vs nays\n"
381 " \"Yeas\": n, (numeric) Number of yea votes\n"
382 " \"Nays\": n, (numeric) Number of nay votes\n"
383 " \"Abstains\": n, (numeric) Number of abstains\n"
384 " \"TotalPayment\": xxx.xxx, (numeric) Total payment amount in PIV\n"
385 " \"MonthlyPayment\": xxx.xxx, (numeric) Monthly payment amount in PIV\n"
386 " \"IsEstablished\": true|false, (boolean) Proposal is considered established, 24 hrs after being submitted to network. (Testnet is 5 mins)\n"
387 " \"IsValid\": true|false, (boolean) Valid (true) or Invalid (false)\n"
388 " \"IsInvalidReason\": \"xxxx\", (string) Error message, if any\n"
389 " \"Allotted\": xxx.xxx, (numeric) Amount of PIV allotted in current period\n"
390 " \"TotalBudgetAllotted\": xxx.xxx (numeric) Total PIV allotted\n"
406 nTotalAllotted += p.GetAllotted();
417 throw std::runtime_error(
418 "getbudgetinfo ( \"name\" )\n"
419 "\nShow current masternode budgets\n"
422 "1. \"name\" (string, optional) Proposal name\n"
427 " \"Name\": \"xxxx\", (string) Proposal Name\n"
428 " \"URL\": \"xxxx\", (string) Proposal URL\n"
429 " \"Hash\": \"xxxx\", (string) Proposal vote hash\n"
430 " \"FeeHash\": \"xxxx\", (string) Proposal fee hash\n"
431 " \"BlockStart\": n, (numeric) Proposal starting block\n"
432 " \"BlockEnd\": n, (numeric) Proposal ending block\n"
433 " \"TotalPaymentCount\": n, (numeric) Number of payments\n"
434 " \"RemainingPaymentCount\": n, (numeric) Number of remaining payments\n"
435 " \"PaymentAddress\": \"xxxx\", (string) PIVX address of payment\n"
436 " \"Ratio\": x.xxx, (numeric) Ratio of yeas vs nays\n"
437 " \"Yeas\": n, (numeric) Number of yea votes\n"
438 " \"Nays\": n, (numeric) Number of nay votes\n"
439 " \"Abstains\": n, (numeric) Number of abstains\n"
440 " \"TotalPayment\": xxx.xxx, (numeric) Total payment amount in PIV\n"
441 " \"MonthlyPayment\": xxx.xxx, (numeric) Monthly payment amount in PIV\n"
442 " \"IsEstablished\": true|false, (boolean) Proposal is considered established, 24 hrs after being submitted to network. (5 mins for Testnet)\n"
443 " \"IsValid\": true|false, (boolean) Valid (true) or Invalid (false)\n"
444 " \"IsInvalidReason\": \"xxxx\", (string) Error message, if any\n"
458 if (pbudgetProposal ==
nullptr)
throw std::runtime_error(
"Unknown proposal name");
467 if (!pbudgetProposal->IsValid())
continue;
480 throw std::runtime_error(
481 "mnbudgetrawvote \"collat_txid\" collat_vout \"hash\" votecast time \"sig\"\n"
482 "\nCompile and relay a proposal vote with provided external signature instead of signing vote internally\n"
485 "1. \"collat_txid\" (string, required) Transaction hash for the masternode collateral\n"
486 "2. collat_vout (numeric, required) Output index for the masternode collateral\n"
487 "3. \"hash\" (string, required) Budget Proposal hash\n"
488 "4. \"votecast\" (string, required) Your vote. 'yes' to vote for the proposal, 'no' to vote against\n"
489 "5. time (numeric, required) Time since epoch in seconds\n"
490 "6. \"sig\" (string, required) External signature\n"
493 "\"status\" (string) Vote status or error message\n"
500 const CTxIn& vin =
CTxIn(hashMnTx, nMnTxIndex);
507 bool fInvalid =
false;
508 std::vector<unsigned char> vchSig =
DecodeBase64(strSig.c_str(), &fInvalid);
515 return "Failure to find masternode in list : " + vin.
ToString();
523 return "Failure to verify signature.";
526 std::string strError;
528 return "Voted successfully";
530 return "Error voting : " + strError;
537 throw std::runtime_error(
538 "mnfinalbudgetsuggest\n"
539 "\nTry to submit a budget finalization\n"
540 "returns the budget hash if it was broadcasted successfully");
542 if (!
Params().IsRegTestNet()) {
553 throw std::runtime_error(
554 "createrawmnfinalbudget\n"
555 "\nTry to submit the raw budget finalization\n"
556 "returns the budget hash if it was broadcasted successfully"
558 "1. \"budgetname\" (string, required) finalization name\n"
559 "2. \"blockstart\" (numeric, required) superblock height\n"
560 "3. \"proposals\" (string, required) A json array of json objects\n"
563 " \"proposalid\":\"id\", (string, required) The proposal id\n"
564 " \"payee\":n, (hex, required) The payee script\n"
565 " \"amount\":n (numeric, optional) The payee amount\n"
569 "4. \"feetxid\" (string, optional) the transaction fee hash\n"
573 "\"result\" (string) Budget suggest broadcast or error\n"
574 "\"id\" (string) id of the fee tx or the finalized budget\n"
578 if (!
Params().IsRegTestNet()) {
585 std::vector<CTxBudgetPayment> vecTxBudgetPayments;
587 for (
unsigned int idx = 0; idx < budgetVec.
size(); idx++) {
590 std::vector<unsigned char> scriptData(
ParseHexO(prop,
"payee"));
593 vecTxBudgetPayments.emplace_back(propId, payee, amount);
608 if (!
vpwallets[0]->CreateBudgetFeeTX(wtx, budgetHash, keyChange, BUDGET_FEE_TX)) {
609 throw std::runtime_error(
"Can't make collateral transaction");
615 ret.
pushKV(
"result",
"tx_fee_sent");
616 ret.
pushKV(
"id", wtx->GetHash().ToString());
618 ret.
pushKV(
"result",
"error");
628 ret.
pushKV(
"result",
"fin_budget_sent");
632 ret.
pushKV(
"result",
"error");
639 std::string strCommand;
646 (strCommand !=
"vote-many" && strCommand !=
"vote" && strCommand !=
"show" && strCommand !=
"getvotes"))
647 throw std::runtime_error(
648 "mnfinalbudget \"command\"... ( \"passphrase\" )\n"
649 "\nVote or show current budgets\n"
651 "\nAvailable commands:\n"
652 " vote-many - Vote on a finalized budget\n"
653 " vote - Vote on a finalized budget with local masternode\n"
654 " show - Show existing finalized budgets\n"
655 " getvotes - Get vote information for each finalized budget\n");
657 if (strCommand ==
"vote-many" || strCommand ==
"vote") {
659 throw std::runtime_error(
strprintf(
"Correct usage is 'mnfinalbudget %s BUDGET_HASH (fLegacy)'", strCommand));
673 if (strCommand ==
"show") {
678 const uint256& nHash = finalizedBudget->GetHash();
680 bObj.
pushKV(
"FeeTX", finalizedBudget->GetFeeTXHash().ToString());
681 bObj.
pushKV(
"BlockStart", (int64_t)finalizedBudget->GetBlockStart());
682 bObj.
pushKV(
"BlockEnd", (int64_t)finalizedBudget->GetBlockEnd());
683 bObj.
pushKV(
"Proposals", finalizedBudget->GetProposalsStr());
684 bObj.
pushKV(
"VoteCount", (int64_t)finalizedBudget->GetVoteCount());
687 bool fValid = finalizedBudget->IsValid();
688 bObj.
pushKV(
"IsValid", fValid);
690 bObj.
pushKV(
"IsInvalidReason", finalizedBudget->IsInvalidReason());
692 std::string strName =
strprintf(
"%s (%s)", finalizedBudget->GetName(), nHash.
ToString());
693 resultObj.
pushKV(strName, bObj);
699 if (strCommand ==
"getvotes") {
701 throw std::runtime_error(
"Correct usage is 'mnbudget getvotes budget-hash'");
707 if (pfinalBudget ==
nullptr)
return "Unknown budget hash";
717 throw std::runtime_error(
719 "\nInitiates a budget check cycle manually\n"
734 throw std::runtime_error(
735 "cleanbudget ( try_sync )\n"
736 "\nCleans the budget data manually\n"
738 "1. try_sync (boolean, optional, default=false) resets tier two sync to a pre-budget data request\n"
743 LogPrintf(
"Budget data cleaned\n");
750 LogPrintf(
"Masternode sync restarted\n");
760 {
"budget",
"getbudgetinfo", &
getbudgetinfo,
true, {
"name"} },
764 {
"budget",
"mnbudgetrawvote", &
mnbudgetrawvote,
true, {
"collat_txid",
"collat_vout",
"hash",
"votecast",
"time",
"sig"} },
765 {
"budget",
"mnbudgetvote", &
mnbudgetvote,
true, {
"mode",
"hash",
"votecast",
"alias",
"legacy"} },
766 {
"budget",
"mnfinalbudget", &
mnfinalbudget,
true, {
"command"} },
767 {
"budget",
"preparebudget", &
preparebudget,
true, {
"name",
"url",
"npayments",
"start",
"address",
"monthly_payment"} },
768 {
"budget",
"submitbudget", &
submitbudget,
true, {
"name",
"url",
"npayments",
"start",
"address",
"monthly_payment",
"fee_txid"} },
772 {
"hidden",
"createrawmnfinalbudget", &
createrawmnfinalbudget,
true, {
"budgetname",
"blockstart",
"proposals",
"feetxid"} },
773 {
"hidden",
"cleanbudget", &
cleanbudget,
true, {
"try_sync"} },
779 for (
unsigned int vcidx = 0; vcidx <
ARRAYLEN(commands); vcidx++)
int64_t CAmount
Amount in PIV (Can be negative)
UniValue getbudgetinfo(const JSONRPCRequest &request)
UniValue getbudgetprojection(const JSONRPCRequest &request)
UniValue preparebudget(const JSONRPCRequest &request)
void budgetToJSON(const CBudgetProposal *pbudgetProposal, UniValue &bObj, int nCurrentHeight)
UniValue mnfinalbudgetsuggest(const JSONRPCRequest &request)
UniValue mnfinalbudget(const JSONRPCRequest &request)
UniValue getnextsuperblock(const JSONRPCRequest &request)
UniValue mnbudgetvote(const JSONRPCRequest &request)
UniValue mnbudgetrawvote(const JSONRPCRequest &request)
void RegisterBudgetRPCCommands(CRPCTable &tableRPC)
Register budget RPC commands.
UniValue cleanbudget(const JSONRPCRequest &request)
void checkBudgetInputs(const UniValue ¶ms, std::string &strProposalName, std::string &strURL, int &nPaymentCount, int &nBlockStart, CTxDestination &address, CAmount &nAmount)
UniValue createrawmnfinalbudget(const JSONRPCRequest &request)
UniValue checkbudgets(const JSONRPCRequest &request)
UniValue submitbudget(const JSONRPCRequest &request)
UniValue getbudgetvotes(const JSONRPCRequest &request)
CBudgetManager g_budgetman
UniValue mnBudgetVoteInner(CWallet *const pwallet, bool fLegacyMN, const uint256 &budgetHash, bool fFinal, const CBudgetVote::VoteDirection &nVote, const Optional< std::string > &mnAliasFilter)
UniValue mnLocalBudgetVoteInner(bool fLegacyMN, const uint256 &budgetHash, bool fFinal, const CBudgetVote::VoteDirection &nVote)
const CChainParams & Params()
Return the currently selected parameters.
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
int GetBestHeight() const
bool AddProposal(CBudgetProposal &budgetProposal)
static CAmount GetTotalBudget(int nHeight)
bool AddFinalizedBudget(CFinalizedBudget &finalizedBudget, CNode *pfrom=nullptr)
RecursiveMutex cs_budgets
std::vector< CBudgetProposal > GetBudget()
const CBudgetProposal * FindProposalByName(const std::string &strProposalName) const
uint256 SubmitFinalBudget()
std::vector< CBudgetProposal * > GetAllProposalsOrdered()
CFinalizedBudget * FindFinalizedBudget(const uint256 &nHash)
std::vector< CFinalizedBudget * > GetFinalizedBudgets()
std::string GetFinalizedBudgetStatus(const uint256 &nHash) const
bool AddAndRelayProposalVote(const CBudgetVote &vote, std::string &strError)
int GetRemainingPaymentCount(int nCurrentHeight) const
int GetBlockStart() const
CAmount GetAllotted() const
std::string GetURL() const
std::string IsInvalidReason() const
std::string GetName() const
const uint256 & GetFeeTXHash() const
CAmount GetAmount() const
bool IsWellFormed(const CAmount &nTotalBudget)
int GetTotalPaymentCount() const
bool IsEstablished() const
UniValue GetVotesArray() const
void SetTime(const int64_t &_nTime)
int Height() const
Return the maximal height in the chain.
const Consensus::Params & GetConsensus() const
UniValue GetVotesObject() const
CMasternode * Find(const COutPoint &collateralOut)
Find an entry.
void ClearFulfilledRequest()
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.
A key allocated from the key pool.
Serialized script, used inside transaction inputs and outputs.
bool CheckSignature(const CKeyID &keyID) const
void SetVchSig(const std::vector< unsigned char > &vchSigIn)
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,...
std::map< uint256, CWalletTx > mapWallet
bool IsBlockchainSynced() const
const std::string & get_str() const
int64_t get_int64() const
const UniValue & get_obj() const
bool push_back(const UniValue &val)
const UniValue & get_array() const
bool pushKV(const std::string &key, const UniValue &val)
std::string ToString() const
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
const std::string CURRENCY_UNIT
CWallet::CommitResult CommitTransaction(CTransactionRef tx, CReserveKey &opReservekey, CConnman *connman)
bool CreateBudgetFeeTX(CTransactionRef &tx, const uint256 &hash, CReserveKey &keyChange, CAmount fee)
std::string ToString() const
std::unique_ptr< CConnman > g_connman
CMasternodeSync masternodeSync
CMasternodeMan mnodeman
Masternode manager.
bool IsValidDestination(const CWDestination &address)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
CWDestination DecodeDestination(const std::string &strAddress)
RecursiveMutex cs_main
Global state.
boost::optional< T > Optional
Substitute for C++17 std::optional.
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_IN_WARMUP
Transaction already in chain.
@ RPC_WALLET_ERROR
No valid connection manager instance found.
@ RPC_CLIENT_IN_INITIAL_DOWNLOAD
PIVX is not connected.
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
void EnsureWalletIsUnlocked(CWallet *const pwallet, bool fAllowAnonOnly)
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException)
UniValue ValueFromAmount(const CAmount &amount)
std::string HelpExampleCli(std::string methodname, std::string args)
CAmount AmountFromValue(const UniValue &value)
uint256 ParseHashO(const UniValue &o, std::string strKey)
std::vector< unsigned char > ParseHexO(const UniValue &o, std::string strKey)
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
std::string HelpExampleRpc(std::string methodname, std::string args)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a PIVX scriptPubKey for the given CTxDestination.
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.
CWallet::CommitStatus status
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a Optional result.
TierTwoSyncState g_tiertwo_sync_state
std::shared_ptr< const CTransaction > CTransactionRef
const uint256 UINT256_ZERO
constant uint256 instances
const UniValue & find_value(const UniValue &obj, const std::string &name)
const UniValue NullUniValue
std::string FormatMoney(const CAmount &n, bool fPlus)
Money parsing/formatting utilities.
bool validateURL(const std::string &strURL)
std::vector< unsigned char > DecodeBase64(const char *p, bool *pfInvalid)
std::string SanitizeString(const std::string &str, int rule)
Remove unsafe chars.
CBlockIndex * GetChainTip()
Return a reliable pointer (in mapBlockIndex) to the chain's tip index.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
std::vector< CWalletRef > vpwallets