18 #include <boost/assign/list_of.hpp>
19 #include "json/json_spirit_utils.h"
20 #include "json/json_spirit_value.h"
23 using namespace boost;
33 ?
"\nRequires wallet passphrase to be set with walletpassphrase call."
46 entry.push_back(Pair(
"confirmations", confirms));
48 entry.push_back(Pair(
"generated",
true));
52 entry.push_back(Pair(
"blockindex", wtx.
nIndex));
56 entry.push_back(Pair(
"txid", hash.
GetHex()));
59 conflicts.push_back(conflict.
GetHex());
60 entry.push_back(Pair(
"walletconflicts", conflicts));
61 entry.push_back(Pair(
"time", wtx.
GetTxTime()));
62 entry.push_back(Pair(
"timereceived", (int64_t)wtx.
nTimeReceived));
64 entry.push_back(Pair(item.first, item.second));
69 string strAccount = value.get_str();
70 if (strAccount ==
"*")
77 if (fHelp || params.size() > 1)
79 "getnewaddress ( \"account\" )\n"
80 "\nReturns a new Anoncoin address for receiving payments.\n"
81 "If 'account' is specified (recommended), it is added to the address book \n"
82 "so payments received with the address will be credited to 'account'.\n"
84 "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"
86 "\"anoncoinaddress\" (string) The new anoncoin address\n"
96 if (params.size() > 0)
121 bool bKeyUsed =
false;
154 if (fHelp || params.size() != 1)
156 "getaccountaddress \"account\"\n"
157 "\nReturns the current Anoncoin address for receiving payments to this account.\n"
159 "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"
161 "\"anoncoinaddress\" (string) The account anoncoin address\n"
182 if (fHelp || params.size() > 1)
184 "getrawchangeaddress\n"
185 "\nReturns a new Anoncoin address, for receiving change.\n"
186 "This is for use with raw transactions, NOT normal use.\n"
188 "\"address\" (string) The address\n"
212 if (fHelp || params.size() < 1 || params.size() > 2)
214 "setaccount \"anoncoinaddress\" \"account\"\n"
215 "\nSets the account associated with the given address.\n"
217 "1. \"anoncoinaddress\" (string, required) The anoncoin address to be associated with an account.\n"
218 "2. \"account\" (string, required) The account to assign the address to.\n"
220 +
HelpExampleCli(
"setaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"tabby\"")
221 +
HelpExampleRpc(
"setaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"tabby\"")
230 if (params.size() > 1)
249 if (fHelp || params.size() != 1)
251 "getaccount \"anoncoinaddress\"\n"
252 "\nReturns the account associated with the given address.\n"
254 "1. \"anoncoinaddress\" (string, required) The anoncoin address for account lookup.\n"
256 "\"accountname\" (string) the account address\n"
258 +
HelpExampleCli(
"getaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"")
259 +
HelpExampleRpc(
"getaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"")
269 strAccount = (*mi).second.name;
276 if (fHelp || params.size() != 1)
278 "getaddressesbyaccount \"account\"\n"
279 "\nReturns the list of addresses for the given account.\n"
281 "1. \"account\" (string, required) The account name.\n"
283 "[ (json array of string)\n"
284 " \"anoncoinaddress\" (string) a anoncoin address associated with the given account\n"
299 const string& strName = item.second.
name;
300 if (strName == strAccount)
308 if (fHelp || params.size() < 2 || params.size() > 4)
310 "sendtoaddress \"anoncoinaddress\" amount ( \"comment\" \"comment-to\" )\n"
311 "\nSent an amount to a given address. The amount is a real and is rounded to the nearest 0.00000001\n"
314 "1. \"anoncoinaddress\" (string, required) The anoncoin address to send to.\n"
315 "2. \"amount\" (numeric, required) The amount in btc to send. eg 0.1\n"
316 "3. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
317 " This is not part of the transaction, just kept in your wallet.\n"
318 "4. \"comment-to\" (string, optional) A comment to store the name of the person or organization \n"
319 " to which you're sending the transaction. This is not part of the \n"
320 " transaction, just kept in your wallet.\n"
322 "\"transactionid\" (string) The transaction id.\n"
324 +
HelpExampleCli(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1")
325 +
HelpExampleCli(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"donation\" \"seans outpost\"")
326 +
HelpExampleRpc(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.1, \"donation\", \"seans outpost\"")
338 if (params.size() > 2 && params[2].type() != null_type && !params[2].get_str().empty())
339 wtx.
mapValue[
"comment"] = params[2].get_str();
340 if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
341 wtx.
mapValue[
"to"] = params[3].get_str();
356 "listaddressgroupings\n"
357 "\nLists groups of addresses which have had their common ownership\n"
358 "made public by common use as inputs or as the resulting change\n"
359 "in past transactions\n"
364 " \"anoncoinaddress\", (string) The anoncoin address\n"
365 " amount, (numeric) The amount in btc\n"
366 " \"account\" (string, optional) The account\n"
392 jsonGrouping.push_back(addressInfo);
394 jsonGroupings.push_back(jsonGrouping);
396 return jsonGroupings;
401 if (fHelp || params.size() != 2)
403 "signmessage \"anoncoinaddress\" \"message\"\n"
404 "\nSign a message with the private key of an address"
407 "1. \"anoncoinaddress\" (string, required) The anoncoin address to use for the private key.\n"
408 "2. \"message\" (string, required) The message to create a signature of.\n"
410 "\"signature\" (string) The signature of the message encoded in base 64\n"
412 "\nUnlock the wallet for 30 seconds\n"
414 "\nCreate the signature\n"
415 +
HelpExampleCli(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"") +
416 "\nVerify the signature\n"
417 +
HelpExampleCli(
"verifymessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"") +
419 +
HelpExampleRpc(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"my message\"")
424 string strAddress = params[0].get_str();
425 string strMessage = params[1].get_str();
443 vector<unsigned char> vchSig;
452 if (fHelp || params.size() < 1 || params.size() > 2)
454 "getreceivedbyaddress \"anoncoinaddress\" ( minconf )\n"
455 "\nReturns the total amount received by the given anoncoinaddress in transactions with at least minconf confirmations.\n"
457 "1. \"anoncoinaddress\" (string, required) The anoncoin address for transactions.\n"
458 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
460 "amount (numeric) The total amount in btc received at this address.\n"
462 "\nThe amount from transactions with at least 1 confirmation\n"
463 +
HelpExampleCli(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"") +
464 "\nThe amount including unconfirmed transactions, zero confirmations\n"
465 +
HelpExampleCli(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 0") +
466 "\nThe amount with at least 6 confirmation, very safe\n"
467 +
HelpExampleCli(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 6") +
468 "\nAs a json rpc call\n"
469 +
HelpExampleRpc(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", 6")
483 if (params.size() > 1)
484 nMinDepth = params[1].get_int();
506 if (fHelp || params.size() < 1 || params.size() > 2)
508 "getreceivedbyaccount \"account\" ( minconf )\n"
509 "\nReturns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.\n"
511 "1. \"account\" (string, required) The selected account, may be the default account using \"\".\n"
512 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
514 "amount (numeric) The total amount in btc received for this account.\n"
516 "\nAmount received by the default account with at least 1 confirmation\n"
518 "\nAmount received at the tabby account including unconfirmed amounts with zero confirmations\n"
520 "\nThe amount with at least 6 confirmation, very safe\n"
522 "\nAs a json rpc call\n"
528 if (params.size() > 1)
529 nMinDepth = params[1].get_int();
552 return (
double)nAmount / (double)COIN;
558 int64_t nBalance = 0;
567 int64_t nReceived, nSent, nFee;
571 nBalance += nReceived;
572 nBalance -= nSent + nFee;
590 if (fHelp || params.size() > 3)
592 "getbalance ( \"account\" minconf includeWatchonly )\n"
593 "\nIf account is not specified, returns the server's total available balance.\n"
594 "If account is specified, returns the balance in the account.\n"
595 "Note that the account \"\" is not the same as leaving the parameter out.\n"
596 "The server total may be different to the balance in the default \"\" account.\n"
598 "1. \"account\" (string, optional) The selected account, or \"*\" for entire wallet. It may be the default account using \"\".\n"
599 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
600 "3. includeWatchonly (bool, optional, default=false) Also include balance in watchonly addresses (see 'importaddress')\n"
602 "amount (numeric) The total amount in btc received for this account.\n"
604 "\nThe total amount in the server across all accounts\n"
606 "\nThe total amount in the server across all accounts, with at least 5 confirmations\n"
608 "\nThe total amount in the default account with at least 1 confirmation\n"
610 "\nThe total amount in the account named tabby with at least 6 confirmations\n"
612 "\nAs a json rpc call\n"
616 if (params.size() == 0)
620 if (params.size() > 1)
621 nMinDepth = params[1].get_int();
623 if(params.size() > 2)
624 if(params[2].get_bool())
627 if (params[0].get_str() ==
"*") {
631 int64_t nBalance = 0;
639 string strSentAccount;
640 list<pair<CTxDestination, int64_t> > listReceived;
641 list<pair<CTxDestination, int64_t> > listSent;
642 wtx.
GetAmounts(listReceived, listSent, allFee, strSentAccount, filter);
646 nBalance += r.second;
649 nBalance -= r.second;
664 if (fHelp || params.size() > 0)
666 "getunconfirmedbalance\n"
667 "Returns the server's total unconfirmed balance\n");
672 Value
movecmd(
const Array& params,
bool fHelp)
674 if (fHelp || params.size() < 3 || params.size() > 5)
676 "move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" )\n"
677 "\nMove a specified amount from one account in your wallet to another.\n"
679 "1. \"fromaccount\" (string, required) The name of the account to move funds from. May be the default account using \"\".\n"
680 "2. \"toaccount\" (string, required) The name of the account to move funds to. May be the default account using \"\".\n"
681 "3. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
682 "4. \"comment\" (string, optional) An optional comment, stored in the wallet only.\n"
684 "true|false (boolean) true if successfull.\n"
686 "\nMove 0.01 btc from the default account to the account named tabby\n"
688 "\nMove 0.01 btc timotei to akiko with a comment and funds have 6 confirmations\n"
689 +
HelpExampleCli(
"move",
"\"timotei\" \"akiko\" 0.01 6 \"happy birthday!\"") +
690 "\nAs a json rpc call\n"
691 +
HelpExampleRpc(
"move",
"\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"")
697 if (params.size() > 3)
699 (
void)params[3].get_int();
701 if (params.size() > 4)
702 strComment = params[4].get_str();
739 if (fHelp || params.size() < 3 || params.size() > 6)
741 "sendfrom \"fromaccount\" \"toanoncoinaddress\" amount ( minconf \"comment\" \"comment-to\" )\n"
742 "\nSent an amount from an account to a anoncoin address.\n"
743 "The amount is a real and is rounded to the nearest 0.00000001."
746 "1. \"fromaccount\" (string, required) The name of the account to send funds from. May be the default account using \"\".\n"
747 "2. \"toanoncoinaddress\" (string, required) The anoncoin address to send funds to.\n"
748 "3. amount (numeric, required) The amount in btc. (transaction fee is added on top).\n"
749 "4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
750 "5. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
751 " This is not part of the transaction, just kept in your wallet.\n"
752 "6. \"comment-to\" (string, optional) An optional comment to store the name of the person or organization \n"
753 " to which you're sending the transaction. This is not part of the transaction, \n"
754 " it is just kept in your wallet.\n"
756 "\"transactionid\" (string) The transaction id.\n"
758 "\nSend 0.01 btc from the default account to the address, must have at least 1 confirmation\n"
759 +
HelpExampleCli(
"sendfrom",
"\"\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01") +
760 "\nSend 0.01 from the tabby account to the given address, funds must have at least 6 confirmations\n"
761 +
HelpExampleCli(
"sendfrom",
"\"tabby\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01 6 \"donation\" \"seans outpost\"") +
762 "\nAs a json rpc call\n"
763 +
HelpExampleRpc(
"sendfrom",
"\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"")
772 if (params.size() > 3)
773 nMinDepth = params[3].get_int();
777 if (params.size() > 4 && params[4].type() != null_type && !params[4].get_str().empty())
778 wtx.
mapValue[
"comment"] = params[4].get_str();
779 if (params.size() > 5 && params[5].type() != null_type && !params[5].get_str().empty())
780 wtx.
mapValue[
"to"] = params[5].get_str();
786 if (nAmount > nBalance)
800 if (fHelp || params.size() < 2 || params.size() > 4)
802 "sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" )\n"
803 "\nSend multiple times. Amounts are double-precision floating point numbers."
806 "1. \"fromaccount\" (string, required) The account to send the funds from, can be \"\" for the default account\n"
807 "2. \"amounts\" (string, required) A json object with addresses and amounts\n"
809 " \"address\":amount (numeric) The anoncoin address is the key, the numeric amount in btc is the value\n"
812 "3. minconf (numeric, optional, default=1) Only use the balance confirmed at least this many times.\n"
813 "4. \"comment\" (string, optional) A comment\n"
815 "\"transactionid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n"
816 " the number of addresses.\n"
818 "\nSend two amounts to two different addresses:\n"
819 +
HelpExampleCli(
"sendmany",
"\"tabby\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\"") +
820 "\nSend two amounts to two different addresses setting the confirmation and comment:\n"
821 +
HelpExampleCli(
"sendmany",
"\"tabby\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 6 \"testing\"") +
822 "\nAs a json rpc call\n"
823 +
HelpExampleRpc(
"sendmany",
"\"tabby\", \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\", 6, \"testing\"")
827 Object sendTo = params[1].get_obj();
829 if (params.size() > 2)
830 nMinDepth = params[2].get_int();
834 if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
835 wtx.
mapValue[
"comment"] = params[3].get_str();
837 set<CAnoncoinAddress> setAddress;
838 vector<pair<CScript, int64_t> > vecSend;
840 int64_t totalAmount = 0;
841 BOOST_FOREACH(
const Pair& s, sendTo)
847 if (setAddress.count(address))
849 setAddress.insert(address);
854 totalAmount += nAmount;
856 vecSend.push_back(make_pair(scriptPubKey, nAmount));
863 if (totalAmount > nBalance)
868 int64_t nFeeRequired = 0;
869 string strFailReason;
884 if (fHelp || params.size() < 2 || params.size() > 3)
886 string msg =
"addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n"
887 "\nAdd a nrequired-to-sign multisignature address to the wallet.\n"
888 "Each key is a Anoncoin address or hex-encoded public key.\n"
889 "If 'account' is specified, assign address to that account.\n"
892 "1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
893 "2. \"keysobject\" (string, required) A json array of anoncoin addresses or hex-encoded public keys\n"
895 " \"address\" (string) anoncoin address or hex-encoded public key\n"
898 "3. \"account\" (string, optional) An account to assign the addresses to.\n"
901 "\"anoncoinaddress\" (string) A anoncoin address associated with the keys.\n"
904 "\nAdd a multisig address from 2 addresses\n"
905 +
HelpExampleCli(
"addmultisigaddress",
"2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"") +
906 "\nAs json rpc call\n"
907 +
HelpExampleRpc(
"addmultisigaddress",
"2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"")
909 throw runtime_error(msg);
913 if (params.size() > 2)
935 nConf = std::numeric_limits<int>::max();
936 fIsWatchonly =
false;
944 if (params.size() > 0)
945 nMinDepth = params[0].get_int();
948 bool fIncludeEmpty =
false;
949 if (params.size() > 1)
950 fIncludeEmpty = params[1].get_bool();
953 if(params.size() > 2)
954 if(params[2].get_bool())
958 map<CAnoncoinAddress, tallyitem> mapTally;
967 if (nDepth < nMinDepth)
991 map<string, tallyitem> mapAccountTally;
995 const string& strAccount = item.second.
name;
996 map<CAnoncoinAddress, tallyitem>::iterator it = mapTally.find(address);
997 if (it == mapTally.end() && !fIncludeEmpty)
1000 int64_t nAmount = 0;
1001 int nConf = std::numeric_limits<int>::max();
1002 bool fIsWatchonly =
false;
1003 if (it != mapTally.end())
1005 nAmount = (*it).second.nAmount;
1006 nConf = (*it).second.nConf;
1007 fIsWatchonly = (*it).second.fIsWatchonly;
1012 tallyitem& item = mapAccountTally[strAccount];
1021 obj.push_back(Pair(
"involvesWatchonly",
true));
1022 obj.push_back(Pair(
"address", address.
ToString()));
1023 obj.push_back(Pair(
"account", strAccount));
1025 obj.push_back(Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
1027 if (it != mapTally.end())
1029 BOOST_FOREACH(
const uint256& item, (*it).second.txids)
1031 transactions.push_back(item.
GetHex());
1034 obj.push_back(Pair(
"txids", transactions));
1041 for (map<string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it)
1043 int64_t nAmount = (*it).second.nAmount;
1044 int nConf = (*it).second.nConf;
1046 if((*it).second.fIsWatchonly)
1047 obj.push_back(Pair(
"involvesWatchonly",
true));
1048 obj.push_back(Pair(
"account", (*it).first));
1050 obj.push_back(Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
1060 if (fHelp || params.size() > 3)
1061 throw runtime_error(
1062 "listreceivedbyaddress ( minconf includeempty includeWatchonly)\n"
1063 "\nList balances by receiving address.\n"
1065 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
1066 "2. includeempty (numeric, optional, dafault=false) Whether to include addresses that haven't received any payments.\n"
1067 "3. includeWatchonly (bool, optional, default=false) Whether to include watchonly addresses (see 'importaddress').\n"
1072 " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n"
1073 " \"address\" : \"receivingaddress\", (string) The receiving address\n"
1074 " \"account\" : \"accountname\", (string) The account of the receiving address. The default account is \"\".\n"
1075 " \"amount\" : x.xxx, (numeric) The total amount in btc received by the address\n"
1076 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
1092 if (fHelp || params.size() > 3)
1093 throw runtime_error(
1094 "listreceivedbyaccount ( minconf includeempty includeWatchonly)\n"
1095 "\nList balances by account.\n"
1097 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
1098 "2. includeempty (boolean, optional, default=false) Whether to include accounts that haven't received any payments.\n"
1099 "3. includeWatchonly (bool, optional, default=false) Whether to include watchonly addresses (see 'importaddress').\n"
1104 " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n"
1105 " \"account\" : \"accountname\", (string) The account name of the receiving account\n"
1106 " \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n"
1107 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
1121 static void MaybePushAddress(Object & entry,
const CTxDestination &dest)
1125 entry.push_back(Pair(
"address", addr.
ToString()));
1131 string strSentAccount;
1132 list<pair<CTxDestination, int64_t> > listReceived;
1133 list<pair<CTxDestination, int64_t> > listSent;
1135 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount, filter);
1137 bool fAllAccounts = (strAccount == string(
"*"));
1141 if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
1147 entry.push_back(Pair(
"involvesWatchonly",
true));
1148 entry.push_back(Pair(
"account", strSentAccount));
1149 MaybePushAddress(entry, s.first);
1150 entry.push_back(Pair(
"category",
"send"));
1155 ret.push_back(entry);
1167 if (fAllAccounts || (account == strAccount))
1171 entry.push_back(Pair(
"involvesWatchonly",
true));
1172 entry.push_back(Pair(
"account", account));
1173 MaybePushAddress(entry, r.first);
1177 entry.push_back(Pair(
"category",
"orphan"));
1179 entry.push_back(Pair(
"category",
"immature"));
1181 entry.push_back(Pair(
"category",
"generate"));
1185 entry.push_back(Pair(
"category",
"receive"));
1190 ret.push_back(entry);
1198 bool fAllAccounts = (strAccount == string(
"*"));
1200 if (fAllAccounts || acentry.
strAccount == strAccount)
1203 entry.push_back(Pair(
"account", acentry.
strAccount));
1204 entry.push_back(Pair(
"category",
"move"));
1205 entry.push_back(Pair(
"time", acentry.
nTime));
1208 entry.push_back(Pair(
"comment", acentry.
strComment));
1209 ret.push_back(entry);
1215 if (fHelp || params.size() > 4)
1216 throw runtime_error(
1217 "listtransactions ( \"account\" count from includeWatchonly)\n"
1218 "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.\n"
1220 "1. \"account\" (string, optional) The account name. If not included, it will list all transactions for all accounts.\n"
1221 " If \"\" is set, it will list transactions for the default account.\n"
1222 "2. count (numeric, optional, default=10) The number of transactions to return\n"
1223 "3. from (numeric, optional, default=0) The number of transactions to skip\n"
1224 "4. includeWatchonly (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')\n"
1228 " \"account\":\"accountname\", (string) The account name associated with the transaction. \n"
1229 " It will be \"\" for the default account.\n"
1230 " \"address\":\"anoncoinaddress\", (string) The anoncoin address of the transaction. Not present for \n"
1231 " move transactions (category = move).\n"
1232 " \"category\":\"send|receive|move\", (string) The transaction category. 'move' is a local (off blockchain)\n"
1233 " transaction between accounts, and not associated with an address,\n"
1234 " transaction id or block. 'send' and 'receive' transactions are \n"
1235 " associated with an address, transaction id and block details\n"
1236 " \"amount\": x.xxx, (numeric) The amount in btc. This is negative for the 'send' category, and for the\n"
1237 " 'move' category for moves outbound. It is positive for the 'receive' category,\n"
1238 " and for the 'move' category for inbound funds.\n"
1239 " \"fee\": x.xxx, (numeric) The amount of the fee in btc. This is negative and only available for the \n"
1240 " 'send' category of transactions.\n"
1241 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n"
1242 " 'receive' category of transactions.\n"
1243 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
1244 " category of transactions.\n"
1245 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
1246 " category of transactions.\n"
1247 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1248 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1249 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n"
1250 " for 'send' and 'receive' category of transactions.\n"
1251 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1252 " \"otheraccount\": \"accountname\", (string) For the 'move' category of transactions, the account the funds came \n"
1253 " from (for receiving funds, positive amounts), or went to (for sending funds,\n"
1254 " negative amounts).\n"
1259 "\nList the most recent 10 transactions in the systems\n"
1261 "\nList the most recent 10 transactions for the tabby account\n"
1263 "\nList transactions 100 to 120 from the tabby account\n"
1265 "\nAs a json rpc call\n"
1269 string strAccount =
"*";
1270 if (params.size() > 0)
1271 strAccount = params[0].get_str();
1273 if (params.size() > 1)
1274 nCount = params[1].get_int();
1276 if (params.size() > 2)
1277 nFrom = params[2].get_int();
1279 if(params.size() > 3)
1280 if(params[3].get_bool())
1290 std::list<CAccountingEntry> acentries;
1294 for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
1296 CWalletTx *
const pwtx = (*it).second.first;
1303 if ((
int)ret.size() >= (nCount+nFrom))
break;
1307 if (nFrom > (
int)ret.size())
1309 if ((nFrom + nCount) > (
int)ret.size())
1310 nCount = ret.size() - nFrom;
1311 Array::iterator first = ret.begin();
1312 std::advance(first, nFrom);
1313 Array::iterator last = ret.begin();
1314 std::advance(last, nFrom+nCount);
1316 if (last != ret.end()) ret.erase(last, ret.end());
1317 if (first != ret.begin()) ret.erase(ret.begin(), first);
1319 std::reverse(ret.begin(), ret.end());
1326 if (fHelp || params.size() > 2)
1327 throw runtime_error(
1328 "listaccounts ( minconf includeWatchonly)\n"
1329 "\nReturns Object that has account names as keys, account balances as values.\n"
1331 "1. minconf (numeric, optional, default=1) Only onclude transactions with at least this many confirmations\n"
1332 "2. includeWatchonly (bool, optional, default=false) Include balances in watchonly addresses (see 'importaddress')\n"
1334 "{ (json object where keys are account names, and values are numeric balances\n"
1335 " \"account\": x.xxx, (numeric) The property name is the account name, and the value is the total balance for the account.\n"
1339 "\nList account balances where there at least 1 confirmation\n"
1341 "\nList account balances including zero confirmation transactions\n"
1343 "\nList account balances for 6 or more confirmations\n"
1345 "\nAs json rpc call\n"
1350 if (params.size() > 0)
1351 nMinDepth = params[0].get_int();
1353 if(params.size() > 1)
1354 if(params[1].get_bool())
1357 map<string, int64_t> mapAccountBalances;
1360 mapAccountBalances[entry.second.
name] = 0;
1367 string strSentAccount;
1368 list<pair<CTxDestination, int64_t> > listReceived;
1369 list<pair<CTxDestination, int64_t> > listSent;
1373 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount, includeWatchonly);
1374 mapAccountBalances[strSentAccount] -= nFee;
1376 mapAccountBalances[strSentAccount] -= s.second;
1377 if (nDepth >= nMinDepth)
1383 mapAccountBalances[
""] += r.second;
1387 list<CAccountingEntry> acentries;
1393 BOOST_FOREACH(
const PAIRTYPE(
string, int64_t)& accountBalance, mapAccountBalances) {
1394 ret.push_back(Pair(accountBalance.first,
ValueFromAmount(accountBalance.second)));
1402 throw runtime_error(
1403 "listsinceblock ( \"blockhash\" target-confirmations includeWatchonly)\n"
1404 "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted\n"
1406 "1. \"blockhash\" (string, optional) The block hash to list transactions since\n"
1407 "2. target-confirmations: (numeric, optional) The confirmations required, must be 1 or more\n"
1408 "3. includeWatchonly: (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')"
1411 " \"transactions\": [\n"
1412 " \"account\":\"accountname\", (string) The account name associated with the transaction. Will be \"\" for the default account.\n"
1413 " \"address\":\"anoncoinaddress\", (string) The anoncoin address of the transaction. Not present for move transactions (category = move).\n"
1414 " \"category\":\"send|receive\", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.\n"
1415 " \"amount\": x.xxx, (numeric) The amount in btc. This is negative for the 'send' category, and for the 'move' category for moves \n"
1416 " outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.\n"
1417 " \"fee\": x.xxx, (numeric) The amount of the fee in btc. This is negative and only available for the 'send' category of transactions.\n"
1418 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
1419 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
1420 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
1421 " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1422 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1423 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n"
1424 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT). Available for 'send' and 'receive' category of transactions.\n"
1425 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1426 " \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
1428 " \"lastblock\": \"lastblockhash\" (string) The hash of the last block\n"
1432 +
HelpExampleCli(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6")
1433 +
HelpExampleRpc(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
1437 int target_confirms = 1;
1440 if (params.size() > 0)
1444 blockId.
SetHex(params[0].get_str());
1445 std::map<uint256, CBlockIndex*>::iterator it =
mapBlockIndex.find(blockId);
1447 pindex = it->second;
1450 if (params.size() > 1)
1452 target_confirms = params[1].get_int();
1454 if (target_confirms < 1)
1458 if(params.size() > 2)
1459 if(params[2].get_bool())
1478 ret.push_back(Pair(
"transactions", transactions));
1479 ret.push_back(Pair(
"lastblock", lastblock.
GetHex()));
1486 if (fHelp || params.size() < 1 || params.size() > 2)
1487 throw runtime_error(
1488 "gettransaction \"txid\" ( includeWatchonly )\n"
1489 "\nGet detailed information about in-wallet transaction <txid>\n"
1491 "1. \"txid\" (string, required) The transaction id\n"
1492 "2. \"includeWatchonly\" (bool, optional, default=false) Whether to include watchonly addresses in balance calculation and details[]\n"
1495 " \"amount\" : x.xxx, (numeric) The transaction amount in btc\n"
1496 " \"confirmations\" : n, (numeric) The number of confirmations\n"
1497 " \"blockhash\" : \"hash\", (string) The block hash\n"
1498 " \"blockindex\" : xx, (numeric) The block index\n"
1499 " \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
1500 " \"txid\" : \"transactionid\", (string) The transaction id.\n"
1501 " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n"
1502 " \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n"
1503 " \"details\" : [\n"
1505 " \"account\" : \"accountname\", (string) The account name involved in the transaction, can be \"\" for the default account.\n"
1506 " \"address\" : \"anoncoinaddress\", (string) The anoncoin address involved in the transaction\n"
1507 " \"category\" : \"send|receive\", (string) The category, either 'send' or 'receive'\n"
1508 " \"amount\" : x.xxx (numeric) The amount in btc\n"
1512 " \"hex\" : \"data\" (string) Raw data for transaction\n"
1516 +
HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
1517 +
HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true")
1518 +
HelpExampleRpc(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
1522 hash.
SetHex(params[0].get_str());
1525 if(params.size() > 1)
1526 if(params[1].get_bool())
1534 int64_t nCredit = wtx.
GetCredit(filter);
1535 int64_t nDebit = wtx.
GetDebit(filter);
1536 int64_t nNet = nCredit - nDebit;
1547 entry.push_back(Pair(
"details", details));
1550 ssTx << static_cast<CTransaction>(wtx);
1552 entry.push_back(Pair(
"hex", strHex));
1560 if (fHelp || params.size() != 1)
1561 throw runtime_error(
1562 "backupwallet \"destination\"\n"
1563 "\nSafely copies wallet.dat to destination, which can be a directory or a path with filename.\n"
1565 "1. \"destination\" (string) The destination directory or file\n"
1571 string strDest = params[0].get_str();
1581 if (fHelp || params.size() > 1)
1582 throw runtime_error(
1583 "keypoolrefill ( newsize )\n"
1584 "\nFills the keypool."
1587 "1. newsize (numeric, optional, default=100) The new keypool size\n"
1594 unsigned int kpSize = 0;
1595 if (params.size() > 0) {
1596 if (params[0].get_int() < 0)
1598 kpSize = (
unsigned int)params[0].get_int();
1611 static void LockWallet(
CWallet* pWallet)
1613 LOCK(cs_nWalletUnlockTime);
1621 throw runtime_error(
1622 "walletpassphrase \"passphrase\" timeout\n"
1623 "\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
1624 "This is needed prior to performing transactions related to private keys such as sending anoncoins\n"
1626 "1. \"passphrase\" (string, required) The wallet passphrase\n"
1627 "2. timeout (numeric, required) The time to keep the decryption key in seconds.\n"
1629 "Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
1630 "time that overrides the old one.\n"
1632 "\nunlock the wallet for 60 seconds\n"
1634 "\nLock the wallet again (before 60 seconds)\n"
1636 "\nAs json rpc call\n"
1647 strWalletPass.reserve(100);
1650 strWalletPass = params[0].get_str().c_str();
1652 if (strWalletPass.length() > 0)
1658 throw runtime_error(
1659 "walletpassphrase <passphrase> <timeout>\n"
1660 "Stores the wallet decryption key in memory for <timeout> seconds.");
1664 int64_t nSleepTime = params[1].get_int64();
1665 LOCK(cs_nWalletUnlockTime);
1676 throw runtime_error(
1677 "walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n"
1678 "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n"
1680 "1. \"oldpassphrase\" (string) The current passphrase\n"
1681 "2. \"newpassphrase\" (string) The new passphrase\n"
1683 +
HelpExampleCli(
"walletpassphrasechange",
"\"old one\" \"new one\"")
1684 +
HelpExampleRpc(
"walletpassphrasechange",
"\"old one\", \"new one\"")
1695 strOldWalletPass.reserve(100);
1696 strOldWalletPass = params[0].get_str().c_str();
1699 strNewWalletPass.reserve(100);
1700 strNewWalletPass = params[1].get_str().c_str();
1702 if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1)
1703 throw runtime_error(
1704 "walletpassphrasechange <oldpassphrase> <newpassphrase>\n"
1705 "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.");
1717 throw runtime_error(
1719 "\nRemoves the wallet encryption key from memory, locking the wallet.\n"
1720 "After calling this method, you will need to call walletpassphrase again\n"
1721 "before being able to call any methods which require the wallet to be unlocked.\n"
1723 "\nSet the passphrase for 2 minutes to perform a transaction\n"
1725 "\nPerform a send (requires passphrase set)\n"
1726 +
HelpExampleCli(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 1.0") +
1727 "\nClear the passphrase since we are done before 2 minutes is up\n"
1729 "\nAs json rpc call\n"
1739 LOCK(cs_nWalletUnlockTime);
1751 throw runtime_error(
1752 "encryptwallet \"passphrase\"\n"
1753 "\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
1754 "After this, any calls that interact with private keys such as sending or signing \n"
1755 "will require the passphrase to be set prior the making these calls.\n"
1756 "Use the walletpassphrase call for this, and then walletlock call.\n"
1757 "If the wallet is already encrypted, use the walletpassphrasechange call.\n"
1758 "Note that this will shutdown the server.\n"
1760 "1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
1762 "\nEncrypt you wallet\n"
1764 "\nNow set the passphrase to use the wallet, such as for signing or sending anoncoin\n"
1766 "\nNow we can so something like sign\n"
1767 +
HelpExampleCli(
"signmessage",
"\"anoncoinaddress\" \"test message\"") +
1768 "\nNow lock the wallet again by removing the passphrase\n"
1770 "\nAs a json rpc call\n"
1782 strWalletPass.reserve(100);
1783 strWalletPass = params[0].get_str().c_str();
1785 if (strWalletPass.length() < 1)
1786 throw runtime_error(
1787 "encryptwallet <passphrase>\n"
1788 "Encrypts the wallet with <passphrase>.");
1797 return "wallet encrypted; Anoncoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.";
1802 if (fHelp || params.size() < 1 || params.size() > 2)
1803 throw runtime_error(
1804 "lockunspent unlock [{\"txid\":\"txid\",\"vout\":n},...]\n"
1805 "\nUpdates list of temporarily unspendable outputs.\n"
1806 "Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
1807 "A locked transaction output will not be chosen by automatic coin selection, when spending anoncoins.\n"
1808 "Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
1809 "is always cleared (by virtue of process exit) when a node stops or fails.\n"
1810 "Also see the listunspent call\n"
1812 "1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n"
1813 "2. \"transactions\" (string, required) A json array of objects. Each object the txid (string) vout (numeric)\n"
1814 " [ (json array of json objects)\n"
1816 " \"txid\":\"id\", (string) The transaction id\n"
1817 " \"vout\": n (numeric) The output number\n"
1823 "true|false (boolean) Whether the command was successful or not\n"
1826 "\nList the unspent transactions\n"
1828 "\nLock an unspent transaction\n"
1829 +
HelpExampleCli(
"lockunspent",
"false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1830 "\nList the locked transactions\n"
1832 "\nUnlock the transaction again\n"
1833 +
HelpExampleCli(
"lockunspent",
"true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1834 "\nAs a json rpc call\n"
1835 +
HelpExampleRpc(
"lockunspent",
"false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"")
1838 if (params.size() == 1)
1843 bool fUnlock = params[0].get_bool();
1845 if (params.size() == 1) {
1851 Array outputs = params[1].get_array();
1852 BOOST_FOREACH(Value& output, outputs)
1854 if (output.type() != obj_type)
1856 const Object& o = output.get_obj();
1858 RPCTypeCheck(o, map_list_of(
"txid", str_type)(
"vout", int_type));
1860 string txid = find_value(o,
"txid").get_str();
1864 int nOutput = find_value(o,
"vout").get_int();
1881 if (fHelp || params.size() > 0)
1882 throw runtime_error(
1884 "\nReturns list of temporarily unspendable outputs.\n"
1885 "See the lockunspent call to lock and unlock transactions for spending.\n"
1889 " \"txid\" : \"transactionid\", (string) The transaction id locked\n"
1890 " \"vout\" : n (numeric) The vout value\n"
1895 "\nList the unspent transactions\n"
1897 "\nLock an unspent transaction\n"
1898 +
HelpExampleCli(
"lockunspent",
"false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1899 "\nList the locked transactions\n"
1901 "\nUnlock the transaction again\n"
1902 +
HelpExampleCli(
"lockunspent",
"true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1903 "\nAs a json rpc call\n"
1907 vector<COutPoint> vOutpts;
1912 BOOST_FOREACH(
COutPoint &outpt, vOutpts) {
1915 o.push_back(Pair(
"txid", outpt.
hash.
GetHex()));
1916 o.push_back(Pair(
"vout", (
int)outpt.
n));
1925 if (fHelp || params.size() < 1 || params.size() > 1)
1926 throw runtime_error(
1928 "\nSet the transaction fee per kB.\n"
1930 "1. amount (numeric, required) The transaction fee in ANC/kB rounded to the nearest 0.00000001\n"
1932 "true|false (boolean) Returns true if successful\n"
1939 int64_t nAmount = 0;
1940 if (params[0].get_real() != 0.0)
1949 if (fHelp || params.size() != 0)
1950 throw runtime_error(
1952 "Returns an object containing various wallet state info.\n"
1955 " \"walletversion\": xxxxx, (numeric) the wallet version\n"
1956 " \"balance\": xxxxxxx, (numeric) the total anoncoin balance of the wallet\n"
1957 " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
1958 " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
1959 " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
1960 " \"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"
Value getaccount(const Array ¶ms, bool fHelp)
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
Value sendmany(const Array ¶ms, bool fHelp)
void SetHex(const char *psz)
void GetAmounts(std::list< std::pair< CTxDestination, int64_t > > &listReceived, std::list< std::pair< CTxDestination, int64_t > > &listSent, int64_t &nFee, std::string &strSentAccount, const isminefilter &filter) const
Value keypoolrefill(const Array ¶ms, bool fHelp)
int64_t GetValueOut() const
Value getreceivedbyaddress(const Array ¶ms, bool fHelp)
void RPCRunLater(const std::string &name, boost::function< void(void)> func, int64_t nSeconds)
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
Value settxfee(const Array ¶ms, bool fHelp)
bool WriteAccount(const std::string &strAccount, const CAccount &account)
Value getaddressesbyaccount(const Array ¶ms, bool fHelp)
const_iterator begin() const
bool Set(const CKeyID &id)
void ListLockedCoins(std::vector< COutPoint > &vOutpts)
std::map< CTxDestination, CAddressBookData > mapAddressBook
CCriticalSection cs_wallet
Main wallet lock.
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
std::string strFromAccount
Value getwalletinfo(const Array ¶ms, bool fHelp)
std::map< CTxDestination, int64_t > GetAddressBalances()
std::string HelpExampleRpc(string methodname, string args)
CTxDestination Get() const
Value backupwallet(const Array ¶ms, bool fHelp)
bool GetKeyID(CKeyID &keyID) const
void ListAccountCreditDebit(const std::string &strAccount, std::list< CAccountingEntry > &acentries)
unsigned int GetKeyPoolSize()
bool IsHex(const string &str)
Double ended buffer combining vector and stream-like interfaces.
Object JSONRPCError(int code, const string &message)
Value getreceivedbyaccount(const Array ¶ms, bool fHelp)
bool WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry &acentry)
bool BackupWallet(const CWallet &wallet, const string &strDest)
void RPCTypeCheck(const Array ¶ms, const list< Value_type > &typesExpected, bool fAllowNull)
bool GetKey(const CKeyID &address, CKey &keyOut) const
const string strMessageMagic
CChain chainActive
The currently-connected chain of blocks.
void EnsureWalletIsUnlocked()
Value listlockunspent(const Array ¶ms, bool fHelp)
Value ListReceived(const Array ¶ms, bool fByAccounts)
int64_t IncOrderPosNext(CWalletDB *pwalletdb=NULL)
Increment the next transaction order id.
void SetDestination(const CTxDestination &address)
std::multimap< int64_t, TxPair > TxItems
Value getunconfirmedbalance(const Array ¶ms, bool fHelp)
Value listreceivedbyaddress(const Array ¶ms, bool fHelp)
int64_t GetBalance() const
void AcentryToJSON(const CAccountingEntry &acentry, const string &strAccount, Array &ret)
bool CreateTransaction(const std::vector< std::pair< CScript, int64_t > > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, int64_t &nFeeRet, std::string &strFailReason, const CCoinControl *coinControl=NULL)
int GetBlocksToMaturity() const
string EncodeBase64(const unsigned char *pch, size_t len)
Value lockunspent(const Array ¶ms, bool fHelp)
int Height() const
Return the maximal height in the chain.
int64_t GetAdjustedTime()
Value listreceivedbyaccount(const Array ¶ms, bool fHelp)
void LockCoin(COutPoint &output)
Value ValueFromAmount(int64_t amount)
Value walletlock(const Array ¶ms, bool fHelp)
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
int64_t GetAccountCreditDebit(const std::string &strAccount)
Value getaccountaddress(const Array ¶ms, bool fHelp)
int64_t GetOldestKeyPoolTime()
Value walletpassphrase(const Array ¶ms, bool fHelp)
std::vector< CTxOut > vout
Value sendfrom(const Array ¶ms, bool fHelp)
void UnlockCoin(COutPoint &output)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
An encapsulated public key.
Value walletpassphrasechange(const Array ¶ms, bool fHelp)
base58-encoded Anoncoin addresses.
std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx &wtxNew)
bool TopUpKeyPool(unsigned int kpSize=0)
bool CommitTransaction(CWalletTx &wtxNew, CReserveKey &reservekey)
std::string ToString() const
Value movecmd(const Array ¶ms, bool fHelp)
An output of a transaction.
bool GetReservedKey(CPubKey &pubkey)
std::set< std::set< CTxDestination > > GetAddressGroupings()
int64_t GetAccountBalance(CWalletDB &walletdb, const string &strAccount, int nMinDepth, const isminefilter &filter)
Value getrawchangeaddress(const Array ¶ms, bool fHelp)
Value sendtoaddress(const Array ¶ms, bool fHelp)
bool IsFromMe(const isminefilter &filter) const
An outpoint - a combination of a transaction hash and an index n into its vout.
uint8_t isminefilter
used for bitflags of isminetype
string AccountFromValue(const Value &value)
std::set< CTxDestination > GetAccountAddresses(std::string strAccount) const
std::string GetHex() const
Value addmultisigaddress(const Array ¶ms, bool fHelp)
Access to the wallet database (wallet.dat)
A transaction with a bunch of additional info that only the owner cares about.
int64_t GetTxTime() const
std::string strWalletFile
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
int64_t GetCredit(const isminefilter &filter) const
int64_t GetDebit(const isminefilter &filter) const
CAnoncoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
Value signmessage(const Array ¶ms, bool fHelp)
int64_t GetUnconfirmedBalance() const
CScript _createmultisig_redeemScript(const Array ¶ms)
bool EncryptWallet(const SecureString &strWalletPassphrase)
A key allocated from the key pool.
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
The block chain is a tree shaped structure starting with the genesis block at the root...
Serialized script, used inside transaction inputs and outputs.
Value getnewaddress(const Array ¶ms, bool fHelp)
void ListTransactions(const CWalletTx &wtx, const string &strAccount, int nMinDepth, bool fLong, Array &ret, const isminefilter &filter)
A reference to a CKey: the Hash160 of its serialized public key.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
int64_t nWalletUnlockTime
bool Unlock(const SecureString &strWalletPassphrase)
void WalletTxToJSON(const CWalletTx &wtx, Object &entry)
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
std::set< uint256 > GetConflicts() const
int GetDepthInMainChain(CBlockIndex *&pindexRet) const
std::string HelpRequiringPassphrase()
int64_t AmountFromValue(const Value &value)
Value listaccounts(const Array ¶ms, bool fHelp)
std::map< uint256, CWalletTx > mapWallet
Value gettransaction(const Array ¶ms, bool fHelp)
Value listaddressgroupings(const Array ¶ms, bool fHelp)
A reference to a CScript: the Hash160 of its serialization (see script.h)
bool AddCScript(const CScript &redeemScript)
std::string HelpExampleCli(string methodname, string args)
Value listtransactions(const Array ¶ms, bool fHelp)
bool GetKeyFromPool(CPubKey &key)
void GetAccountAmounts(const std::string &strAccount, int64_t &nReceived, int64_t &nSent, int64_t &nFee, const isminefilter &filter) const
unsigned int nTimeReceived
An encapsulated private key.
Value listsinceblock(const Array ¶ms, bool fHelp)
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
Value setaccount(const Array ¶ms, bool fHelp)
Value getbalance(const Array ¶ms, bool fHelp)
Value encryptwallet(const Array ¶ms, bool fHelp)
std::string strOtherAccount
map< uint256, CBlockIndex * > mapBlockIndex
bool ReadAccount(const std::string &strAccount, CAccount &account)
uint256 GetBlockHash() const
const_iterator end() const
TxItems OrderedTxItems(std::list< CAccountingEntry > &acentries, std::string strAccount="")
Get the wallet's activity log.