17 #include <boost/assign/list_of.hpp>
18 #include "json/json_spirit_utils.h"
19 #include "json/json_spirit_value.h"
22 using namespace boost;
32 ?
"\nRequires wallet passphrase to be set with walletpassphrase call."
45 entry.push_back(Pair(
"confirmations", confirms));
47 entry.push_back(Pair(
"generated",
true));
51 entry.push_back(Pair(
"blockindex", wtx.
nIndex));
55 entry.push_back(Pair(
"txid", hash.
GetHex()));
58 conflicts.push_back(conflict.
GetHex());
59 entry.push_back(Pair(
"walletconflicts", conflicts));
60 entry.push_back(Pair(
"time", wtx.
GetTxTime()));
61 entry.push_back(Pair(
"timereceived", (int64_t)wtx.
nTimeReceived));
63 entry.push_back(Pair(item.first, item.second));
68 string strAccount = value.get_str();
69 if (strAccount ==
"*")
76 if (fHelp || params.size() > 1)
78 "getnewaddress ( \"account\" )\n"
79 "\nReturns a new Bitcoin address for receiving payments.\n"
80 "If 'account' is specified (recommended), it is added to the address book \n"
81 "so payments received with the address will be credited to 'account'.\n"
83 "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"
85 "\"bitcoinaddress\" (string) The new bitcoin address\n"
95 if (params.size() > 0)
120 bool bKeyUsed =
false;
153 if (fHelp || params.size() != 1)
155 "getaccountaddress \"account\"\n"
156 "\nReturns the current Bitcoin address for receiving payments to this account.\n"
158 "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"
160 "\"bitcoinaddress\" (string) The account bitcoin address\n"
181 if (fHelp || params.size() > 1)
183 "getrawchangeaddress\n"
184 "\nReturns a new Bitcoin address, for receiving change.\n"
185 "This is for use with raw transactions, NOT normal use.\n"
187 "\"address\" (string) The address\n"
211 if (fHelp || params.size() < 1 || params.size() > 2)
213 "setaccount \"bitcoinaddress\" \"account\"\n"
214 "\nSets the account associated with the given address.\n"
216 "1. \"bitcoinaddress\" (string, required) The bitcoin address to be associated with an account.\n"
217 "2. \"account\" (string, required) The account to assign the address to.\n"
219 +
HelpExampleCli(
"setaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"tabby\"")
220 +
HelpExampleRpc(
"setaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"tabby\"")
229 if (params.size() > 1)
248 if (fHelp || params.size() != 1)
250 "getaccount \"bitcoinaddress\"\n"
251 "\nReturns the account associated with the given address.\n"
253 "1. \"bitcoinaddress\" (string, required) The bitcoin address for account lookup.\n"
255 "\"accountname\" (string) the account address\n"
257 +
HelpExampleCli(
"getaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"")
258 +
HelpExampleRpc(
"getaccount",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"")
268 strAccount = (*mi).second.name;
275 if (fHelp || params.size() != 1)
277 "getaddressesbyaccount \"account\"\n"
278 "\nReturns the list of addresses for the given account.\n"
280 "1. \"account\" (string, required) The account name.\n"
282 "[ (json array of string)\n"
283 " \"bitcoinaddress\" (string) a bitcoin address associated with the given account\n"
298 const string& strName = item.second.
name;
299 if (strName == strAccount)
307 if (fHelp || params.size() < 2 || params.size() > 4)
309 "sendtoaddress \"bitcoinaddress\" amount ( \"comment\" \"comment-to\" )\n"
310 "\nSent an amount to a given address. The amount is a real and is rounded to the nearest 0.00000001\n"
313 "1. \"bitcoinaddress\" (string, required) The bitcoin address to send to.\n"
314 "2. \"amount\" (numeric, required) The amount in btc to send. eg 0.1\n"
315 "3. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
316 " This is not part of the transaction, just kept in your wallet.\n"
317 "4. \"comment-to\" (string, optional) A comment to store the name of the person or organization \n"
318 " to which you're sending the transaction. This is not part of the \n"
319 " transaction, just kept in your wallet.\n"
321 "\"transactionid\" (string) The transaction id.\n"
323 +
HelpExampleCli(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1")
324 +
HelpExampleCli(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"donation\" \"seans outpost\"")
325 +
HelpExampleRpc(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.1, \"donation\", \"seans outpost\"")
337 if (params.size() > 2 && params[2].type() != null_type && !params[2].get_str().empty())
338 wtx.
mapValue[
"comment"] = params[2].get_str();
339 if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
340 wtx.
mapValue[
"to"] = params[3].get_str();
355 "listaddressgroupings\n"
356 "\nLists groups of addresses which have had their common ownership\n"
357 "made public by common use as inputs or as the resulting change\n"
358 "in past transactions\n"
363 " \"bitcoinaddress\", (string) The bitcoin address\n"
364 " amount, (numeric) The amount in btc\n"
365 " \"account\" (string, optional) The account\n"
391 jsonGrouping.push_back(addressInfo);
393 jsonGroupings.push_back(jsonGrouping);
395 return jsonGroupings;
400 if (fHelp || params.size() != 2)
402 "signmessage \"bitcoinaddress\" \"message\"\n"
403 "\nSign a message with the private key of an address"
406 "1. \"bitcoinaddress\" (string, required) The bitcoin address to use for the private key.\n"
407 "2. \"message\" (string, required) The message to create a signature of.\n"
409 "\"signature\" (string) The signature of the message encoded in base 64\n"
411 "\nUnlock the wallet for 30 seconds\n"
413 "\nCreate the signature\n"
414 +
HelpExampleCli(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"") +
415 "\nVerify the signature\n"
416 +
HelpExampleCli(
"verifymessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"") +
418 +
HelpExampleRpc(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"my message\"")
423 string strAddress = params[0].get_str();
424 string strMessage = params[1].get_str();
442 vector<unsigned char> vchSig;
451 if (fHelp || params.size() < 1 || params.size() > 2)
453 "getreceivedbyaddress \"bitcoinaddress\" ( minconf )\n"
454 "\nReturns the total amount received by the given bitcoinaddress in transactions with at least minconf confirmations.\n"
456 "1. \"bitcoinaddress\" (string, required) The bitcoin address for transactions.\n"
457 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
459 "amount (numeric) The total amount in btc received at this address.\n"
461 "\nThe amount from transactions with at least 1 confirmation\n"
462 +
HelpExampleCli(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"") +
463 "\nThe amount including unconfirmed transactions, zero confirmations\n"
464 +
HelpExampleCli(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 0") +
465 "\nThe amount with at least 6 confirmation, very safe\n"
466 +
HelpExampleCli(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 6") +
467 "\nAs a json rpc call\n"
468 +
HelpExampleRpc(
"getreceivedbyaddress",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", 6")
482 if (params.size() > 1)
483 nMinDepth = params[1].get_int();
505 if (fHelp || params.size() < 1 || params.size() > 2)
507 "getreceivedbyaccount \"account\" ( minconf )\n"
508 "\nReturns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.\n"
510 "1. \"account\" (string, required) The selected account, may be the default account using \"\".\n"
511 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
513 "amount (numeric) The total amount in btc received for this account.\n"
515 "\nAmount received by the default account with at least 1 confirmation\n"
517 "\nAmount received at the tabby account including unconfirmed amounts with zero confirmations\n"
519 "\nThe amount with at least 6 confirmation, very safe\n"
521 "\nAs a json rpc call\n"
527 if (params.size() > 1)
528 nMinDepth = params[1].get_int();
551 return (
double)nAmount / (double)
COIN;
557 int64_t nBalance = 0;
566 int64_t nReceived, nSent, nFee;
570 nBalance += nReceived;
571 nBalance -= nSent + nFee;
589 if (fHelp || params.size() > 2)
591 "getbalance ( \"account\" minconf )\n"
592 "\nIf account is not specified, returns the server's total available balance.\n"
593 "If account is specified, returns the balance in the account.\n"
594 "Note that the account \"\" is not the same as leaving the parameter out.\n"
595 "The server total may be different to the balance in the default \"\" account.\n"
597 "1. \"account\" (string, optional) The selected account, or \"*\" for entire wallet. It may be the default account using \"\".\n"
598 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
600 "amount (numeric) The total amount in btc received for this account.\n"
602 "\nThe total amount in the server across all accounts\n"
604 "\nThe total amount in the server across all accounts, with at least 5 confirmations\n"
606 "\nThe total amount in the default account with at least 1 confirmation\n"
608 "\nThe total amount in the account named tabby with at least 6 confirmations\n"
610 "\nAs a json rpc call\n"
614 if (params.size() == 0)
618 if (params.size() > 1)
619 nMinDepth = params[1].get_int();
621 if (params[0].get_str() ==
"*") {
625 int64_t nBalance = 0;
633 string strSentAccount;
634 list<pair<CTxDestination, int64_t> > listReceived;
635 list<pair<CTxDestination, int64_t> > listSent;
636 wtx.
GetAmounts(listReceived, listSent, allFee, strSentAccount);
640 nBalance += r.second;
643 nBalance -= r.second;
658 if (fHelp || params.size() > 0)
660 "getunconfirmedbalance\n"
661 "Returns the server's total unconfirmed balance\n");
666 Value
movecmd(
const Array& params,
bool fHelp)
668 if (fHelp || params.size() < 3 || params.size() > 5)
670 "move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" )\n"
671 "\nMove a specified amount from one account in your wallet to another.\n"
673 "1. \"fromaccount\" (string, required) The name of the account to move funds from. May be the default account using \"\".\n"
674 "2. \"toaccount\" (string, required) The name of the account to move funds to. May be the default account using \"\".\n"
675 "3. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
676 "4. \"comment\" (string, optional) An optional comment, stored in the wallet only.\n"
678 "true|false (boolean) true if successfull.\n"
680 "\nMove 0.01 btc from the default account to the account named tabby\n"
682 "\nMove 0.01 btc timotei to akiko with a comment and funds have 6 confirmations\n"
683 +
HelpExampleCli(
"move",
"\"timotei\" \"akiko\" 0.01 6 \"happy birthday!\"") +
684 "\nAs a json rpc call\n"
685 +
HelpExampleRpc(
"move",
"\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"")
691 if (params.size() > 3)
693 (
void)params[3].get_int();
695 if (params.size() > 4)
696 strComment = params[4].get_str();
733 if (fHelp || params.size() < 3 || params.size() > 6)
735 "sendfrom \"fromaccount\" \"tobitcoinaddress\" amount ( minconf \"comment\" \"comment-to\" )\n"
736 "\nSent an amount from an account to a bitcoin address.\n"
737 "The amount is a real and is rounded to the nearest 0.00000001."
740 "1. \"fromaccount\" (string, required) The name of the account to send funds from. May be the default account using \"\".\n"
741 "2. \"tobitcoinaddress\" (string, required) The bitcoin address to send funds to.\n"
742 "3. amount (numeric, required) The amount in btc. (transaction fee is added on top).\n"
743 "4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
744 "5. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
745 " This is not part of the transaction, just kept in your wallet.\n"
746 "6. \"comment-to\" (string, optional) An optional comment to store the name of the person or organization \n"
747 " to which you're sending the transaction. This is not part of the transaction, \n"
748 " it is just kept in your wallet.\n"
750 "\"transactionid\" (string) The transaction id.\n"
752 "\nSend 0.01 btc from the default account to the address, must have at least 1 confirmation\n"
753 +
HelpExampleCli(
"sendfrom",
"\"\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01") +
754 "\nSend 0.01 from the tabby account to the given address, funds must have at least 6 confirmations\n"
755 +
HelpExampleCli(
"sendfrom",
"\"tabby\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01 6 \"donation\" \"seans outpost\"") +
756 "\nAs a json rpc call\n"
757 +
HelpExampleRpc(
"sendfrom",
"\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"")
766 if (params.size() > 3)
767 nMinDepth = params[3].get_int();
771 if (params.size() > 4 && params[4].type() != null_type && !params[4].get_str().empty())
772 wtx.
mapValue[
"comment"] = params[4].get_str();
773 if (params.size() > 5 && params[5].type() != null_type && !params[5].get_str().empty())
774 wtx.
mapValue[
"to"] = params[5].get_str();
780 if (nAmount > nBalance)
794 if (fHelp || params.size() < 2 || params.size() > 4)
796 "sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" )\n"
797 "\nSend multiple times. Amounts are double-precision floating point numbers."
800 "1. \"fromaccount\" (string, required) The account to send the funds from, can be \"\" for the default account\n"
801 "2. \"amounts\" (string, required) A json object with addresses and amounts\n"
803 " \"address\":amount (numeric) The bitcoin address is the key, the numeric amount in btc is the value\n"
806 "3. minconf (numeric, optional, default=1) Only use the balance confirmed at least this many times.\n"
807 "4. \"comment\" (string, optional) A comment\n"
809 "\"transactionid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n"
810 " the number of addresses.\n"
812 "\nSend two amounts to two different addresses:\n"
813 +
HelpExampleCli(
"sendmany",
"\"tabby\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\"") +
814 "\nSend two amounts to two different addresses setting the confirmation and comment:\n"
815 +
HelpExampleCli(
"sendmany",
"\"tabby\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 6 \"testing\"") +
816 "\nAs a json rpc call\n"
817 +
HelpExampleRpc(
"sendmany",
"\"tabby\", \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\", 6, \"testing\"")
821 Object sendTo = params[1].get_obj();
823 if (params.size() > 2)
824 nMinDepth = params[2].get_int();
828 if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
829 wtx.
mapValue[
"comment"] = params[3].get_str();
831 set<CBitcoinAddress> setAddress;
832 vector<pair<CScript, int64_t> > vecSend;
834 int64_t totalAmount = 0;
835 BOOST_FOREACH(
const Pair& s, sendTo)
841 if (setAddress.count(address))
843 setAddress.insert(address);
848 totalAmount += nAmount;
850 vecSend.push_back(make_pair(scriptPubKey, nAmount));
857 if (totalAmount > nBalance)
862 int64_t nFeeRequired = 0;
863 string strFailReason;
878 if (fHelp || params.size() < 2 || params.size() > 3)
880 string msg =
"addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n"
881 "\nAdd a nrequired-to-sign multisignature address to the wallet.\n"
882 "Each key is a Bitcoin address or hex-encoded public key.\n"
883 "If 'account' is specified, assign address to that account.\n"
886 "1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
887 "2. \"keysobject\" (string, required) A json array of bitcoin addresses or hex-encoded public keys\n"
889 " \"address\" (string) bitcoin address or hex-encoded public key\n"
892 "3. \"account\" (string, optional) An account to assign the addresses to.\n"
895 "\"bitcoinaddress\" (string) A bitcoin address associated with the keys.\n"
898 "\nAdd a multisig address from 2 addresses\n"
899 +
HelpExampleCli(
"addmultisigaddress",
"2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"") +
900 "\nAs json rpc call\n"
901 +
HelpExampleRpc(
"addmultisigaddress",
"2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"")
903 throw runtime_error(msg);
907 if (params.size() > 2)
928 nConf = std::numeric_limits<int>::max();
936 if (params.size() > 0)
937 nMinDepth = params[0].get_int();
940 bool fIncludeEmpty =
false;
941 if (params.size() > 1)
942 fIncludeEmpty = params[1].get_bool();
945 map<CBitcoinAddress, tallyitem> mapTally;
954 if (nDepth < nMinDepth)
972 map<string, tallyitem> mapAccountTally;
976 const string& strAccount = item.second.
name;
977 map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address);
978 if (it == mapTally.end() && !fIncludeEmpty)
982 int nConf = std::numeric_limits<int>::max();
983 if (it != mapTally.end())
985 nAmount = (*it).second.nAmount;
986 nConf = (*it).second.nConf;
991 tallyitem& item = mapAccountTally[strAccount];
998 obj.push_back(Pair(
"address", address.
ToString()));
999 obj.push_back(Pair(
"account", strAccount));
1001 obj.push_back(Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
1003 if (it != mapTally.end())
1005 BOOST_FOREACH(
const uint256& item, (*it).second.txids)
1007 transactions.push_back(item.
GetHex());
1010 obj.push_back(Pair(
"txids", transactions));
1017 for (map<string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it)
1019 int64_t nAmount = (*it).second.nAmount;
1020 int nConf = (*it).second.nConf;
1022 obj.push_back(Pair(
"account", (*it).first));
1024 obj.push_back(Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
1034 if (fHelp || params.size() > 2)
1035 throw runtime_error(
1036 "listreceivedbyaddress ( minconf includeempty )\n"
1037 "\nList balances by receiving address.\n"
1039 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
1040 "2. includeempty (numeric, optional, dafault=false) Whether to include addresses that haven't received any payments.\n"
1045 " \"address\" : \"receivingaddress\", (string) The receiving address\n"
1046 " \"account\" : \"accountname\", (string) The account of the receiving address. The default account is \"\".\n"
1047 " \"amount\" : x.xxx, (numeric) The total amount in btc received by the address\n"
1048 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
1064 if (fHelp || params.size() > 2)
1065 throw runtime_error(
1066 "listreceivedbyaccount ( minconf includeempty )\n"
1067 "\nList balances by account.\n"
1069 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
1070 "2. includeempty (boolean, optional, default=false) Whether to include accounts that haven't received any payments.\n"
1075 " \"account\" : \"accountname\", (string) The account name of the receiving account\n"
1076 " \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n"
1077 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
1095 entry.push_back(Pair(
"address", addr.
ToString()));
1101 string strSentAccount;
1102 list<pair<CTxDestination, int64_t> > listReceived;
1103 list<pair<CTxDestination, int64_t> > listSent;
1105 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount);
1107 bool fAllAccounts = (strAccount == string(
"*"));
1110 if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
1115 entry.push_back(Pair(
"account", strSentAccount));
1117 entry.push_back(Pair(
"category",
"send"));
1122 ret.push_back(entry);
1134 if (fAllAccounts || (account == strAccount))
1137 entry.push_back(Pair(
"account", account));
1142 entry.push_back(Pair(
"category",
"orphan"));
1144 entry.push_back(Pair(
"category",
"immature"));
1146 entry.push_back(Pair(
"category",
"generate"));
1150 entry.push_back(Pair(
"category",
"receive"));
1155 ret.push_back(entry);
1163 bool fAllAccounts = (strAccount == string(
"*"));
1165 if (fAllAccounts || acentry.
strAccount == strAccount)
1168 entry.push_back(Pair(
"account", acentry.
strAccount));
1169 entry.push_back(Pair(
"category",
"move"));
1170 entry.push_back(Pair(
"time", acentry.
nTime));
1173 entry.push_back(Pair(
"comment", acentry.
strComment));
1174 ret.push_back(entry);
1180 if (fHelp || params.size() > 3)
1181 throw runtime_error(
1182 "listtransactions ( \"account\" count from )\n"
1183 "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.\n"
1185 "1. \"account\" (string, optional) The account name. If not included, it will list all transactions for all accounts.\n"
1186 " If \"\" is set, it will list transactions for the default account.\n"
1187 "2. count (numeric, optional, default=10) The number of transactions to return\n"
1188 "3. from (numeric, optional, default=0) The number of transactions to skip\n"
1193 " \"account\":\"accountname\", (string) The account name associated with the transaction. \n"
1194 " It will be \"\" for the default account.\n"
1195 " \"address\":\"bitcoinaddress\", (string) The bitcoin address of the transaction. Not present for \n"
1196 " move transactions (category = move).\n"
1197 " \"category\":\"send|receive|move\", (string) The transaction category. 'move' is a local (off blockchain)\n"
1198 " transaction between accounts, and not associated with an address,\n"
1199 " transaction id or block. 'send' and 'receive' transactions are \n"
1200 " associated with an address, transaction id and block details\n"
1201 " \"amount\": x.xxx, (numeric) The amount in btc. This is negative for the 'send' category, and for the\n"
1202 " 'move' category for moves outbound. It is positive for the 'receive' category,\n"
1203 " and for the 'move' category for inbound funds.\n"
1204 " \"fee\": x.xxx, (numeric) The amount of the fee in btc. This is negative and only available for the \n"
1205 " 'send' category of transactions.\n"
1206 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n"
1207 " 'receive' category of transactions.\n"
1208 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
1209 " category of transactions.\n"
1210 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
1211 " category of transactions.\n"
1212 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1213 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1214 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n"
1215 " for 'send' and 'receive' category of transactions.\n"
1216 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1217 " \"otheraccount\": \"accountname\", (string) For the 'move' category of transactions, the account the funds came \n"
1218 " from (for receiving funds, positive amounts), or went to (for sending funds,\n"
1219 " negative amounts).\n"
1224 "\nList the most recent 10 transactions in the systems\n"
1226 "\nList the most recent 10 transactions for the tabby account\n"
1228 "\nList transactions 100 to 120 from the tabby account\n"
1230 "\nAs a json rpc call\n"
1234 string strAccount =
"*";
1235 if (params.size() > 0)
1236 strAccount = params[0].get_str();
1238 if (params.size() > 1)
1239 nCount = params[1].get_int();
1241 if (params.size() > 2)
1242 nFrom = params[2].get_int();
1251 std::list<CAccountingEntry> acentries;
1255 for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
1257 CWalletTx *
const pwtx = (*it).second.first;
1264 if ((
int)ret.size() >= (nCount+nFrom))
break;
1268 if (nFrom > (
int)ret.size())
1270 if ((nFrom + nCount) > (
int)ret.size())
1271 nCount = ret.size() - nFrom;
1272 Array::iterator first = ret.begin();
1273 std::advance(first, nFrom);
1274 Array::iterator last = ret.begin();
1275 std::advance(last, nFrom+nCount);
1277 if (last != ret.end()) ret.erase(last, ret.end());
1278 if (first != ret.begin()) ret.erase(ret.begin(), first);
1280 std::reverse(ret.begin(), ret.end());
1287 if (fHelp || params.size() > 1)
1288 throw runtime_error(
1289 "listaccounts ( minconf )\n"
1290 "\nReturns Object that has account names as keys, account balances as values.\n"
1292 "1. minconf (numeric, optional, default=1) Only onclude transactions with at least this many confirmations\n"
1294 "{ (json object where keys are account names, and values are numeric balances\n"
1295 " \"account\": x.xxx, (numeric) The property name is the account name, and the value is the total balance for the account.\n"
1299 "\nList account balances where there at least 1 confirmation\n"
1301 "\nList account balances including zero confirmation transactions\n"
1303 "\nList account balances for 6 or more confirmations\n"
1305 "\nAs json rpc call\n"
1310 if (params.size() > 0)
1311 nMinDepth = params[0].get_int();
1313 map<string, int64_t> mapAccountBalances;
1316 mapAccountBalances[entry.second.
name] = 0;
1323 string strSentAccount;
1324 list<pair<CTxDestination, int64_t> > listReceived;
1325 list<pair<CTxDestination, int64_t> > listSent;
1329 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount);
1330 mapAccountBalances[strSentAccount] -= nFee;
1332 mapAccountBalances[strSentAccount] -= s.second;
1333 if (nDepth >= nMinDepth)
1339 mapAccountBalances[
""] += r.second;
1343 list<CAccountingEntry> acentries;
1349 BOOST_FOREACH(
const PAIRTYPE(
string, int64_t)& accountBalance, mapAccountBalances) {
1350 ret.push_back(Pair(accountBalance.first,
ValueFromAmount(accountBalance.second)));
1358 throw runtime_error(
1359 "listsinceblock ( \"blockhash\" target-confirmations )\n"
1360 "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted\n"
1362 "1. \"blockhash\" (string, optional) The block hash to list transactions since\n"
1363 "2. target-confirmations: (numeric, optional) The confirmations required, must be 1 or more\n"
1366 " \"transactions\": [\n"
1367 " \"account\":\"accountname\", (string) The account name associated with the transaction. Will be \"\" for the default account.\n"
1368 " \"address\":\"bitcoinaddress\", (string) The bitcoin address of the transaction. Not present for move transactions (category = move).\n"
1369 " \"category\":\"send|receive\", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.\n"
1370 " \"amount\": x.xxx, (numeric) The amount in btc. This is negative for the 'send' category, and for the 'move' category for moves \n"
1371 " outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.\n"
1372 " \"fee\": x.xxx, (numeric) The amount of the fee in btc. This is negative and only available for the 'send' category of transactions.\n"
1373 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
1374 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
1375 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
1376 " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1377 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
1378 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n"
1379 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT). Available for 'send' and 'receive' category of transactions.\n"
1380 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1381 " \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
1383 " \"lastblock\": \"lastblockhash\" (string) The hash of the last block\n"
1387 +
HelpExampleCli(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6")
1388 +
HelpExampleRpc(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
1392 int target_confirms = 1;
1394 if (params.size() > 0)
1398 blockId.
SetHex(params[0].get_str());
1399 std::map<uint256, CBlockIndex*>::iterator it =
mapBlockIndex.find(blockId);
1401 pindex = it->second;
1404 if (params.size() > 1)
1406 target_confirms = params[1].get_int();
1408 if (target_confirms < 1)
1428 ret.push_back(Pair(
"transactions", transactions));
1429 ret.push_back(Pair(
"lastblock", lastblock.
GetHex()));
1436 if (fHelp || params.size() != 1)
1437 throw runtime_error(
1438 "gettransaction \"txid\"\n"
1439 "\nGet detailed information about in-wallet transaction <txid>\n"
1441 "1. \"txid\" (string, required) The transaction id\n"
1444 " \"amount\" : x.xxx, (numeric) The transaction amount in btc\n"
1445 " \"confirmations\" : n, (numeric) The number of confirmations\n"
1446 " \"blockhash\" : \"hash\", (string) The block hash\n"
1447 " \"blockindex\" : xx, (numeric) The block index\n"
1448 " \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
1449 " \"txid\" : \"transactionid\", (string) The transaction id.\n"
1450 " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n"
1451 " \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n"
1452 " \"details\" : [\n"
1454 " \"account\" : \"accountname\", (string) The account name involved in the transaction, can be \"\" for the default account.\n"
1455 " \"address\" : \"bitcoinaddress\", (string) The bitcoin address involved in the transaction\n"
1456 " \"category\" : \"send|receive\", (string) The category, either 'send' or 'receive'\n"
1457 " \"amount\" : x.xxx (numeric) The amount in btc\n"
1461 " \"hex\" : \"data\" (string) Raw data for transaction\n"
1465 +
HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
1466 +
HelpExampleRpc(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
1470 hash.
SetHex(params[0].get_str());
1479 int64_t nNet = nCredit - nDebit;
1490 entry.push_back(Pair(
"details", details));
1493 ssTx << static_cast<CTransaction>(wtx);
1495 entry.push_back(Pair(
"hex", strHex));
1503 if (fHelp || params.size() != 1)
1504 throw runtime_error(
1505 "backupwallet \"destination\"\n"
1506 "\nSafely copies wallet.dat to destination, which can be a directory or a path with filename.\n"
1508 "1. \"destination\" (string) The destination directory or file\n"
1514 string strDest = params[0].get_str();
1524 if (fHelp || params.size() > 1)
1525 throw runtime_error(
1526 "keypoolrefill ( newsize )\n"
1527 "\nFills the keypool."
1530 "1. newsize (numeric, optional, default=100) The new keypool size\n"
1537 unsigned int kpSize = 0;
1538 if (params.size() > 0) {
1539 if (params[0].get_int() < 0)
1541 kpSize = (
unsigned int)params[0].get_int();
1556 LOCK(cs_nWalletUnlockTime);
1564 throw runtime_error(
1565 "walletpassphrase \"passphrase\" timeout\n"
1566 "\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
1567 "This is needed prior to performing transactions related to private keys such as sending bitcoins\n"
1569 "1. \"passphrase\" (string, required) The wallet passphrase\n"
1570 "2. timeout (numeric, required) The time to keep the decryption key in seconds.\n"
1572 "Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
1573 "time that overrides the old one.\n"
1575 "\nunlock the wallet for 60 seconds\n"
1577 "\nLock the wallet again (before 60 seconds)\n"
1579 "\nAs json rpc call\n"
1590 strWalletPass.reserve(100);
1593 strWalletPass = params[0].get_str().c_str();
1595 if (strWalletPass.length() > 0)
1601 throw runtime_error(
1602 "walletpassphrase <passphrase> <timeout>\n"
1603 "Stores the wallet decryption key in memory for <timeout> seconds.");
1607 int64_t nSleepTime = params[1].get_int64();
1608 LOCK(cs_nWalletUnlockTime);
1619 throw runtime_error(
1620 "walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n"
1621 "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n"
1623 "1. \"oldpassphrase\" (string) The current passphrase\n"
1624 "2. \"newpassphrase\" (string) The new passphrase\n"
1626 +
HelpExampleCli(
"walletpassphrasechange",
"\"old one\" \"new one\"")
1627 +
HelpExampleRpc(
"walletpassphrasechange",
"\"old one\", \"new one\"")
1638 strOldWalletPass.reserve(100);
1639 strOldWalletPass = params[0].get_str().c_str();
1642 strNewWalletPass.reserve(100);
1643 strNewWalletPass = params[1].get_str().c_str();
1645 if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1)
1646 throw runtime_error(
1647 "walletpassphrasechange <oldpassphrase> <newpassphrase>\n"
1648 "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.");
1660 throw runtime_error(
1662 "\nRemoves the wallet encryption key from memory, locking the wallet.\n"
1663 "After calling this method, you will need to call walletpassphrase again\n"
1664 "before being able to call any methods which require the wallet to be unlocked.\n"
1666 "\nSet the passphrase for 2 minutes to perform a transaction\n"
1668 "\nPerform a send (requires passphrase set)\n"
1669 +
HelpExampleCli(
"sendtoaddress",
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 1.0") +
1670 "\nClear the passphrase since we are done before 2 minutes is up\n"
1672 "\nAs json rpc call\n"
1682 LOCK(cs_nWalletUnlockTime);
1694 throw runtime_error(
1695 "encryptwallet \"passphrase\"\n"
1696 "\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
1697 "After this, any calls that interact with private keys such as sending or signing \n"
1698 "will require the passphrase to be set prior the making these calls.\n"
1699 "Use the walletpassphrase call for this, and then walletlock call.\n"
1700 "If the wallet is already encrypted, use the walletpassphrasechange call.\n"
1701 "Note that this will shutdown the server.\n"
1703 "1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
1705 "\nEncrypt you wallet\n"
1707 "\nNow set the passphrase to use the wallet, such as for signing or sending bitcoin\n"
1709 "\nNow we can so something like sign\n"
1710 +
HelpExampleCli(
"signmessage",
"\"bitcoinaddress\" \"test message\"") +
1711 "\nNow lock the wallet again by removing the passphrase\n"
1713 "\nAs a json rpc call\n"
1725 strWalletPass.reserve(100);
1726 strWalletPass = params[0].get_str().c_str();
1728 if (strWalletPass.length() < 1)
1729 throw runtime_error(
1730 "encryptwallet <passphrase>\n"
1731 "Encrypts the wallet with <passphrase>.");
1740 return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.";
1745 if (fHelp || params.size() < 1 || params.size() > 2)
1746 throw runtime_error(
1747 "lockunspent unlock [{\"txid\":\"txid\",\"vout\":n},...]\n"
1748 "\nUpdates list of temporarily unspendable outputs.\n"
1749 "Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
1750 "A locked transaction output will not be chosen by automatic coin selection, when spending bitcoins.\n"
1751 "Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
1752 "is always cleared (by virtue of process exit) when a node stops or fails.\n"
1753 "Also see the listunspent call\n"
1755 "1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n"
1756 "2. \"transactions\" (string, required) A json array of objects. Each object the txid (string) vout (numeric)\n"
1757 " [ (json array of json objects)\n"
1759 " \"txid\":\"id\", (string) The transaction id\n"
1760 " \"vout\": n (numeric) The output number\n"
1766 "true|false (boolean) Whether the command was successful or not\n"
1769 "\nList the unspent transactions\n"
1771 "\nLock an unspent transaction\n"
1772 +
HelpExampleCli(
"lockunspent",
"false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1773 "\nList the locked transactions\n"
1775 "\nUnlock the transaction again\n"
1776 +
HelpExampleCli(
"lockunspent",
"true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1777 "\nAs a json rpc call\n"
1778 +
HelpExampleRpc(
"lockunspent",
"false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"")
1781 if (params.size() == 1)
1786 bool fUnlock = params[0].get_bool();
1788 if (params.size() == 1) {
1794 Array outputs = params[1].get_array();
1795 BOOST_FOREACH(Value& output, outputs)
1797 if (output.type() != obj_type)
1799 const Object& o = output.get_obj();
1801 RPCTypeCheck(o, map_list_of(
"txid", str_type)(
"vout", int_type));
1803 string txid = find_value(o,
"txid").get_str();
1807 int nOutput = find_value(o,
"vout").get_int();
1824 if (fHelp || params.size() > 0)
1825 throw runtime_error(
1827 "\nReturns list of temporarily unspendable outputs.\n"
1828 "See the lockunspent call to lock and unlock transactions for spending.\n"
1832 " \"txid\" : \"transactionid\", (string) The transaction id locked\n"
1833 " \"vout\" : n (numeric) The vout value\n"
1838 "\nList the unspent transactions\n"
1840 "\nLock an unspent transaction\n"
1841 +
HelpExampleCli(
"lockunspent",
"false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1842 "\nList the locked transactions\n"
1844 "\nUnlock the transaction again\n"
1845 +
HelpExampleCli(
"lockunspent",
"true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
1846 "\nAs a json rpc call\n"
1850 vector<COutPoint> vOutpts;
1855 BOOST_FOREACH(
COutPoint &outpt, vOutpts) {
1858 o.push_back(Pair(
"txid", outpt.
hash.
GetHex()));
1859 o.push_back(Pair(
"vout", (
int)outpt.
n));
1868 if (fHelp || params.size() < 1 || params.size() > 1)
1869 throw runtime_error(
1871 "\nSet the transaction fee per kB.\n"
1873 "1. amount (numeric, required) The transaction fee in BTC/kB rounded to the nearest 0.00000001\n"
1875 "true|false (boolean) Returns true if successful\n"
1882 int64_t nAmount = 0;
1883 if (params[0].get_real() != 0.0)
1892 if (fHelp || params.size() != 0)
1893 throw runtime_error(
1895 "Returns an object containing various wallet state info.\n"
1898 " \"walletversion\": xxxxx, (numeric) the wallet version\n"
1899 " \"balance\": xxxxxxx, (numeric) the total bitcoin balance of the wallet\n"
1900 " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
1901 " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
1902 " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
1903 " \"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)
static CCriticalSection cs_nWalletUnlockTime
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)
CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
void ListTransactions(const CWalletTx &wtx, const string &strAccount, int nMinDepth, bool fLong, Array &ret)
bool WriteAccount(const std::string &strAccount, const CAccount &account)
Value getaddressesbyaccount(const Array ¶ms, bool fHelp)
const_iterator begin() const
void ListLockedCoins(std::vector< COutPoint > &vOutpts)
std::map< CTxDestination, CAddressBookData > mapAddressBook
CCriticalSection cs_wallet
Main wallet lock.
std::string strFromAccount
Value getwalletinfo(const Array ¶ms, bool fHelp)
std::map< CTxDestination, int64_t > GetAddressBalances()
std::string HelpExampleRpc(string methodname, string args)
Value backupwallet(const Array ¶ms, bool fHelp)
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)
base58-encoded Bitcoin addresses.
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)
CTxDestination Get() const
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.
bool GetKeyID(CKeyID &keyID) const
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)
void GetAccountAmounts(const std::string &strAccount, int64_t &nReceived, int64_t &nSent, int64_t &nFee) const
Value lockunspent(const Array ¶ms, bool fHelp)
int Height() const
Return the maximal height in the chain.
bool Set(const CKeyID &id)
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)
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()
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
Value getrawchangeaddress(const Array ¶ms, bool fHelp)
Value sendtoaddress(const Array ¶ms, bool fHelp)
An outpoint - a combination of a transaction hash and an index n into its vout.
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
static const int64_t COIN
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.
int64_t GetAccountBalance(CWalletDB &walletdb, const string &strAccount, int nMinDepth)
Value getnewaddress(const Array ¶ms, bool fHelp)
static const int PROTOCOL_VERSION
bool IsMine(const CKeyStore &keystore, const CTxDestination &dest)
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)
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
unsigned int nTimeReceived
An encapsulated private key.
Value listsinceblock(const Array ¶ms, bool fHelp)
static void MaybePushAddress(Object &entry, const CTxDestination &dest)
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
static void LockWallet(CWallet *pWallet)
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
int64_t GetCredit(bool fUseCache=true) const
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.