 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
23 #include <boost/algorithm/string.hpp>
25 #include <boost/assign/list_of.hpp>
41 "Error: There is no privacy wallet, please use createprivacyaccount to create one.");
55 entry.
push_back(Pair(
"confirmations", confirmsTotal));
56 entry.
push_back(Pair(
"bcconfirmations", confirms));
69 entry.
push_back(Pair(
"walletconflicts", conflicts));
78 entry.
push_back(Pair(item.first, item.second));
83 std::string strAccount = value.
get_str();
84 if (strAccount ==
"*")
91 if (fHelp || params.
size() > 1)
92 throw std::runtime_error(
93 "getnewaddress ( \"account\" )\n"
94 "\nReturns a new PRCY address for receiving payments.\n"
95 "If 'account' is specified (recommended), it is added to the address book \n"
96 "so payments received with the address will be credited to 'account'.\n"
98 "1. \"account\" (string, optional) The account name for the address to be linked to. if not provided, the default account \"\" is used. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name.\n"
100 "\"prcycoinaddress\" (string) The new prcycoin address\n"
107 std::string strAccount;
108 if (params.
size() > 0)
133 bool bKeyUsed =
false;
168 bool bKeyUsed =
false;
203 if (fHelp || params.
size() != 1)
204 throw std::runtime_error(
205 "getaccountaddress \"account\"\n"
206 "\nReturns the current PRCY address for receiving payments to this account.\n"
208 "1. \"account\" (string, required) The account name for the address. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created and a new address created if there is no account by the given name.\n"
210 "\"prcycoinaddress\" (string) The account prcycoin address\n"
226 if (fHelp || params.
size() > 1)
227 throw std::runtime_error(
228 "getrawchangeaddress\n"
229 "\nReturns a new PRCY address, for receiving change.\n"
230 "This is for use with raw transactions, NOT normal use.\n"
232 "\"address\" (string) The address\n"
254 if (fHelp || params.
size() < 1 || params.
size() > 2)
255 throw std::runtime_error(
256 "setaccount \"prcycoinaddress\" \"account\"\n"
257 "\nSets the account associated with the given address.\n"
259 "1. \"prcycoinaddress\" (string, required) The prcycoin address to be associated with an account.\n"
260 "2. \"account\" (string, required) The account to assign the address to.\n"
262 HelpExampleCli(
"setaccount",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" \"tabby\"") +
HelpExampleRpc(
"setaccount",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\", \"tabby\""));
270 std::string strAccount;
271 if (params.
size() > 1)
291 if (fHelp || params.
size() != 1)
292 throw std::runtime_error(
293 "getaccount \"prcycoinaddress\"\n"
294 "\nReturns the account associated with the given address.\n"
296 "1. \"prcycoinaddress\" (string, required) The prcycoin address for account lookup.\n"
298 "\"accountname\" (string) the account address\n"
300 HelpExampleCli(
"getaccount",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\"") +
HelpExampleRpc(
"getaccount",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\""));
308 std::string strAccount;
311 strAccount = (*mi).second.name;
318 if (fHelp || params.
size() != 1)
319 throw std::runtime_error(
320 "getaddressesbyaccount \"account\"\n"
321 "\nReturns the list of addresses for the given account.\n"
323 "1. \"account\" (string, required) The account name.\n"
325 "[ (json array of string)\n"
326 " \"prcycoinaddress\" (string) a prcycoin address associated with the given account\n"
340 const std::string& strName = item.second.
name;
341 if (strName == strAccount)
353 std::string strError;
355 strError =
"Error: Wallet locked, unable to create transaction!";
368 strError =
strprintf(
"Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!",
FormatMoney(nFeeRequired));
369 LogPrintf(
"SendMoney() : %s\n", strError);
373 throw JSONRPCError(
RPC_WALLET_ERROR,
"Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
379 throw std::runtime_error(
380 "listaddressgroupings\n"
381 "\nLists groups of addresses which have had their common ownership\n"
382 "made public by common use as inputs or as the resulting change\n"
383 "in past transactions\n"
388 " \"prcycoinaddress\", (string) The prcycoin address\n"
389 " amount, (numeric) The amount in PRCY\n"
390 " \"account\" (string, optional) The account\n"
417 return jsonGroupings;
422 if (fHelp || params.
size() != 2)
423 throw std::runtime_error(
424 "signmessage \"prcycoinaddress\" \"message\"\n"
425 "\nSign a message with the private key of an address" +
428 "1. \"prcycoinaddress\" (string, required) The prcycoin address to use for the private key.\n"
429 "2. \"message\" (string, required) The message to create a signature of.\n"
431 "\"signature\" (string) The signature of the message encoded in base 64\n"
433 "\nUnlock the wallet for 30 seconds\n" +
435 "\nCreate the signature\n" +
HelpExampleCli(
"signmessage",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" \"my message\"") +
436 "\nVerify the signature\n" +
HelpExampleCli(
"verifymessage",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" \"signature\" \"my message\"") +
437 "\nAs json rpc\n" +
HelpExampleRpc(
"signmessage",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\", \"my message\""));
443 std::string strAddress = params[0].
get_str();
444 std::string strMessage = params[1].
get_str();
462 std::vector<unsigned char> vchSig;
471 if (fHelp || params.
size() < 1 || params.
size() > 2)
472 throw std::runtime_error(
473 "getreceivedbyaddress \"prcycoinaddress\" ( minconf )\n"
474 "\nReturns the total amount received by the given prcycoinaddress in transactions with at least minconf confirmations.\n"
476 "1. \"prcycoinaddress\" (string, required) The prcycoin address for transactions.\n"
477 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
479 "amount (numeric) The total amount in PRCY received at this address.\n"
481 "\nThe amount from transactions with at least 1 confirmation\n" +
482 HelpExampleCli(
"getreceivedbyaddress",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\"") +
483 "\nThe amount including unconfirmed transactions, zero confirmations\n" +
HelpExampleCli(
"getreceivedbyaddress",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" 0") +
484 "\nThe amount with at least 6 confirmation, very safe\n" +
HelpExampleCli(
"getreceivedbyaddress",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" 6") +
485 "\nAs a json rpc call\n" +
HelpExampleRpc(
"getreceivedbyaddress",
"\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\", 6"));
499 if (params.
size() > 1)
500 nMinDepth = params[1].
get_int();
521 if (fHelp || params.
size() < 1 || params.
size() > 2)
522 throw std::runtime_error(
523 "getreceivedbyaccount \"account\" ( minconf )\n"
524 "\nReturns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.\n"
526 "1. \"account\" (string, required) The selected account, may be the default account using \"\".\n"
527 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
529 "amount (numeric) The total amount in PRCY received for this account.\n"
531 "\nAmount received by the default account with at least 1 confirmation\n" +
533 "\nAmount received at the tabby account including unconfirmed amounts with zero confirmations\n" +
HelpExampleCli(
"getreceivedbyaccount",
"\"tabby\" 0") +
534 "\nThe amount with at least 6 confirmation, very safe\n" +
HelpExampleCli(
"getreceivedbyaccount",
"\"tabby\" 6") +
535 "\nAs a json rpc call\n" +
HelpExampleRpc(
"getreceivedbyaccount",
"\"tabby\", 6"));
541 if (params.
size() > 1)
542 nMinDepth = params[1].
get_int();
563 return (
double)nAmount / (double)COIN;
577 CAmount nReceived, nSent, nFee;
581 nBalance += nReceived;
582 nBalance -= nSent + nFee;
599 if (fHelp || params.
size() > 3)
600 throw std::runtime_error(
601 "getbalance ( \"account\" minconf includeWatchonly )\n"
602 "\nIf account is not specified, returns the server's total available balance.\n"
603 "If account is specified, returns the balance in the account.\n"
604 "Note that the account \"\" is not the same as leaving the parameter out.\n"
605 "The server total may be different to the balance in the default \"\" account.\n"
607 "1. \"account\" (string, optional) The selected account, or \"*\" for entire wallet. It may be the default account using \"\".\n"
608 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
609 "3. includeWatchonly (bool, optional, default=false) Also include balance in watchonly addresses (see 'importaddress')\n"
611 "amount (numeric) The total amount in PRCY received for this account.\n"
613 "\nThe total amount in the server across all accounts\n" +
615 "\nThe total amount in the server across all accounts, with at least 5 confirmations\n" +
HelpExampleCli(
"getbalance",
"\"*\" 6") +
616 "\nThe total amount in the default account with at least 1 confirmation\n" +
HelpExampleCli(
"getbalance",
"\"\"") +
617 "\nThe total amount in the account named tabby with at least 6 confirmations\n" +
HelpExampleCli(
"getbalance",
"\"tabby\" 6") +
618 "\nAs a json rpc call\n" +
HelpExampleRpc(
"getbalance",
"\"tabby\", 6"));
622 if (params.
size() == 0)
626 if (params.
size() > 1)
627 nMinDepth = params[1].
get_int();
629 if (params.
size() > 2)
630 if (params[2].get_bool())
633 if (params[0].get_str() ==
"*") {
644 std::string strSentAccount;
645 std::list<COutputEntry> listReceived;
646 std::list<COutputEntry> listSent;
647 wtx.
GetAmounts(listReceived, listSent, allFee, strSentAccount, filter);
650 nBalance +=
r.amount;
653 nBalance -= s.amount;
669 throw std::runtime_error(
673 "total (numeric) The total amount of PRCY received for this wallet.\n"
674 "spendable (numeric) The total amount of PRCY spendable for this wallet.\n"
675 "pending (numeric) The total amount of PRCY pending for this wallet.\n"
676 "immature (numeric) The total amount of PRCY that are immature for this wallet.\n"
677 "locked (numeric) The total amount of PRCY that are locked for this wallet."
679 "\nThe total amount in the server across all accounts\n" +
694 if (fHelp || params.
size() > 0)
695 throw std::runtime_error(
696 "getunconfirmedbalance\n"
697 "Returns the server's total unconfirmed balance\n");
706 if (fHelp || params.
size() < 3 || params.
size() > 5)
707 throw std::runtime_error(
708 "move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" )\n"
709 "\nMove a specified amount from one account in your wallet to another.\n"
711 "1. \"fromaccount\" (string, required) The name of the account to move funds from. May be the default account using \"\".\n"
712 "2. \"toaccount\" (string, required) The name of the account to move funds to. May be the default account using \"\".\n"
713 "3. amount (numeric, required) Quantity of PIV to move between accounts.\n"
714 "4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
715 "5. \"comment\" (string, optional) An optional comment, stored in the wallet only.\n"
717 "true|false (boolean) true if successful.\n"
719 "\nMove 0.01 PRCY from the default account to the account named tabby\n" +
721 "\nMove 0.01 PRCY timotei to akiko with a comment\n" +
HelpExampleCli(
"move",
"\"timotei\" \"akiko\" 0.01 1 \"happy birthday!\"") +
722 "\nAs a json rpc call\n" +
HelpExampleRpc(
"move",
"\"timotei\", \"akiko\", 0.01, 1, \"happy birthday!\""));
729 if (params.
size() > 3)
731 (void)params[3].get_int();
732 std::string strComment;
733 if (params.
size() > 4)
734 strComment = params[4].get_str();
770 if (fHelp || params.
size() < 3 || params.
size() > 6)
771 throw std::runtime_error(
772 "sendfrom \"fromaccount\" \"toprcycoinaddress\" amount ( minconf \"comment\" \"comment-to\" )\n"
773 "\nSent an amount from an account to a prcycoin address.\n"
774 "The amount is a real and is rounded to the nearest 0.00000001." +
777 "1. \"fromaccount\" (string, required) The name of the account to send funds from. May be the default account using \"\".\n"
778 "2. \"toprcycoinaddress\" (string, required) The prcycoin address to send funds to.\n"
779 "3. amount (numeric, required) The amount in PRCY. (transaction fee is added on top).\n"
780 "4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
781 "5. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
782 " This is not part of the transaction, just kept in your wallet.\n"
783 "6. \"comment-to\" (string, optional) An optional comment to store the name of the person or organization \n"
784 " to which you're sending the transaction. This is not part of the transaction, \n"
785 " it is just kept in your wallet.\n"
787 "\"transactionid\" (string) The transaction id.\n"
789 "\nSend 0.01 PRCY from the default account to the address, must have at least 1 confirmation\n" +
790 HelpExampleCli(
"sendfrom",
"\"\" \"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" 0.01") +
791 "\nSend 0.01 from the tabby account to the given address, funds must have at least 6 confirmations\n" +
HelpExampleCli(
"sendfrom",
"\"tabby\" \"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\" 0.01 6 \"donation\" \"seans outpost\"") +
792 "\nAs a json rpc call\n" +
HelpExampleRpc(
"sendfrom",
"\"tabby\", \"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\", 0.01, 6, \"donation\", \"seans outpost\""));
802 if (params.
size() > 3)
803 nMinDepth = params[3].
get_int();
816 if (nAmount > nBalance)
826 if (fHelp || params.
size() < 2 || params.
size() > 4)
827 throw std::runtime_error(
828 "sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" )\n"
829 "\nSend multiple times. Amounts are double-precision floating point numbers." +
832 "1. \"fromaccount\" (string, required) The account to send the funds from, can be \"\" for the default account\n"
833 "2. \"amounts\" (string, required) A json object with addresses and amounts\n"
835 " \"address\":amount (numeric) The prcycoin address is the key, the numeric amount in PRCY is the value\n"
838 "3. minconf (numeric, optional, default=1) Only use the balance confirmed at least this many times.\n"
839 "4. \"comment\" (string, optional) A comment\n"
841 "\"transactionid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n"
842 " the number of addresses.\n"
844 "\nSend two amounts to two different addresses:\n" +
845 HelpExampleCli(
"sendmany",
"\"tabby\" \"{\\\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\\\":0.01,\\\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\\\":0.02}\"") +
846 "\nSend two amounts to two different addresses setting the confirmation and comment:\n" +
HelpExampleCli(
"sendmany",
"\"tabby\" \"{\\\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\\\":0.01,\\\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\\\":0.02}\" 6 \"testing\"") +
847 "\nAs a json rpc call\n" +
HelpExampleRpc(
"sendmany",
"\"tabby\", \"{\\\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\\\":0.01,\\\"DEQsu2RRB5iphm9tKXiP4iWSRMC17gseW5\\\":0.02}\", 6, \"testing\""));
854 if (params.
size() > 2)
855 nMinDepth = params[2].
get_int();
862 std::set<CBitcoinAddress> setAddress;
863 std::vector<std::pair<CScript, CAmount> > vecSend;
866 std::vector<std::string> keys = sendTo.
getKeys();
867 for (
const std::string& name_ : keys) {
872 if (setAddress.count(address))
874 setAddress.insert(address);
878 totalAmount += nAmount;
880 vecSend.push_back(std::make_pair(scriptPubKey, nAmount));
887 if (totalAmount > nBalance)
893 std::string strFailReason;
908 if (fHelp || params.
size() < 2 || params.
size() > 3) {
909 std::string msg =
"addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n"
910 "\nAdd a nrequired-to-sign multisignature address to the wallet.\n"
911 "Each key is a PRCY address or hex-encoded public key.\n"
912 "If 'account' is specified, assign address to that account.\n"
915 "1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
916 "2. \"keysobject\" (string, required) A json array of prcycoin addresses or hex-encoded public keys\n"
918 " \"address\" (string) prcycoin address or hex-encoded public key\n"
921 "3. \"account\" (string, optional) An account to assign the addresses to.\n"
924 "\"prcycoinaddress\" (string) A prcycoin address associated with the keys.\n"
927 "\nAdd a multisig address from 2 addresses\n" +
928 HelpExampleCli(
"addmultisigaddress",
"2 \"[\\\"Xt4qk9uKvQYAonVGSZNXqxeDmtjaEWgfrs\\\",\\\"XoSoWQkpgLpppPoyyzbUFh1fq2RBvW6UK1\\\"]\"") +
929 "\nAs json rpc call\n" +
HelpExampleRpc(
"addmultisigaddress",
"2, \"[\\\"Xt4qk9uKvQYAonVGSZNXqxeDmtjaEWgfrs\\\",\\\"XoSoWQkpgLpppPoyyzbUFh1fq2RBvW6UK1\\\"]\"");
930 throw std::runtime_error(msg);
935 std::string strAccount;
936 if (params.
size() > 2)
958 nConf = std::numeric_limits<int>::max();
959 nBCConf = std::numeric_limits<int>::max();
968 if (params.
size() > 0)
969 nMinDepth = params[0].
get_int();
972 bool fIncludeEmpty =
false;
973 if (params.
size() > 1)
974 fIncludeEmpty = params[1].
get_bool();
977 if (params.
size() > 2)
978 if (params[2].get_bool())
982 std::map<CBitcoinAddress, tallyitem> mapTally;
991 if (nDepth < nMinDepth)
1000 if (!(mine & filter))
1015 std::map<std::string, tallyitem> mapAccountTally;
1018 const std::string& strAccount = item.second.
name;
1019 std::map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address);
1020 if (it == mapTally.end() && !fIncludeEmpty)
1024 int nConf = std::numeric_limits<int>::max();
1025 int nBCConf = std::numeric_limits<int>::max();
1026 bool fIsWatchonly =
false;
1027 if (it != mapTally.end()) {
1028 nAmount = (*it).second.nAmount;
1029 nConf = (*it).second.nConf;
1030 nBCConf = (*it).second.nBCConf;
1031 fIsWatchonly = (*it).second.fIsWatchonly;
1035 tallyitem& item = mapAccountTally[strAccount];
1043 obj.
push_back(Pair(
"involvesWatchonly",
true));
1045 obj.
push_back(Pair(
"account", strAccount));
1047 obj.
push_back(Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
1048 obj.
push_back(Pair(
"bcconfirmations", (nBCConf == std::numeric_limits<int>::max() ? 0 : nBCConf)));
1050 if (it != mapTally.end()) {
1051 for (
const uint256& item : (*it).second.txids) {
1055 obj.
push_back(Pair(
"txids", transactions));
1061 for (std::map<std::string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it) {
1062 CAmount nAmount = (*it).second.nAmount;
1063 int nConf = (*it).second.nConf;
1064 int nBCConf = (*it).second.nBCConf;
1066 if ((*it).second.fIsWatchonly)
1067 obj.
push_back(Pair(
"involvesWatchonly",
true));
1068 obj.
push_back(Pair(
"account", (*it).first));
1070 obj.
push_back(Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
1071 obj.
push_back(Pair(
"bcconfirmations", (nBCConf == std::numeric_limits<int>::max() ? 0 : nBCConf)));
1081 if (fHelp || params.
size() > 3)
1082 throw std::runtime_error(
1083 "listreceivedbyaddress ( minconf includeempty includeWatchonly)\n"
1084 "\nList balances by receiving address.\n"
1086 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
1087 "2. includeempty (numeric, optional, default=false) Whether to include addresses that haven't received any payments.\n"
1088 "3. includeWatchonly (bool, optional, default=false) Whether to include watchonly addresses (see 'importaddress').\n"
1093 " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n"
1094 " \"address\" : \"receivingaddress\", (string) The receiving address\n"
1095 " \"account\" : \"accountname\", (string) The account of the receiving address. The default account is \"\".\n"
1096 " \"amount\" : x.xxx, (numeric) The total amount in PRCY received by the address\n"
1097 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
1098 " \"bcconfirmations\" : n (numeric) The number of blockchain confirmations of the most recent transaction included\n"
1113 if (fHelp || params.
size() > 3)
1114 throw std::runtime_error(
1115 "listreceivedbyaccount ( minconf includeempty includeWatchonly)\n"
1116 "\nList balances by account.\n"
1118 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
1119 "2. includeempty (boolean, optional, default=false) Whether to include accounts that haven't received any payments.\n"
1120 "3. includeWatchonly (bool, optional, default=false) Whether to include watchonly addresses (see 'importaddress').\n"
1125 " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n"
1126 " \"account\" : \"accountname\", (string) The account name of the receiving account\n"
1127 " \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n"
1128 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
1129 " \"bcconfirmations\" : n (numeric) The number of blockchain confirmations of the most recent transaction included\n"
1152 std::string strSentAccount;
1153 std::list<COutputEntry> listReceived;
1154 std::list<COutputEntry> listSent;
1156 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount, filter);
1158 bool fAllAccounts = (strAccount == std::string(
"*"));
1162 if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount)) {
1166 entry.
push_back(Pair(
"involvesWatchonly",
true));
1167 entry.
push_back(Pair(
"account", strSentAccount));
1168 MaybePushAddress(entry, s.destination);
1169 entry.
push_back(Pair(
"category",
"send"));
1182 std::string account;
1185 if (fAllAccounts || (account == strAccount)) {
1188 entry.
push_back(Pair(
"involvesWatchonly",
true));
1189 entry.
push_back(Pair(
"account", account));
1190 MaybePushAddress(entry,
r.destination);
1193 entry.
push_back(Pair(
"category",
"orphan"));
1195 entry.
push_back(Pair(
"category",
"immature"));
1197 entry.
push_back(Pair(
"category",
"generate"));
1199 entry.
push_back(Pair(
"category",
"receive"));
1213 bool fAllAccounts = (strAccount == std::string(
"*"));
1215 if (fAllAccounts || acentry.
strAccount == strAccount) {
1218 entry.
push_back(Pair(
"category",
"move"));
1229 if (fHelp || params.
size() > 4)
1230 throw std::runtime_error(
1231 "listtransactions ( \"account\" count from includeWatchonly)\n"
1232 "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.\n"
1234 "1. \"account\" (string, optional) The account name. If not included, it will list all transactions for all accounts.\n"
1235 " If \"\" is set, it will list transactions for the default account.\n"
1236 "2. count (numeric, optional, default=10) The number of transactions to return\n"
1237 "3. from (numeric, optional, default=0) The number of transactions to skip\n"
1238 "4. includeWatchonly (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')\n"
1242 " \"account\":\"accountname\", (string) The account name associated with the transaction. \n"
1243 " It will be \"\" for the default account.\n"
1244 " \"address\":\"prcycoinaddress\", (string) The prcycoin address of the transaction. Not present for \n"
1245 " move transactions (category = move).\n"
1246 " \"category\":\"send|receive|move\", (string) The transaction category. 'move' is a local (off blockchain)\n"
1247 " transaction between accounts, and not associated with an address,\n"
1248 " transaction id or block. 'send' and 'receive' transactions are \n"
1249 " associated with an address, transaction id and block details\n"
1250 " \"amount\": x.xxx, (numeric) The amount in PRCY. This is negative for the 'send' category, and for the\n"
1251 " 'move' category for moves outbound. It is positive for the 'receive' category,\n"
1252 " and for the 'move' category for inbound funds.\n"
1253 " \"vout\" : n, (numeric) the vout value\n"
1254 " \"fee\": x.xxx, (numeric) The amount of the fee in PRCY. This is negative and only available for the \n"
1255 " 'send' category of transactions.\n"
1256 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n"
1257 " 'receive' category of transactions.\n"
1258 " \"bcconfirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send'\n"
1259 " and 'receive' category of transactions.\n"
1260 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
1261 " category of transactions.\n"
1262 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
1263 " category of transactions.\n"
1264 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1265 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1266 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n"
1267 " for 'send' and 'receive' category of transactions.\n"
1268 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1269 " \"otheraccount\": \"accountname\", (string) For the 'move' category of transactions, the account the funds came \n"
1270 " from (for receiving funds, positive amounts), or went to (for sending funds,\n"
1271 " negative amounts).\n"
1276 "\nList the most recent 10 transactions in the systems\n" +
1278 "\nList the most recent 10 transactions for the tabby account\n" +
HelpExampleCli(
"listtransactions",
"\"tabby\"") +
1279 "\nList transactions 100 to 120 from the tabby account\n" +
HelpExampleCli(
"listtransactions",
"\"tabby\" 20 100") +
1280 "\nAs a json rpc call\n" +
HelpExampleRpc(
"listtransactions",
"\"tabby\", 20, 100"));
1284 std::string strAccount =
"*";
1285 if (params.
size() > 0)
1286 strAccount = params[0].
get_str();
1288 if (params.
size() > 1)
1291 if (params.
size() > 2)
1294 if (params.
size() > 3)
1295 if (params[3].get_bool())
1308 for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) {
1309 CWalletTx*
const pwtx = (*it).second.first;
1316 if ((
int)ret.
size() >= (nCount + nFrom))
break;
1320 if (nFrom > (
int)ret.
size())
1322 if ((nFrom + nCount) > (
int)ret.
size())
1323 nCount = ret.
size() - nFrom;
1325 std::vector<UniValue> arrTmp = ret.
getValues();
1327 std::vector<UniValue>::iterator first = arrTmp.begin();
1328 std::advance(first, nFrom);
1330 std::vector<UniValue>::iterator last = arrTmp.begin();
1331 std::advance(last, nFrom + nCount);
1333 if (last != arrTmp.end()) arrTmp.erase(last, arrTmp.end());
1334 if (first != arrTmp.begin()) arrTmp.erase(arrTmp.begin(), first);
1336 std::reverse(arrTmp.begin(), arrTmp.end());
1347 if (fHelp || params.
size() > 3)
1348 throw std::runtime_error(
1349 "listtransactionsbypaymentid ( paymentid count from includeWatchonly)\n"
1350 "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions for paymentid 'paymentid'.\n"
1352 "1. paymentid (numeric required) The paymentid to list all transactions for.\n"
1353 "2. count (numeric, optional, default=10) The number of transactions to return\n"
1354 "3. from (numeric, optional, default=0) The number of transactions to skip\n"
1358 " \"account\":\"accountname\", (string) The account name associated with the transaction. \n"
1359 " It will be \"\" for the default account.\n"
1360 " \"address\":\"prcycoinaddress\", (string) The prcycoin address of the transaction. Not present for \n"
1361 " move transactions (category = move).\n"
1362 " \"category\":\"send|receive|move\", (string) The transaction category. 'move' is a local (off blockchain)\n"
1363 " transaction between accounts, and not associated with an address,\n"
1364 " transaction id or block. 'send' and 'receive' transactions are \n"
1365 " associated with an address, transaction id and block details\n"
1366 " \"amount\": x.xxx, (numeric) The amount in PRCY. This is negative for the 'send' category, and for the\n"
1367 " 'move' category for moves outbound. It is positive for the 'receive' category,\n"
1368 " and for the 'move' category for inbound funds.\n"
1369 " \"vout\" : n, (numeric) the vout value\n"
1370 " \"fee\": x.xxx, (numeric) The amount of the fee in PRCY. This is negative and only available for the \n"
1371 " 'send' category of transactions.\n"
1372 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n"
1373 " 'receive' category of transactions.\n"
1374 " \"bcconfirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send'\n"
1375 " and 'receive' category of transactions.\n"
1376 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
1377 " category of transactions.\n"
1378 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
1379 " category of transactions.\n"
1380 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1381 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1382 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n"
1383 " for 'send' and 'receive' category of transactions.\n"
1384 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1385 " \"otheraccount\": \"accountname\", (string) For the 'move' category of transactions, the account the funds came \n"
1386 " from (for receiving funds, positive amounts), or went to (for sending funds,\n"
1387 " negative amounts).\n"
1392 "\nList the most recent 10 transactions for the Payment ID\n" +
HelpExampleCli(
"listtransactionsbypaymentid",
"123456") +
1393 "\nList transactions 100 to 120 from the Payment ID\n" +
HelpExampleCli(
"listtransactionsbypaymentid",
"123456 20 100") +
1394 "\nAs a json rpc call\n" +
HelpExampleRpc(
"listtransactionsbypaymentid",
"123456, 20, 100"));
1398 std::string strAccount =
"*";
1399 uint64_t paymentID = 0;
1400 if (params.
size() > 0)
1403 if (params.
size() > 1)
1406 if (params.
size() > 2)
1420 for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) {
1421 CWalletTx*
const pwtx = (*it).second.first;
1428 if ((
int)ret.
size() >= (nCount + nFrom))
break;
1432 if (nFrom > (
int)ret.
size())
1434 if ((nFrom + nCount) > (
int)ret.
size())
1435 nCount = ret.
size() - nFrom;
1437 std::vector<UniValue> arrTmp = ret.
getValues();
1439 std::vector<UniValue>::iterator first = arrTmp.begin();
1440 std::advance(first, nFrom);
1442 std::vector<UniValue>::iterator last = arrTmp.begin();
1443 std::advance(last, nFrom + nCount);
1445 if (last != arrTmp.end()) arrTmp.erase(last, arrTmp.end());
1446 if (first != arrTmp.begin()) arrTmp.erase(arrTmp.begin(), first);
1448 std::reverse(arrTmp.begin(), arrTmp.end());
1459 if (fHelp || params.
size() > 2)
1460 throw std::runtime_error(
1461 "listaccounts ( minconf includeWatchonly)\n"
1462 "\nReturns Object that has account names as keys, account balances as values.\n"
1464 "1. minconf (numeric, optional, default=1) Only include transactions with at least this many confirmations\n"
1465 "2. includeWatchonly (bool, optional, default=false) Include balances in watchonly addresses (see 'importaddress')\n"
1467 "{ (json object where keys are account names, and values are numeric balances\n"
1468 " \"account\": x.xxx, (numeric) The property name is the account name, and the value is the total balance for the account.\n"
1472 "\nList account balances where there at least 1 confirmation\n" +
1474 "\nList account balances including zero confirmation transactions\n" +
HelpExampleCli(
"listaccounts",
"0") +
1475 "\nList account balances for 6 or more confirmations\n" +
HelpExampleCli(
"listaccounts",
"6") +
1481 if (params.
size() > 0)
1482 nMinDepth = params[0].
get_int();
1484 if (params.
size() > 1)
1485 if (params[1].get_bool())
1488 std::map<std::string, CAmount> mapAccountBalances;
1491 mapAccountBalances[entry.second.
name] = 0;
1497 std::string strSentAccount;
1498 std::list<COutputEntry> listReceived;
1499 std::list<COutputEntry> listSent;
1503 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount, includeWatchonly);
1504 mapAccountBalances[strSentAccount] -= nFee;
1506 mapAccountBalances[strSentAccount] -= s.amount;
1507 if (nDepth >= nMinDepth) {
1512 mapAccountBalances[
""] +=
r.amount;
1518 mapAccountBalances[entry.strAccount] += entry.nCreditDebit;
1521 for (
const PAIRTYPE(std::string,
CAmount) & accountBalance : mapAccountBalances) {
1530 throw std::runtime_error(
1531 "listsinceblock ( \"blockhash\" target-confirmations includeWatchonly)\n"
1532 "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted\n"
1534 "1. \"blockhash\" (string, optional) The block hash to list transactions since\n"
1535 "2. target-confirmations: (numeric, optional) The confirmations required, must be 1 or more\n"
1536 "3. includeWatchonly: (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')"
1539 " \"transactions\": [\n"
1540 " \"account\":\"accountname\", (string) The account name associated with the transaction. Will be \"\" for the default account.\n"
1541 " \"address\":\"prcycoinaddress\", (string) The prcycoin address of the transaction. Not present for move transactions (category = move).\n"
1542 " \"category\":\"send|receive\", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.\n"
1543 " \"amount\": x.xxx, (numeric) The amount in PRCY. This is negative for the 'send' category, and for the 'move' category for moves \n"
1544 " outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.\n"
1545 " \"vout\" : n, (numeric) the vout value\n"
1546 " \"fee\": x.xxx, (numeric) The amount of the fee in PRCY. This is negative and only available for the 'send' category of transactions.\n"
1547 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
1548 " \"bcconfirmations\" : n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
1549 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
1550 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
1551 " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1552 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1553 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n"
1554 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT). Available for 'send' and 'receive' category of transactions.\n"
1555 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1556 " \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
1558 " \"lastblock\": \"lastblockhash\" (string) The hash of the last block\n"
1561 HelpExampleCli(
"listsinceblock",
"") +
HelpExampleCli(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6") +
HelpExampleRpc(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6"));
1566 int target_confirms = 1;
1569 if (params.
size() > 0) {
1572 blockId.
SetHex(params[0].get_str());
1575 pindex = it->second;
1578 if (params.
size() > 1) {
1579 target_confirms = params[1].
get_int();
1581 if (target_confirms < 1)
1585 if (params.
size() > 2)
1586 if (params[2].get_bool())
1604 ret.
push_back(Pair(
"transactions", transactions));
1612 if (fHelp || params.
size() < 1 || params.
size() > 2)
1613 throw std::runtime_error(
1614 "gettransaction \"txid\" ( includeWatchonly )\n"
1615 "\nGet detailed information about in-wallet transaction <txid>\n"
1617 "1. \"txid\" (string, required) The transaction id\n"
1618 "2. \"includeWatchonly\" (bool, optional, default=false) Whether to include watchonly addresses in balance calculation and details[]\n"
1621 " \"amount\" : x.xxx, (numeric) The transaction amount in PRCY\n"
1622 " \"confirmations\" : n, (numeric) The number of confirmations\n"
1623 " \"bcconfirmations\" : n, (numeric) The number of blockchain confirmations\n"
1624 " \"blockhash\" : \"hash\", (string) The block hash\n"
1625 " \"blockindex\" : xx, (numeric) The block index\n"
1626 " \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
1627 " \"txid\" : \"transactionid\", (string) The transaction id.\n"
1628 " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n"
1629 " \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n"
1630 " \"details\" : [\n"
1632 " \"account\" : \"accountname\", (string) The account name involved in the transaction, can be \"\" for the default account.\n"
1633 " \"address\" : \"prcycoinaddress\", (string) The prcycoin address involved in the transaction\n"
1634 " \"category\" : \"send|receive\", (string) The category, either 'send' or 'receive'\n"
1635 " \"amount\" : x.xxx (numeric) The amount in PRCY\n"
1636 " \"vout\" : n, (numeric) the vout value\n"
1640 " \"hex\" : \"data\" (string) Raw data for transaction\n"
1644 HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") +
HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true") +
HelpExampleRpc(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\""));
1649 hash.
SetHex(params[0].get_str());
1652 if (params.
size() > 1)
1653 if (params[1].get_bool())
1663 CAmount nNet = (nCredit > nDebit)? (nCredit - nDebit):(nDebit - nCredit);
1673 entry.
push_back(Pair(
"details", details));
1684 if (fHelp || params.
size() != 1)
1685 throw std::runtime_error(
1686 "backupwallet \"destination\"\n"
1687 "\nSafely copies wallet.dat to destination, which can be a directory or a path with filename.\n"
1689 "1. \"destination\" (string) The destination directory or file\n"
1695 std::string strDest = params[0].
get_str();
1705 if (fHelp || params.
size() > 1)
1706 throw std::runtime_error(
1707 "keypoolrefill ( newsize )\n"
1708 "\nFills the keypool." +
1711 "1. newsize (numeric, optional, default=100) The new keypool size\n"
1718 unsigned int kpSize = 0;
1719 if (params.
size() > 0) {
1720 if (params[0].get_int() < 0)
1722 kpSize = (
unsigned int)params[0].get_int();
1735 static void LockWallet(
CWallet* pWallet)
1737 LOCK(cs_nWalletUnlockTime);
1746 throw std::runtime_error(
1747 "unlockwallet \"passphrase\" timeout ( stakingonly )\n"
1748 "\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
1749 "This is needed prior to performing transactions related to private keys such as sending PRCYs\n"
1751 "1. \"passphrase\" (string, required) The wallet passphrase\n"
1752 "2. timeout (numeric, required) The time to keep the decryption key in seconds.\n"
1753 "3. stakingonly (boolean, optional, default=false) If is true sending functions are disabled."
1755 "Issuing the unlockwallet command while the wallet is already unlocked will set a new unlock\n"
1756 "time that overrides the old one. A timeout of \"0\" unlocks until the wallet is closed.\n"
1758 "\nUnlock the wallet for 60 seconds\n" +
1760 "\nUnlock the wallet for 60 seconds but allow Obfuscation only\n" +
HelpExampleCli(
"unlockwallet",
"\"my pass phrase\" 60 true") +
1761 "\nLock the wallet again (before 60 seconds)\n" +
HelpExampleCli(
"walletlock",
"") +
1762 "\nAs json rpc call\n" +
HelpExampleRpc(
"unlockwallet",
"\"my pass phrase\", 60"));
1773 strWalletPass.reserve(100);
1776 strWalletPass = params[0].
get_str().c_str();
1778 bool stakingOnly =
false;
1779 if (params.
size() == 3)
1780 stakingOnly = params[2].
get_bool();
1786 int64_t nSleepTime = params[1].
get_int64();
1788 if (nSleepTime < 0) {
1792 constexpr int64_t MAX_SLEEP_TIME = 100000000;
1793 if (nSleepTime > MAX_SLEEP_TIME) {
1794 nSleepTime = MAX_SLEEP_TIME;
1803 if (nSleepTime > 0) {
1814 throw std::runtime_error(
1815 "walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n"
1816 "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n"
1818 "1. \"oldpassphrase\" (string) The current passphrase\n"
1819 "2. \"newpassphrase\" (string) The new passphrase\n"
1821 HelpExampleCli(
"walletpassphrasechange",
"\"old one\" \"new one\"") +
HelpExampleRpc(
"walletpassphrasechange",
"\"old one\", \"new one\""));
1833 strOldWalletPass.reserve(100);
1834 strOldWalletPass = params[0].
get_str().c_str();
1837 strNewWalletPass.reserve(100);
1838 strNewWalletPass = params[1].
get_str().c_str();
1840 if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1)
1841 throw std::runtime_error(
1842 "walletpassphrasechange <oldpassphrase> <newpassphrase>\n"
1843 "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.");
1855 throw std::runtime_error(
1857 "\nRemoves the wallet encryption key from memory, locking the wallet.\n"
1858 "After calling this method, you will need to call unlockwallet again\n"
1859 "before being able to call any methods which require the wallet to be unlocked.\n"
1861 "\nSet the passphrase for 2 minutes to perform a transaction\n" +
1863 "\nPerform a send (requires passphrase set)\n" +
HelpExampleCli(
"sendtostealthaddress",
"\"Pap5WCV4SjVMGLyYf98MEX82ErBEMVpg9ViQ1up3aBib6Fz4841SahrRXG6eSNSLBSNvEiGuQiWKXJC3RDfmotKv15oCrh6N2Ym\" 1.0") +
1864 "\nClear the passphrase since we are done before 2 minutes is up\n" +
HelpExampleCli(
"walletlock",
"") +
1885 throw std::runtime_error(
1886 "encryptwallet \"passphrase\"\n"
1887 "\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
1888 "After this, any calls that interact with private keys such as sending or signing \n"
1889 "will require the passphrase to be set prior the making these calls.\n"
1890 "Use the unlockwallet call for this, and then walletlock call.\n"
1891 "If the wallet is already encrypted, use the walletpassphrasechange call.\n"
1892 "Note that this will shutdown the server.\n"
1894 "1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
1896 "\nEncrypt you wallet\n" +
1898 "\nNow set the passphrase to use the wallet, such as for signing or sending PRCYs\n" +
HelpExampleCli(
"unlockwallet",
"\"my pass phrase\"") +
1899 "\nNow we can so something like sign\n" +
HelpExampleCli(
"signmessage",
"\"prcycoinaddress\" \"test message\"") +
1900 "\nNow lock the wallet again by removing the passphrase\n" +
HelpExampleCli(
"walletlock",
"") +
1901 "\nAs a json rpc call\n" +
HelpExampleRpc(
"encryptwallet",
"\"my pass phrase\""));
1912 strWalletPass.reserve(100);
1913 strWalletPass = params[0].
get_str().c_str();
1915 if (strWalletPass.length() < 1)
1916 throw std::runtime_error(
1917 "encryptwallet <passphrase>\n"
1918 "Encrypts the wallet with <passphrase>.");
1928 return "wallet encrypted; prcycoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.";
1933 if (fHelp || params.
size() < 1 || params.
size() > 2)
1934 throw std::runtime_error(
1935 "lockunspent unlock [{\"txid\":\"txid\",\"vout\":n},...]\n"
1936 "\nUpdates list of temporarily unspendable outputs.\n"
1937 "Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
1938 "A locked transaction output will not be chosen by automatic coin selection, when spending PRCYs.\n"
1939 "Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
1940 "is always cleared (by virtue of process exit) when a node stops or fails.\n"
1941 "Also see the listunspent call\n"
1943 "1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n"
1944 "2. \"transactions\" (string, required) A json array of objects. Each object the txid (string) vout (numeric)\n"
1945 " [ (json array of json objects)\n"
1947 " \"txid\":\"id\", (string) The transaction id\n"
1948 " \"vout\": n (numeric) The output number\n"
1954 "true|false (boolean) Whether the command was successful or not\n"
1957 "\nList the unspent transactions\n" +
1959 "\nLock an unspent transaction\n" +
HelpExampleCli(
"lockunspent",
"false \"[{\\\"txid\\\":\\\"afbf98345239a27c35db94c03c33d87104ee9ce5c9790f3f756620e6f23d3816\\\",\\\"vout\\\":1}]\"") +
1960 "\nList the locked transactions\n" +
HelpExampleCli(
"listlockunspent",
"") +
1961 "\nUnlock the transaction again\n" +
HelpExampleCli(
"lockunspent",
"true \"[{\\\"txid\\\":\\\"afbf98345239a27c35db94c03c33d87104ee9ce5c9790f3f756620e6f23d3816\\\",\\\"vout\\\":1}]\"") +
1962 "\nAs a json rpc call\n" +
HelpExampleRpc(
"lockunspent",
"false, \"[{\\\"txid\\\":\\\"afbf98345239a27c35db94c03c33d87104ee9ce5c9790f3f756620e6f23d3816\\\",\\\"vout\\\":1}]\""));
1966 if (params.
size() == 1)
1971 bool fUnlock = params[0].
get_bool();
1973 if (params.
size() == 1) {
1980 for (
unsigned int idx = 0; idx < outputs.
size(); idx++) {
1981 const UniValue& output = outputs[idx];
2008 if (fHelp || params.
size() > 0)
2009 throw std::runtime_error(
2011 "\nReturns list of temporarily unspendable outputs.\n"
2012 "See the lockunspent call to lock and unlock transactions for spending.\n"
2016 " \"txid\" : \"transactionid\", (string) The transaction id locked\n"
2017 " \"vout\" : n (numeric) The vout value\n"
2022 "\nList the unspent transactions\n" +
2024 "\nLock an unspent transaction\n" +
HelpExampleCli(
"lockunspent",
"false \"[{\\\"txid\\\":\\\"afbf98345239a27c35db94c03c33d87104ee9ce5c9790f3f756620e6f23d3816\\\",\\\"vout\\\":1}]\"") +
2025 "\nList the locked transactions\n" +
HelpExampleCli(
"listlockunspent",
"") +
2026 "\nUnlock the transaction again\n" +
HelpExampleCli(
"lockunspent",
"true \"[{\\\"txid\\\":\\\"afbf98345239a27c35db94c03c33d87104ee9ce5c9790f3f756620e6f23d3816\\\",\\\"vout\\\":1}]\"") +
2027 "\nAs a json rpc call\n" +
HelpExampleRpc(
"listlockunspent",
""));
2031 std::vector<COutPoint> vOutpts;
2039 o.
push_back(Pair(
"txid", outpt.hash.GetHex()));
2040 o.
push_back(Pair(
"vout", (
int)outpt.n));
2049 if (fHelp || params.
size() < 1 || params.
size() > 1)
2050 throw std::runtime_error(
2052 "\nSet the transaction fee per kB.\n"
2054 "1. amount (numeric, required) The transaction fee in PRCY/kB rounded to the nearest 0.00000001\n"
2056 "true|false (boolean) Returns true if successful\n"
2064 if (params[0].get_real() != 0.0)
2073 if (fHelp || params.
size() != 0)
2074 throw std::runtime_error(
2076 "Returns an object containing various wallet state info.\n"
2079 " \"walletversion\": xxxxx, (numeric) the wallet version\n"
2080 " \"balance\": xxxxxxx, (numeric) the total PRCY balance of the wallet\n"
2081 " \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed balance of the wallet in PRCY\n"
2082 " \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in PRCY\n"
2083 " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
2084 " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
2085 " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
2086 " \"walletunlocked\": true|false,(boolean) if the wallet is unlocked\n"
2087 " \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
2088 " \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in PRCY/kB\n"
2112 if (fHelp || params.
size() != 0)
2113 throw std::runtime_error(
2115 "Returns the total number of transactions in the wallet.\n"
2118 " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
2133 if (fHelp || params.
size() > 2)
2134 throw std::runtime_error(
2135 "reservebalance ( reserve amount )\n"
2136 "\nShow or set the reserve amount not participating in network protection\n"
2137 "If no parameters provided current setting is printed.\n"
2140 "1. reserve (boolean, optional) is true or false to turn balance reserve on or off.\n"
2141 "2. amount (numeric, optional) is a real and rounded to cent.\n"
2145 " \"reserve\": true|false, (boolean) Status of the reserve balance\n"
2146 " \"amount\": x.xxxx (numeric) Amount reserved\n"
2152 if (params.
size() > 0) {
2153 bool fReserve = params[0].
get_bool();
2155 if (params.
size() == 1)
2156 throw std::runtime_error(
"must provide amount to reserve balance.\n");
2158 nAmount = (nAmount / CENT) * CENT;
2160 throw std::runtime_error(
"amount cannot be negative.\n");
2167 if (params.
size() > 1)
2168 throw std::runtime_error(
"cannot specify amount to turn off reserve.\n");
2182 if (fHelp || params.
size() != 1)
2183 throw std::runtime_error(
2184 "setstakesplitthreshold value\n"
2185 "\nThis will set the output size of your stakes to never be below this number\n"
2188 "1. value (numeric, required) Threshold value between 1 and 999999\n"
2191 " \"threshold\": n, (numeric) Threshold value set\n"
2192 " \"saved\": true|false (boolean) 'true' if successfully saved to the wallet file\n"
2197 uint64_t nStakeSplitThreshold = params[0].
get_int();
2200 if (nStakeSplitThreshold > 999999)
2201 throw std::runtime_error(
"Value out of range, max allowed is 999999");
2213 result.
push_back(Pair(
"saved",
"true"));
2215 result.
push_back(Pair(
"saved",
"false"));
2224 if (fHelp || params.
size() != 0)
2225 throw std::runtime_error(
2226 "getstakesplitthreshold\n"
2227 "Returns the threshold for stake splitting\n"
2229 "n (numeric) Threshold value\n"
2239 if (params.
size() >= 1)
2242 if (fHelp || params.
size() < 1 || (fEnable && params.
size() != 2) || params.
size() > 2)
2243 throw std::runtime_error(
2244 "autocombinedust true|false ( threshold )\n"
2245 "\nWallet will automatically monitor for any coins with value below the threshold amount, and combine them if they reside with the same PRCY address\n"
2246 "When autocombinedust runs it will create a transaction, and therefore will be subject to transaction fees. Minimum of 25 dust transactions before activation.\n"
2249 "1. true|false (boolean, required) Enable auto combine (true) or disable (false)\n"
2250 "2. threshold (numeric, optional) Threshold amount (default: 0)\n"
2258 nThreshold = params[1].
get_int();
2267 throw std::runtime_error(
"Changed settings in wallet but failed to save to database\n");
2270 result.
push_back(Pair(
"autocombinedust", params[0].get_bool()));
2291 ret.
push_back(
"MultiSend Addresses to Send To:");
2305 std::vector<COutput> vCoins;
2307 std::map<std::string, double> mapAddresses;
2308 for (
const COutput& out : vCoins) {
2313 if (mapAddresses.find(strAdd) == mapAddresses.end())
2314 mapAddresses[strAdd] = (double)out.tx->vout[out.i].nValue / (
double)COIN;
2316 mapAddresses[strAdd] += (double)out.tx->vout[out.i].nValue / (
double)COIN;
2320 for (std::map<std::string, double>::const_iterator it = mapAddresses.begin(); it != mapAddresses.end(); ++it) {
2322 const std::string* strAdd = &(*it).first;
2323 const double* nBalance = &(*it).second;
2324 obj.
push_back(Pair(
"Address ", *strAdd));
2325 obj.
push_back(Pair(
"Balance ", *nBalance));
2334 unsigned int sum = 0;
2345 if (params.
size() == 1) {
2346 std::string strCommand = params[0].
get_str();
2348 if (strCommand ==
"print") {
2350 }
else if (strCommand ==
"printaddress" || strCommand ==
"printaddresses") {
2352 }
else if (strCommand ==
"clear") {
2355 bool erased =
false;
2365 obj.
push_back(Pair(
"Erased from database", erased));
2366 obj.
push_back(Pair(
"Erased from RAM",
true));
2370 }
else if (strCommand ==
"enablestake" || strCommand ==
"activatestake") {
2378 obj.
push_back(Pair(
"error",
"MultiSend activated but writing settings to DB failed"));
2388 }
else if (strCommand ==
"enablemasternode" || strCommand ==
"activatemasternode") {
2397 obj.
push_back(Pair(
"error",
"MultiSend activated but writing settings to DB failed"));
2407 }
else if (strCommand ==
"disable" || strCommand ==
"deactivate") {
2413 }
else if (strCommand ==
"enableall") {
2415 return "failed to clear old vector from walletDB";
2422 if (params.
size() == 2 && params[0].
get_str() ==
"delete") {
2423 int del = std::stoi(params[1].get_str().c_str());
2433 if (params.
size() == 2 && params[0].
get_str() ==
"disable") {
2434 std::string disAddress = params[1].
get_str();
2450 if (fHelp || params.
size() != 2)
2451 throw std::runtime_error(
2452 "multisend <command>\n"
2453 "****************************************************************\n"
2454 "WHAT IS MULTISEND?\n"
2455 "MultiSend allows a user to automatically send a percent of their stake reward to as many addresses as you would like\n"
2456 "The MultiSend transaction is sent when the staked coins mature (100 confirmations)\n"
2457 "****************************************************************\n"
2458 "TO CREATE OR ADD TO THE MULTISEND VECTOR:\n"
2459 "multisend <PRCY Address> <percent>\n"
2460 "This will add a new address to the MultiSend vector\n"
2461 "Percent is a whole number 1 to 100.\n"
2462 "****************************************************************\n"
2463 "MULTISEND COMMANDS (usage: multisend <command>)\n"
2464 " print - displays the current MultiSend vector \n"
2465 " clear - deletes the current MultiSend vector \n"
2466 " enablestake/activatestake - activates the current MultiSend vector to be activated on stake rewards\n"
2467 " enablemasternode/activatemasternode - activates the current MultiSend vector to be activated on masternode rewards\n"
2468 " disable/deactivate - disables the current MultiSend vector \n"
2469 " delete <Address #> - deletes an address from the MultiSend vector \n"
2470 " disable <address> - prevents a specific address from sending MultiSend transactions\n"
2471 " enableall - enables all addresses to be eligible to send MultiSend transactions\n"
2472 "****************************************************************\n");
2475 std::string strAddress = params[0].
get_str();
2479 if (std::stoi(params[1].get_str().c_str()) < 0)
2484 unsigned int nPercent = (
unsigned int) std::stoul(params[1].get_str().c_str());
2490 if (nPercent == 0) {
2506 std::pair<std::string, int> newMultiSend;
2507 newMultiSend.first = strAddress;
2508 newMultiSend.second = nPercent;
2520 if (fHelp || params.
size() >2 || params.
size() < 1)
2521 throw std::runtime_error(
2522 "createprivacywallet \"password\" (\"language\") \n"
2523 "\nCreate a new wallet for privacy with dual-key stealth address.\n"
2524 "If 'language' is specified, it is used, otherwise english \n"
2526 "1. \"account\" (string, required) password for the wallet \n"
2527 "2. \"language\" (string, optional) language for the wallet's mnemmonics \n"
2529 "\"privacy wallet created\" (string) the base address of the wallet\n"
2537 "Error: RPC unimplemented.");
2542 if (fHelp || params.
size() != 0)
2543 throw std::runtime_error(
2544 "createprivacyaccount \n"
2545 "\nCreate a new wallet account for privacy.\n"
2548 "\"account address\" (string) the address of the created account\n"
2558 std::string viewAccountLabel =
"viewaccount";
2559 std::string spendAccountLabel =
"spendaccount";
2562 walletdb.
ReadAccount(viewAccountLabel, viewAccount);
2568 walletdb.
ReadAccount(spendAccountLabel, spendAccount);
2580 std::string stealthAddr;
2582 ret.
push_back(Pair(
"stealthaddress", stealthAddr));
2591 if (fHelp || params.
size() != 0)
2592 throw std::runtime_error(
2593 "showstealthaddress \n"
2594 "\nShow stealth address.\n"
2597 "\"account address\" (string) the address of the created account\n"
2603 std::string address;
2610 if (fHelp || params.
size() > 1)
2611 throw std::runtime_error(
2612 "generateintegratedaddress <paymentID>\n"
2613 "\nGenerate integrated addresses for this wallet with a random payment ID.\n"
2615 "optional: paymentID"
2623 uint64_t paymentID = 0;
2624 std::string address;
2625 if (params.
size() == 1) {
2631 ret.
push_back(Pair(
"integratedaddress", address));
2632 ret.
push_back(Pair(
"paymentid", paymentID));
2638 if (fHelp || params.
size() != 2)
2639 throw std::runtime_error(
2641 "\nCreate a new wallet account for privacy.\n"
2644 "\"account address\" (string) the address of the created account\n"
2652 std::string viewStr = params[0].
get_str();
2653 std::string spendStr = params[1].
get_str();
2657 std::vector<unsigned char> view, spend;
2660 std::string viewAccountLabel =
"viewaccount";
2661 std::string spendAccountLabel =
"spendaccount";
2663 CKey viewPk, spendPk;
2664 viewPk.
Set(view.begin(), view.end(),
true);
2665 spendPk.
Set(spend.begin(), spend.end(),
true);
2683 if (fHelp || params.
size() != 1)
2684 throw std::runtime_error(
2685 "createprivacysubaddress \"label\" \n"
2686 "\nCreate a new wallet account subaddress for privacy transaction.\n"
2688 "1. \"label\" (string, required) label for the wallet account address\n"
2690 "\"account address\" (string) the created address for the corresponding account\n"
2691 "\"address index\" (string) the index of the created address for the account\n"
2698 std::string label = params[0].
get_str();
2701 std::string viewAccountLabel = label +
"view";
2702 std::string spendAccountLabel = label +
"spend";
2708 walletdb.
ReadAccount(label +
"view", viewAccount);
2714 walletdb.
ReadAccount(spendAccountLabel, spendAccount);
2735 std::string stealthAddr;
2737 ret.
push_back(Pair(
"stealthaddress", stealthAddr));
2744 if (fHelp || params.
size() != 0)
2745 throw std::runtime_error(
2746 "readmasteraccount \n"
2747 "\nRead stealth master account address.\n"
2750 "\"public address\" (string) the public address"
2756 std::string address;
2763 if (fHelp || params.
size() != 1)
2764 throw std::runtime_error(
2765 "decodestealthaddress \n"
2766 "\nDecode a stealth address into spend and view public keys.\n"
2768 "1. \"stealth_address\" (string, required) The Base58 stealth address\n"
2770 "\"public view key\" (string) the view public key\n"
2771 "\"public spend key\" (string) the spend public key"
2777 std::string addr = params[0].
get_str();
2786 "Error: Stealth address is not correctly formatted.");
2791 ret.
push_back(Pair(
"paymentid", paymentID));
2799 if (fHelp || params.
size() < 2 || params.
size() > 3)
2800 throw std::runtime_error(
2801 "sendtostealthaddress \"prcystealthaddress\" amount\n"
2802 "\nSend an amount to a given prcy stealth address address. The amount is a real and is rounded to the nearest 0.00000001\n" +
2805 "1. \"prcystealthaddress\" (string, required) The prcycoin stealth address to send to.\n"
2806 "2. \"amount\" (numeric, required) The amount in PRCY to send. eg 0.1\n"
2807 "3. \"lock_output\" (bool, optional, default=false) Whether to lock the output or not.\n"
2809 "\"transactionid\" (string) The transaction id.\n"
2811 HelpExampleCli(
"sendtostealthaddress",
"\"Pap5WCV4SjVMGLyYf98MEX82ErBEMVpg9ViQ1up3aBib6Fz4841SahrRXG6eSNSLBSNvEiGuQiWKXJC3RDfmotKv15oCrh6N2Ym\" 0.1") +
HelpExampleCli(
"sendtostealthaddress",
"\"Pap5WCV4SjVMGLyYf98MEX82ErBEMVpg9ViQ1up3aBib6Fz4841SahrRXG6eSNSLBSNvEiGuQiWKXJC3RDfmotKv15oCrh6N2Ym\" 0.1 \"donation\" \"seans outpost\"") +
HelpExampleRpc(
"sendtostealthaddress",
"\"Pap5WCV4SjVMGLyYf98MEX82ErBEMVpg9ViQ1up3aBib6Fz4841SahrRXG6eSNSLBSNvEiGuQiWKXJC3RDfmotKv15oCrh6N2Ym\", 0.1, \"donation\", \"seans outpost\""));
2816 std::string stealthAddr = params[0].
get_str();
2825 bool lockOutput =
false;
2826 if (params.
size() > 2)
2831 "Cannot create transaction.");
2834 std::string myAddress;
2837 if (stealthAddr == myAddress) {
2839 for (
int i=0; i < (int)wtx.
vout.size(); i++) {
2843 if (value == nAmount) {
2859 if (fHelp || params.
size() < 1 || params.
size() > 2)
2860 throw std::runtime_error(
2861 "sendalltostealthaddress \"prcystealthaddress\" ( includeLocked )\n"
2862 "\nSend all PRCY to stealth address\n" +
2865 "1. \"prcystealthaddress\" (string, required) The prcycoin stealth address to send to.\n"
2866 "2. \"include_locked\" (bool, optional, default=false) Whether to include locked coins or not.\n"
2868 "\"transactionid\" (string) The transaction id.\n"
2870 HelpExampleCli(
"sendalltostealthaddress",
"\"Pap5WCV4SjVMGLyYf98MEX82ErBEMVpg9ViQ1up3aBib6Fz4841SahrRXG6eSNSLBSNvEiGuQiWKXJC3RDfmotKv15oCrh6N2Ym\""));
2875 std::string stealthAddr = params[0].
get_str();
2881 bool inclLocked =
false;
2882 if (params.
size() > 1)
2887 "Cannot create transaction.");
2894 if (fHelp || params.
size() != 1)
2895 throw std::runtime_error(
2896 "setdecoyconfirmation\n"
2897 "\nSend the minimum confirmation for decoys in RingCT\n" +
2900 "2. \"confirm\" (numeric, required) The required minim confirmation for decoys\n"
2902 "\"decoy_confirmation\" (numeric) The minimum decoy confirmation.\n"
2908 int confirmation = params[0].
get_int();
2910 if (confirmation <= 0) {
2912 "Error: Min decoy confirmation must be positive.");
2916 ret.
push_back(Pair(
"decoy_confirmation", confirmation));
2922 if (fHelp || params.
size() != 0)
2923 throw std::runtime_error(
2924 "getdecoyconfirmation\n"
2925 "\nShow the current decoy confirmation\n" +
2929 "\"decoy_confirmation\" (numeric) The minimum decoy confirmation.\n"
2940 std::string
GetHex(
const unsigned char* vch,
int sz) {
2941 char psz[sz * 2 + 1];
2942 for (
int i = 0; i < sz; i++)
2943 sprintf(psz + i * 2,
"%02x", vch[sz - i - 1]);
2944 return std::string(psz, psz + sz * 2);
2948 if (fHelp || params.
size() != 0)
2949 throw std::runtime_error(
2950 "revealviewprivatekey \n"
2951 "\nReveal view private key.\n"
2954 "\"Private view key\" (string) the private view key\n"
2968 if (fHelp || params.
size() != 0)
2969 throw std::runtime_error(
2970 "revealspendprivatekey \n"
2971 "\nReveal view private key.\n"
2974 "\"Private spend key\" (string) the private spend key\n"
2988 if (fHelp || params.
size() != 1)
2989 throw std::runtime_error(
2990 "showtxprivatekeys <txhash>\n"
2991 "\nShow transaction private keys for each UTXO of a transaction.\n"
2994 "\"Private spend key\" (string) the private spend key\n"
3004 for(
int i = 0; i < 10; i++) {
3005 std::string
key = params[0].
get_str() + std::to_string(i);
3008 ret.
push_back(Pair(std::to_string(i), secret));
3015 if (fHelp || params.
size() != 0)
3016 throw std::runtime_error(
3018 "\nRescan wallet transactions from the first block.\n"
3021 "\"scanned wallet transactions\" \n"
3031 return "Failed to rescan";
3037 if (fHelp || params.
size() != 1)
3038 throw std::runtime_error(
3039 "rescanwallettransactions \"block height\"\n"
3040 "\nRescan wallet transactions from a certain block height.\n"
3042 "\nblock height: block height from which the chain will be rescanned\n"
3044 "\"scanned wallet transactions\" \n"
3053 if (params.
size() == 1) {
3054 nHeight = params[0].
get_int();
3057 return "Failed to rescan";
3063 if (fHelp || params.
size() != 0)
3064 throw std::runtime_error(
3065 "erasewallettransactions \n"
3066 "\nErase wallet transactions based on prcycoin.conf parameters\n"
3068 "\"erased wallet transactions\" \n"
3080 int newCount, removedTxes = 0;
3087 ret.push_back(Pair(
"deleted_utxo_count", ret[
"initial_utxo_count"].get_int() - ret[
"new_utxo_count"].get_int()));
3093 removedTxes = initialCount - newCount;
3096 ret.
push_back(Pair(
"initial_utxo_count", initialCount));
3097 ret.
push_back(Pair(
"new_utxo_count", newCount));
3098 ret.
push_back(Pair(
"deleted_utxo_count", removedTxes));
3100 >>>>>>> 8b6832858a1ed35a91aa239a94722b31d6e659f1
3106 if (fHelp || params.
size() != 0)
3107 throw std::runtime_error(
3108 "revealmnemonicphrase \n"
3109 "\nReveal Mnemonic Phrase.\n"
3112 "\"Mnemonic Phrase\" (string) mnemonic phrase\n"
3130 if (fHelp || params.
size() != 1)
3131 throw std::runtime_error(
3133 "\nErase a transaction from the wallet.\n"
3142 hash.
SetHex(params[0].get_str());
3148 return "Failed to delete transaction";
@ RPC_INVALID_REQUEST
Standard JSON-RPC 2.0 errors.
void LockCoin(COutPoint &output)
@ RPC_MISC_ERROR
General application defined errors.
UniValue gettransaction(const UniValue ¶ms, bool fHelp)
UniValue sendalltostealthaddress(const UniValue ¶ms, bool fHelp)
uint8_t isminefilter
used for bitflags of isminetype
const uint256 UINT256_ZERO
constant uint256 instances
UniValue multisend(const UniValue ¶ms, bool fHelp)
std::vector< uint256 > txids
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
int64_t IncOrderPosNext(CWalletDB *pwalletdb=NULL)
Increment the next transaction order id.
bool EncodeStealthPublicAddress(const std::vector< unsigned char > &pubViewKey, const std::vector< unsigned char > &pubSpendKey, std::string &pubAddr)
std::set< std::set< CTxDestination > > GetAddressGroupings()
UniValue addmultisigaddress(const UniValue ¶ms, bool fHelp)
UniValue showtxprivatekeys(const UniValue ¶ms, bool fHelp)
bool fWalletUnlockStakingOnly
UniValue listreceivedbyaddress(const UniValue ¶ms, bool fHelp)
int64_t GetTime()
For unit testing.
std::map< uint256, CWalletTx > mapWallet
UniValue erasewallettransactions(const UniValue ¶ms, bool fHelp)
bool SendAll(std::string des, CWalletTx &wtxNew, bool inclLocked)
@ RPC_WALLET_ALREADY_UNLOCKED
Failed to encrypt the wallet.
@ RPC_WALLET_WRONG_ENC_STATE
The wallet passphrase entered was incorrect.
CAmount GetImmatureBalance() const
void DeriveNewChildKey(uint32_t nAccountIndex, CKey &secretRet)
bool CommitTransaction(CWalletTx &wtxNew, CReserveKey &reservekey, std::string strCommand=NetMsgType::TX)
Call after CreateTransaction unless you want to abort.
int64_t GetOldestKeyPoolTime()
@ RPC_PRIVACY_DECOY_MIN
Privacy wallet is existed.
uint64_t nStakeSplitThreshold
bool GetKeyID(CKeyID &keyID) const
isminetype IsMine(const CTxIn &txin) const
UniValue listaddressgroupings(const UniValue ¶ms, bool fHelp)
std::multimap< int64_t, TxPair > TxItems
std::string GetHex() const
UniValue backupwallet(const UniValue ¶ms, bool fHelp)
UniValue listtransactions(const UniValue ¶ms, bool fHelp)
UniValue ValueFromAmount(const CAmount &amount)
UniValue createprivacywallet(const UniValue ¶ms, bool fHelp)
void SendMoney(const CTxDestination &address, CAmount nValue, CWalletTx &wtxNew, bool fUseIX=false)
CChain chainActive
The currently-connected chain of blocks.
UniValue lockunspent(const UniValue ¶ms, bool fHelp)
const UniValue NullUniValue
CScript GetScriptForDestination(const CTxDestination &dest)
bool GetKeyFromPool(CPubKey &key)
bool WriteMSDisabledAddresses(std::vector< std::string > vDisabledAddresses)
base58-encoded PRCY addresses.
int64_t nWalletUnlockTime
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
bool ReadAccount(const std::string &strAccount, CAccount &account)
UniValue reservebalance(const UniValue ¶ms, bool fHelp)
bool Unlock(const SecureString &strWalletPassphrase, bool anonimizeOnly=false)
int nHeight
height of the entry in the chain. The genesis block has height 0
A key allocated from the key pool.
UniValue listsinceblock(const UniValue ¶ms, bool fHelp)
UniValue listlockunspent(const UniValue ¶ms, bool fHelp)
bool AddAccountingEntry(const CAccountingEntry &, CWalletDB &pwalletdb)
UniValue importkeys(const UniValue ¶ms, bool fHelp)
const char * IX
The ix message transmits a single SwiftX transaction.
CAmount GetSpendableBalance()
CAmount nAutoCombineThreshold
UniValue printMultiSend()
UniValue decodestealthaddress(const UniValue ¶ms, bool fHelp)
UniValue walletpassphrasechange(const UniValue ¶ms, bool fHelp)
std::string HelpRequiringPassphrase()
void AcentryToJSON(const CAccountingEntry &acentry, const std::string &strAccount, UniValue &ret)
@ RPC_WALLET_KEYPOOL_RAN_OUT
Invalid account name.
bool EraseMultiSend(std::vector< std::pair< std::string, int > > vMultiSend)
bool CreateTransaction(CScript scriptPubKey, int64_t nValue, CWalletTx &wtxNew, CReserveKey &reservekey, int64_t &nFeeRet, std::string &strFailReason, const CCoinControl *coinControl)
std::set< CTxDestination > GetAccountAddresses(std::string strAccount) const
A reference to a CKey: the Hash160 of its serialized public key.
void RPCTypeCheck(const UniValue ¶ms, const std::list< UniValue::VType > &typesExpected, bool fAllowNull)
Type-check arguments; throws JSONRPCError if wrong type given.
@ RPC_WALLET_INVALID_ACCOUNT_NAME
Not enough funds in wallet or account.
bool Set(const CKeyID &id)
bool ComputeStealthPublicAddress(const std::string &accountName, std::string &pubAddress)
void EnsureWalletIsUnlocked(bool fAllowAnonOnly)
bool GetReservedKey(CPubKey &pubkey)
bool DecodeBase58(const char *psz, std::vector< unsigned char > &vch)
Decode a base58-encoded string (psz) into a byte vector (vchRet).
std::string FormatMoney(const CAmount &n, bool fPlus)
Money parsing/formatting utilities.
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
Check if transaction is final and can be included in a block with the specified height and time.
UniValue listtransactionsbypaymentid(const UniValue ¶ms, bool fHelp)
UniValue movecmd(const UniValue ¶ms, bool fHelp)
std::string ToString() const
std::map< CTxDestination, CAmount > GetAddressBalances()
UniValue listaccounts(const UniValue ¶ms, bool fHelp)
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE)
Transaction fee set by the user.
UniValue gettxcount(const UniValue ¶ms, bool fHelp)
Fee rate in PRCY per kilobyte: CAmount / kB.
void UnlockCoin(COutPoint &output)
int64_t DecoyConfirmationMinimum
std::string GetHex() const
The basic transaction that is broadcasted on the network and contained in blocks.
A base58-encoded secret key.
CBitcoinAddress GetHDAccountAddress(std::string strAccount, uint32_t nAccountIndex, bool bForceNew=false)
bool AddCScript(const CScript &redeemScript)
Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki.
UniValue getrawchangeaddress(const UniValue ¶ms, bool fHelp)
std::vector< std::string > vDisabledAddresses
void const uint64_t uint64_t * r
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
UniValue getreceivedbyaddress(const UniValue ¶ms, bool fHelp)
const std::string & get_str() const
UniValue readmasteraccount(const UniValue ¶ms, bool fHelp)
UniValue rescanwallettransactions(const UniValue ¶ms, bool fHelp)
RecursiveMutex cs_main
Global state.
UniValue setaccount(const UniValue ¶ms, bool fHelp)
unsigned int nTimeReceived
int64_t get_int64() const
UniValue sendfrom(const UniValue ¶ms, bool fHelp)
const UniValue & get_obj() const
bool IsHex(const std::string &str)
UniValue autocombinedust(const UniValue ¶ms, bool fHelp)
UniValue walletlock(const UniValue ¶ms, bool fHelp)
void RPCTypeCheckObj(const UniValue &o, const std::map< std::string, UniValue::VType > &typesExpected, bool fAllowNull)
Check for expected keys/value types in an Object.
CAmount GetCredit(const isminefilter &filter) const
An output of a transaction.
void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry)
CAmount GetAccountBalance(CWalletDB &walletdb, const std::string &strAccount, int nMinDepth, const isminefilter &filter)
UniValue settxfee(const UniValue ¶ms, bool fHelp)
std::string GenerateIntegratedAddressWithProvidedPaymentID(std::string accountName, uint64_t paymentID)
UniValue unlockwallet(const UniValue ¶ms, bool fHelp)
UniValue getbalance(const UniValue ¶ms, bool fHelp)
std::vector< CTxOut > vout
std::vector< std::pair< std::string, int > > vMultiSend
UniValue revealviewprivatekey(const UniValue ¶ms, bool fHelp)
@ RPC_WALLET_PASSPHRASE_INCORRECT
Enter the wallet passphrase with unlockwallet first.
bool mySpendPrivateKey(CKey &spend) const
UniValue encryptwallet(const UniValue ¶ms, bool fHelp)
CAmount GetDebit(const isminefilter &filter) const
UniValue getunconfirmedbalance(const UniValue ¶ms, bool fHelp)
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
Create a compact signature (65 bytes), which allows reconstructing the used public key.
@ RPC_DATABASE_ERROR
Invalid, missing or duplicate parameter.
CAmount GetLockedCoins() const
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
void RPCRunLater(const std::string &name, boost::function< void(void)> func, int64_t nSeconds)
Run func nSeconds from now.
bool push_backV(const std::vector< UniValue > &vec)
UniValue getaccount(const UniValue ¶ms, bool fHelp)
#define PAIRTYPE(t1, t2)
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
Access to the wallet database (wallet.dat)
UniValue sendmany(const UniValue ¶ms, bool fHelp)
int GetVersion()
get the current wallet format (the oldest client version guaranteed to understand this wallet)
@ RPC_WALLET_UNLOCK_NEEDED
Keypool ran out, call keypoolrefill first.
UniValue JSONRPCError(int code, const std::string &message)
int64_t CAmount
Amount in PRCY (Can be negative)
@ RPC_WALLET_ENCRYPTION_FAILED
Command given in wrong wallet encryption state (encrypting an encrypted wallet etc....
bool WriteAutoCombineSettings(bool fEnable, CAmount nCombineThreshold)
std::string strOtherAccount
@ RPC_WALLET_ERROR
Invalid IP/Subnet.
const std::vector< std::string > & getKeys() const
std::string HelpExampleRpc(std::string methodname, std::string args)
256-bit unsigned big integer.
uint256 uint256S(const char *str)
UniValue signmessage(const UniValue ¶ms, bool fHelp)
CBitcoinAddress GetAccountAddress(std::string strAccount, bool bForceNew=false)
void SetHex(const char *psz)
CAmount GetUnconfirmedBalance() const
CAmount AmountFromValue(const UniValue &value)
CPubKey GetPubKey() const
Compute the public key from a private key.
int64_t GetTxTime() const
Serialized script, used inside transaction inputs and outputs.
bool DeleteWalletTransactions(const CBlockIndex *pindex, bool fRescan=false)
std::string strFromAccount
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
bool SendToStealthAddress(const std::string &stealthAddr, CAmount nValue, CWalletTx &wtxNew, bool fUseIX=false, int ringSize=5)
@ ISMINE_WATCH_ONLY
Indicates that we dont know how to create a scriptSig that would solve this if we were given the appr...
void ListTransactions(const CWalletTx &wtx, const std::string &strAccount, int nMinDepth, bool fLong, UniValue &ret, const isminefilter &filter)
uint256 GetBlockHash() const
std::string EncodeBase64(const unsigned char *pch, size_t len)
UniValue getdecoyconfirmation(const UniValue ¶ms, bool fHelp)
CAmount GetAccountCreditDebit(const std::string &strAccount)
UniValue createprivacyaccount(const UniValue ¶ms, bool fHelp)
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
UniValue setdecoyconfirmation(const UniValue ¶ms, bool fHelp)
int GetDepthInMainChain(const CBlockIndex *&pindexRet, bool enableIX=true) const
Return depth of transaction in blockchain: -1 : not in blockchain, and not in memory pool (conflicted...
UniValue keypoolrefill(const UniValue ¶ms, bool fHelp)
int Height() const
Return the maximal height in the chain.
std::string GetHex(const unsigned char *vch, int sz)
UniValue getaddressesbyaccount(const UniValue ¶ms, bool fHelp)
UniValue rescan(const UniValue ¶ms, bool fHelp)
std::list< CAccountingEntry > laccentries
void setMultiSendDisabled()
std::string HelpExampleCli(std::string methodname, std::string args)
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
bool EncryptWallet(const SecureString &strWalletPassphrase)
UniValue getbalances(const UniValue ¶ms, bool fHelp)
static bool DecodeStealthAddress(const std::string &stealth, CPubKey &pubViewKey, CPubKey &pubSpendKey, bool &hasPaymentID, uint64_t &paymentID)
bool WriteAccount(const std::string &strAccount, const CAccount &account)
UniValue createprivacysubaddress(const UniValue ¶ms, bool fHelp)
An encapsulated public key.
int64_t GetAdjustedTime()
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 revealmnemonicphrase(const UniValue ¶ms, bool fHelp)
void GetAmounts(std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, CAmount &nFee, std::string &strSentAccount, const isminefilter &filter) const
int GetBlocksToMaturity() const
const char * TX
The tx message transmits a single transaction.
UniValue getaccountaddress(const UniValue ¶ms, bool fHelp)
An encapsulated private key.
bool TopUpKeyPool(unsigned int kpSize=0)
@ RPC_WALLET_INSUFFICIENT_FUNDS
Unspecified problem with wallet (key not found etc.)
std::string AccountFromValue(const UniValue &value)
virtual bool AddKey(const CKey &key)
bool WriteMSettings(bool fMultiSendStake, bool fMultiSendMasternode, int nLastMultiSendHeight)
UniValue printAddresses()
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
A transaction with a bunch of additional info that only the owner cares about.
bool RescanAfterUnlock(int fromHeight)
A writer stream (for serialization) that computes a 256-bit hash.
bool push_back(const UniValue &val)
const std::string strMessageMagic
UniValue sendtostealthaddress(const UniValue ¶ms, bool fHelp)
UniValue revealspendprivatekey(const UniValue ¶ms, bool fHelp)
CScript _createmultisig_redeemScript(const UniValue ¶ms)
Used by addmultisigaddress / createmultisig:
bool GetSeedPhrase(std::string &phrase)
UniValue listreceivedbyaccount(const UniValue ¶ms, bool fHelp)
bool WriteStakeSplitThreshold(uint64_t nStakeSplitThreshold)
UniValue getreceivedbyaccount(const UniValue ¶ms, bool fHelp)
bool ReadTxPrivateKey(const std::string &outpointKey, std::string &k)
UniValue setstakesplitthreshold(const UniValue ¶ms, bool fHelp)
const std::vector< UniValue > & getValues() const
bool EraseMSDisabledAddresses(std::vector< std::string > vDisabledAddresses)
UniValue getwalletinfo(const UniValue ¶ms, bool fHelp)
const uint256 & GetHash() const
bool BackupWallet(const CWallet &wallet, const fs::path &strDest, bool fEnableCustom)
unsigned int GetKeyPoolSize()
std::string EncodeHexTx(const CTransaction &tx)
UniValue showstealthaddress(const UniValue ¶ms, bool fHelp)
UniValue ListReceived(const UniValue ¶ms, bool fByAccounts)
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 UniValue & find_value(const UniValue &obj, const std::string &name)
UniValue generateintegratedaddress(const UniValue ¶ms, bool fHelp)
@ RPC_TYPE_ERROR
Server is in safe mode, and command is not allowed in safe mode.
@ RPC_PRIVACY_WALLET_EXISTED
Wallet is already unlocked.
bool WriteReserveAmount(const double &amount)
UniValue getnewaddress(const UniValue ¶ms, bool fHelp)
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
const UniValue & get_array() const
void GetAccountAmounts(const std::string &strAccount, CAmount &nReceived, CAmount &nSent, CAmount &nFee, const isminefilter &filter) const
The block chain is a tree shaped structure starting with the genesis block at the root,...
std::set< uint256 > GetConflicts() const
A reference to a CScript: the Hash160 of its serialization (see script.h)
CAmount GetFeePerK() const
CTxDestination Get() const
bool ReadStealthAccount(const std::string &strAccount, CStealthAccount &account)
void ListLockedCoins(std::vector< COutPoint > &vOutpts)
std::string strWalletFile
unsigned int sumMultiSend()
bool GetKey(const CKeyID &address, CKey &keyOut) const
GetKey implementation that can derive a HD private key on the fly.
int GetIXConfirmations(uint256 nTXHash)
CAmount getCTxOutValue(const CTransaction &tx, const CTxOut &out) const
std::map< CTxDestination, CAddressBookData > mapAddressBook
bool AppendStealthAccountList(const std::string &accountName)
UniValue getstakesplitthreshold(const UniValue ¶ms, bool fHelp)
std::string GenerateIntegratedAddressWithRandomPaymentID(std::string accountName, uint64_t &paymentID)
UniValue erasefromwallet(const UniValue ¶ms, bool fHelp)
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
bool myViewPrivateKey(CKey &view) const
bool fMultiSendMasternodeReward
bool IsFromMe(const isminefilter &filter) const
bool WriteMultiSend(std::vector< std::pair< std::string, int > > vMultiSend)