6 #include <boost/assign/list_of.hpp>
15 using namespace boost;
25 ?
"\nrequires wallet passphrase to be set with walletpassphrase first"
38 entry.push_back(
Pair(
"confirmations", confirms));
40 entry.push_back(
Pair(
"generated",
true));
44 entry.push_back(
Pair(
"blockindex", wtx.
nIndex));
51 entry.push_back(
Pair(item.first, item.second));
56 string strAccount = value.
get_str();
57 if (strAccount ==
"*")
64 if (fHelp || params.size() != 0)
67 "Returns an object containing various state info.");
73 obj.push_back(
Pair(
"version", (
int)CLIENT_VERSION));
74 obj.push_back(
Pair(
"protocolversion",(
int)PROTOCOL_VERSION));
81 obj.push_back(
Pair(
"connections", (
int)
vNodes.size()));
82 obj.push_back(
Pair(
"proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
101 if (fHelp || params.size() > 1)
103 "getnewaddress [account]\n"
104 "Returns a new Feathercoin address for receiving payments. "
105 "If [account] is specified (recommended), it is added to the address book "
106 "so payments received with the address will be credited to [account].");
110 if (params.size() > 0)
135 bool bKeyUsed =
false;
168 if (fHelp || params.size() != 1)
170 "getaccountaddress <account>\n"
171 "Returns the current Feathercoin address for receiving payments to this account.");
187 if (fHelp || params.size() < 1 || params.size() > 2)
189 "setaccount <feathercoinaddress> <account>\n"
190 "Sets the account associated with the given address.");
198 if (params.size() > 1)
217 if (fHelp || params.size() != 1)
219 "getaccount <feathercoinaddress>\n"
220 "Returns the account associated with the given address.");
229 strAccount = (*mi).second;
236 if (fHelp || params.size() != 1)
238 "getaddressesbyaccount <account>\n"
239 "Returns the list of addresses for the given account.");
248 const string& strName = item.second;
249 if (strName == strAccount)
258 if (fHelp || params.size() < 1 || params.size() > 1)
260 "setmininput <amount>\n"
261 "<amount> is a real and is rounded to the nearest 0.00000001");
265 if (params[0].get_real() != 0.0)
275 if (fHelp || params.size() < 2 || params.size() > 4)
277 "sendtoaddress <feathercoinaddress> <amount> [comment] [comment-to]\n"
278 "<amount> is a real and is rounded to the nearest 0.00000001"
290 if (params.size() > 2 && params[2].type() !=
null_type && !params[2].get_str().empty())
291 wtx.
mapValue[
"comment"] = params[2].get_str();
292 if (params.size() > 3 && params[3].type() !=
null_type && !params[3].get_str().empty())
293 wtx.
mapValue[
"to"] = params[3].get_str();
309 "listaddressgroupings\n"
310 "Lists groups of addresses which have had their common ownership\n"
311 "made public by common use as inputs or as the resulting change\n"
312 "in past transactions");
329 jsonGrouping.push_back(addressInfo);
331 jsonGroupings.push_back(jsonGrouping);
333 return jsonGroupings;
338 if (fHelp || params.size() != 2)
340 "signmessage <feathercoinaddress> <message>\n"
341 "Sign a message with the private key of an address");
345 string strAddress = params[0].get_str();
346 string strMessage = params[1].get_str();
364 vector<unsigned char> vchSig;
373 if (fHelp || params.size() != 3)
375 "verifymessage <feathercoinaddress> <signature> <message>\n"
376 "Verify a signed message");
378 string strAddress = params[0].
get_str();
379 string strSign = params[1].get_str();
380 string strMessage = params[2].get_str();
390 bool fInvalid =
false;
391 vector<unsigned char> vchSig =
DecodeBase64(strSign.c_str(), &fInvalid);
404 return (pubkey.
GetID() == keyID);
410 if (fHelp || params.size() < 1 || params.size() > 2)
412 "getreceivedbyaddress <feathercoinaddress> [minconf=1]\n"
413 "Returns the total amount received by <feathercoinaddress> in transactions with at least [minconf] confirmations.");
426 if (params.size() > 1)
427 nMinDepth = params[1].get_int();
452 const string& strName = item.second;
453 if (strName == strAccount)
454 setAddress.insert(address);
460 if (fHelp || params.size() < 1 || params.size() > 2)
462 "getreceivedbyaccount <account> [minconf=1]\n"
463 "Returns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.");
467 if (params.size() > 1)
468 nMinDepth = params[1].get_int();
472 set<CTxDestination> setAddress;
492 return (
double)nAmount / (double)COIN;
507 int64 nReceived, nSent, nFee;
511 nBalance += nReceived;
512 nBalance -= nSent + nFee;
530 if (fHelp || params.size() > 2)
532 "getbalance [account] [minconf=1]\n"
533 "If [account] is not specified, returns the server's total available balance.\n"
534 "If [account] is specified, returns the balance in the account.");
536 if (params.size() == 0)
540 if (params.size() > 1)
541 nMinDepth = params[1].get_int();
543 if (params[0].
get_str() ==
"*") {
555 string strSentAccount;
556 list<pair<CTxDestination, int64> > listReceived;
557 list<pair<CTxDestination, int64> > listSent;
558 wtx.
GetAmounts(listReceived, listSent, allFee, strSentAccount);
562 nBalance += r.second;
565 nBalance -= r.second;
581 if (fHelp || params.size() < 3 || params.size() > 5)
583 "move <fromaccount> <toaccount> <amount> [minconf=1] [comment]\n"
584 "Move from one account in your wallet to another.");
589 if (params.size() > 3)
591 (
void)params[3].get_int();
593 if (params.size() > 4)
594 strComment = params[4].
get_str();
631 if (fHelp || params.size() < 3 || params.size() > 6)
633 "sendfrom <fromaccount> <tofeathercoinaddress> <amount> [minconf=1] [comment] [comment-to]\n"
634 "<amount> is a real and is rounded to the nearest 0.00000001"
643 if (params.size() > 3)
644 nMinDepth = params[3].get_int();
648 if (params.size() > 4 && params[4].type() !=
null_type && !params[4].get_str().empty())
649 wtx.
mapValue[
"comment"] = params[4].get_str();
650 if (params.size() > 5 && params[5].type() !=
null_type && !params[5].get_str().empty())
651 wtx.
mapValue[
"to"] = params[5].get_str();
657 if (nAmount > nBalance)
671 if (fHelp || params.size() < 2 || params.size() > 4)
673 "sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]\n"
674 "amounts are double-precision floating point numbers"
678 Object sendTo = params[1].get_obj();
680 if (params.size() > 2)
681 nMinDepth = params[2].get_int();
685 if (params.size() > 3 && params[3].type() !=
null_type && !params[3].get_str().empty())
686 wtx.
mapValue[
"comment"] = params[3].get_str();
688 set<CBitcoinAddress> setAddress;
689 vector<pair<CScript, int64> > vecSend;
691 int64 totalAmount = 0;
692 BOOST_FOREACH(
const Pair& s, sendTo)
698 if (setAddress.count(address))
700 setAddress.insert(address);
705 totalAmount += nAmount;
707 vecSend.push_back(make_pair(scriptPubKey, nAmount));
714 if (totalAmount > nBalance)
719 int64 nFeeRequired = 0;
720 string strFailReason;
735 int nRequired = params[0].get_int();
736 const Array& keys = params[1].get_array();
740 throw runtime_error(
"a multisignature address must require at least one key to redeem");
741 if ((
int)keys.size() < nRequired)
744 "(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired));
745 std::vector<CPubKey> pubkeys;
746 pubkeys.resize(keys.size());
747 for (
unsigned int i = 0; i < keys.size(); i++)
749 const std::string& ks = keys[i].get_str();
756 if (!address.GetKeyID(keyID))
758 strprintf(
"%s does not refer to a key",ks.c_str()));
762 strprintf(
"no full public key for address %s",ks.c_str()));
764 throw runtime_error(
" Invalid public key: "+ks);
765 pubkeys[i] = vchPubKey;
773 throw runtime_error(
" Invalid public key: "+ks);
774 pubkeys[i] = vchPubKey;
778 throw runtime_error(
" Invalid public key: "+ks);
788 if (fHelp || params.size() < 2 || params.size() > 3)
790 string msg =
"addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n"
791 "Add a nrequired-to-sign multisignature address to the wallet\"\n"
792 "each key is a Feathercoin address or hex-encoded public key\n"
793 "If [account] is specified, assign address to [account].";
794 throw runtime_error(msg);
798 if (params.size() > 2)
802 CScript inner = _createmultisig(params);
812 if (fHelp || params.size() < 2 || params.size() > 2)
814 string msg =
"createmultisig <nrequired> <'[\"key\",\"key\"]'>\n"
815 "Creates a multi-signature address and returns a json object\n"
817 "address : feathercoin address\n"
818 "redeemScript : hex-encoded redemption script";
819 throw runtime_error(msg);
823 CScript inner = _createmultisig(params);
829 result.push_back(
Pair(
"redeemScript",
HexStr(inner.begin(), inner.end())));
843 nConf = std::numeric_limits<int>::max();
851 if (params.size() > 0)
852 nMinDepth = params[0].get_int();
855 bool fIncludeEmpty =
false;
856 if (params.size() > 1)
857 fIncludeEmpty = params[1].get_bool();
860 map<CBitcoinAddress, tallyitem> mapTally;
869 if (nDepth < nMinDepth)
887 map<string, tallyitem> mapAccountTally;
891 const string& strAccount = item.second;
892 map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address);
893 if (it == mapTally.end() && !fIncludeEmpty)
897 int nConf = std::numeric_limits<int>::max();
898 if (it != mapTally.end())
900 nAmount = (*it).second.nAmount;
901 nConf = (*it).second.nConf;
906 tallyitem& item = mapAccountTally[strAccount];
914 obj.push_back(
Pair(
"account", strAccount));
916 obj.push_back(
Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
918 if (it != mapTally.end())
920 BOOST_FOREACH(
const uint256& item, (*it).second.txids)
922 transactions.push_back(item.
GetHex());
925 obj.push_back(
Pair(
"txids", transactions));
932 for (map<string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it)
934 int64 nAmount = (*it).second.nAmount;
935 int nConf = (*it).second.nConf;
937 obj.push_back(
Pair(
"account", (*it).first));
939 obj.push_back(
Pair(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
949 if (fHelp || params.size() > 2)
951 "listreceivedbyaddress [minconf=1] [includeempty=false]\n"
952 "[minconf] is the minimum number of confirmations before payments are included.\n"
953 "[includeempty] whether to include addresses that haven't received any payments.\n"
954 "Returns an array of objects containing:\n"
955 " \"address\" : receiving address\n"
956 " \"account\" : the account of the receiving address\n"
957 " \"amount\" : total amount received by the address\n"
958 " \"confirmations\" : number of confirmations of the most recent transaction included\n"
959 " \"txids\" : list of transactions with outputs to the address\n");
966 if (fHelp || params.size() > 2)
968 "listreceivedbyaccount [minconf=1] [includeempty=false]\n"
969 "[minconf] is the minimum number of confirmations before payments are included.\n"
970 "[includeempty] whether to include accounts that haven't received any payments.\n"
971 "Returns an array of objects containing:\n"
972 " \"account\" : the account of the receiving addresses\n"
973 " \"amount\" : total amount received by addresses with this account\n"
974 " \"confirmations\" : number of confirmations of the most recent transaction included");
982 string strSentAccount;
983 list<pair<CTxDestination, int64> > listReceived;
984 list<pair<CTxDestination, int64> > listSent;
986 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount);
988 bool fAllAccounts = (strAccount == string(
"*"));
991 if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
996 entry.push_back(
Pair(
"account", strSentAccount));
998 entry.push_back(
Pair(
"category",
"send"));
1003 ret.push_back(entry);
1015 if (fAllAccounts || (account == strAccount))
1018 entry.push_back(
Pair(
"account", account));
1023 entry.push_back(
Pair(
"category",
"orphan"));
1025 entry.push_back(
Pair(
"category",
"immature"));
1027 entry.push_back(
Pair(
"category",
"generate"));
1030 entry.push_back(
Pair(
"category",
"receive"));
1034 ret.push_back(entry);
1042 bool fAllAccounts = (strAccount == string(
"*"));
1044 if (fAllAccounts || acentry.
strAccount == strAccount)
1048 entry.push_back(
Pair(
"category",
"move"));
1053 ret.push_back(entry);
1059 if (fHelp || params.size() > 3)
1060 throw runtime_error(
1061 "listtransactions [account] [count=10] [from=0]\n"
1062 "Returns up to [count] most recent transactions skipping the first [from] transactions for account [account].");
1064 string strAccount =
"*";
1065 if (params.size() > 0)
1066 strAccount = params[0].
get_str();
1068 if (params.size() > 1)
1069 nCount = params[1].get_int();
1071 if (params.size() > 2)
1072 nFrom = params[2].get_int();
1081 std::list<CAccountingEntry> acentries;
1085 for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
1087 CWalletTx *
const pwtx = (*it).second.first;
1094 if ((
int)ret.size() >= (nCount+nFrom))
break;
1098 if (nFrom > (
int)ret.size())
1100 if ((nFrom + nCount) > (
int)ret.size())
1101 nCount = ret.size() - nFrom;
1102 Array::iterator first = ret.begin();
1103 std::advance(first, nFrom);
1104 Array::iterator last = ret.begin();
1105 std::advance(last, nFrom+nCount);
1107 if (last != ret.end()) ret.erase(last, ret.end());
1108 if (first != ret.begin()) ret.erase(ret.begin(), first);
1110 std::reverse(ret.begin(), ret.end());
1117 if (fHelp || params.size() > 1)
1118 throw runtime_error(
1119 "listaccounts [minconf=1]\n"
1120 "Returns Object that has account names as keys, account balances as values.");
1123 if (params.size() > 0)
1124 nMinDepth = params[0].get_int();
1126 map<string, int64> mapAccountBalances;
1129 mapAccountBalances[entry.second] = 0;
1136 string strSentAccount;
1137 list<pair<CTxDestination, int64> > listReceived;
1138 list<pair<CTxDestination, int64> > listSent;
1139 wtx.
GetAmounts(listReceived, listSent, nFee, strSentAccount);
1140 mapAccountBalances[strSentAccount] -= nFee;
1142 mapAccountBalances[strSentAccount] -= s.second;
1149 mapAccountBalances[
""] += r.second;
1153 list<CAccountingEntry> acentries;
1159 BOOST_FOREACH(
const PAIRTYPE(
string,
int64)& accountBalance, mapAccountBalances) {
1168 throw runtime_error(
1169 "listsinceblock [blockhash] [target-confirmations]\n"
1170 "Get all transactions in blocks since block [blockhash], or all transactions if omitted");
1173 int target_confirms = 1;
1175 if (params.size() > 0)
1183 if (params.size() > 1)
1185 target_confirms = params[1].get_int();
1187 if (target_confirms < 1)
1205 if (target_confirms == 1)
1215 block && block->
nHeight > target_height;
1216 block = block->
pprev) { }
1222 ret.push_back(
Pair(
"transactions", transactions));
1223 ret.push_back(
Pair(
"lastblock", lastblock.
GetHex()));
1230 if (fHelp || params.size() != 1)
1231 throw runtime_error(
1232 "gettransaction <txid>\n"
1233 "Get detailed information about in-wallet transaction <txid>");
1245 int64 nNet = nCredit - nDebit;
1256 entry.push_back(
Pair(
"details", details));
1264 if (fHelp || params.size() != 1)
1265 throw runtime_error(
1266 "backupwallet <destination>\n"
1267 "Safely copies wallet.dat to destination, which can be a directory or a path with filename.");
1269 string strDest = params[0].
get_str();
1279 if (fHelp || params.size() > 0)
1280 throw runtime_error(
1282 "Fills the keypool."
1345 delete (
int64*)parg;
1351 throw runtime_error(
1352 "walletpassphrase <passphrase> <timeout>\n"
1353 "Stores the wallet decryption key in memory for <timeout> seconds.");
1364 strWalletPass.reserve(100);
1367 strWalletPass = params[0].get_str().c_str();
1369 if (strWalletPass.length() > 0)
1375 throw runtime_error(
1376 "walletpassphrase <passphrase> <timeout>\n"
1377 "Stores the wallet decryption key in memory for <timeout> seconds.");
1380 int64* pnSleepTime =
new int64(params[1].get_int64());
1390 throw runtime_error(
1391 "walletpassphrasechange <oldpassphrase> <newpassphrase>\n"
1392 "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.");
1401 strOldWalletPass.reserve(100);
1402 strOldWalletPass = params[0].get_str().c_str();
1405 strNewWalletPass.reserve(100);
1406 strNewWalletPass = params[1].get_str().c_str();
1408 if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1)
1409 throw runtime_error(
1410 "walletpassphrasechange <oldpassphrase> <newpassphrase>\n"
1411 "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.");
1423 throw runtime_error(
1425 "Removes the wallet encryption key from memory, locking the wallet.\n"
1426 "After calling this method, you will need to call walletpassphrase again\n"
1427 "before being able to call any methods which require the wallet to be unlocked.");
1434 LOCK(cs_nWalletUnlockTime);
1446 throw runtime_error(
1447 "encryptwallet <passphrase>\n"
1448 "Encrypts the wallet with <passphrase>.");
1457 strWalletPass.reserve(100);
1458 strWalletPass = params[0].get_str().c_str();
1460 if (strWalletPass.length() < 1)
1461 throw runtime_error(
1462 "encryptwallet <passphrase>\n"
1463 "Encrypts the wallet with <passphrase>.");
1472 return "wallet encrypted; Feathercoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.";
1484 obj.push_back(
Pair(
"isscript",
false));
1485 obj.push_back(
Pair(
"pubkey",
HexStr(vchPubKey)));
1492 obj.push_back(
Pair(
"isscript",
true));
1495 std::vector<CTxDestination> addresses;
1503 obj.push_back(
Pair(
"addresses", a));
1505 obj.push_back(
Pair(
"sigsrequired", nRequired));
1512 if (fHelp || params.size() != 1)
1513 throw runtime_error(
1514 "validateaddress <feathercoinaddress>\n"
1515 "Return information about <feathercoinaddress>.");
1518 bool isValid = address.
IsValid();
1521 ret.push_back(
Pair(
"isvalid", isValid));
1525 string currentAddress = address.
ToString();
1526 ret.push_back(
Pair(
"address", currentAddress));
1528 ret.push_back(
Pair(
"ismine", fMine));
1531 ret.insert(ret.end(), detail.begin(), detail.end());
1541 if (fHelp || params.size() < 1 || params.size() > 2)
1542 throw runtime_error(
1543 "lockunspent unlock? [array-of-Objects]\n"
1544 "Updates list of temporarily unspendable outputs.");
1546 if (params.size() == 1)
1551 bool fUnlock = params[0].get_bool();
1553 if (params.size() == 1) {
1559 Array outputs = params[1].get_array();
1560 BOOST_FOREACH(
Value& output, outputs)
1563 throw JSONRPCError(-8,
"Invalid parameter, expected object");
1568 string txid =
find_value(o,
"txid").get_str();
1570 throw JSONRPCError(-8,
"Invalid parameter, expected hex txid");
1572 int nOutput =
find_value(o,
"vout").get_int();
1574 throw JSONRPCError(-8,
"Invalid parameter, vout must be positive");
1589 if (fHelp || params.size() > 0)
1590 throw runtime_error(
1592 "Returns list of temporarily unspendable outputs.");
1594 vector<COutPoint> vOutpts;
1599 BOOST_FOREACH(
COutPoint &outpt, vOutpts) {
1603 o.push_back(
Pair(
"vout", (
int)outpt.
n));
Value verifymessage(const Array ¶ms, bool fHelp)
Value getaccount(const Array ¶ms, bool fHelp)
const Object & get_obj() const
Value sendmany(const Array ¶ms, bool fHelp)
void SetHex(const char *psz)
bool IsFinal(int nBlockHeight=0, int64 nBlockTime=0) const
Value keypoolrefill(const Array ¶ms, bool fHelp)
void GetAccountAmounts(const std::string &strAccount, int64 &nReceived, int64 &nSent, int64 &nFee) const
#define strprintf(format,...)
Value getreceivedbyaddress(const Array ¶ms, bool fHelp)
double GetDifficulty(const CBlockIndex *blockindex=NULL)
CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
int64 GetAccountCreditDebit(const std::string &strAccount)
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)
void ListLockedCoins(std::vector< COutPoint > &vOutpts)
CCriticalSection cs_wallet
std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx &wtxNew, bool fAskFee=false)
Object operator()(const CScriptID &scriptID) const
std::string strFromAccount
Value createmultisig(const Array ¶ms, bool fHelp)
int64 AmountFromValue(const Value &value)
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
int64 GetOldestKeyPoolTime()
Value backupwallet(const Array ¶ms, bool fHelp)
string GetWarnings(string strFor)
void ListAccountCreditDebit(const std::string &strAccount, std::list< CAccountingEntry > &acentries)
const char * GetTxnOutputType(txnouttype t)
bool IsHex(const string &str)
Value getreceivedbyaccount(const Array ¶ms, bool fHelp)
Object JSONRPCError(int code, const string &message)
CTxDestination Get() const
bool GetKey(const CKeyID &address, CKey &keyOut) const
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
void RenameThread(const char *name)
const string strMessageMagic
Config::Object_type Object
void EnsureWalletIsUnlocked()
Value listlockunspent(const Array ¶ms, bool fHelp)
int64 GetCredit(bool fUseCache=true) const
Value ListReceived(const Array ¶ms, bool fByAccounts)
bool SetAddressBookName(const CTxDestination &address, const std::string &strName)
bool GetKeyID(CKeyID &keyID) const
bool NewThread(void(*pfn)(void *), void *parg)
Value validateaddress(const Array ¶ms, bool fHelp)
void SetDestination(const CTxDestination &address)
Value listreceivedbyaddress(const Array ¶ms, bool fHelp)
void AcentryToJSON(const CAccountingEntry &acentry, const string &strAccount, Array &ret)
int GetBlocksToMaturity() const
string EncodeBase64(const unsigned char *pch, size_t len)
Value lockunspent(const Array ¶ms, bool fHelp)
void RPCTypeCheck(const Array ¶ms, const list< Value_type > &typesExpected, bool fAllowNull)
Value listreceivedbyaccount(const Array ¶ms, bool fHelp)
void LockCoin(COutPoint &output)
Value walletlock(const Array ¶ms, bool fHelp)
bool WriteAccountingEntry(const uint64 nAccEntryNum, const CAccountingEntry &acentry)
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
#define LEAVE_CRITICAL_SECTION(cs)
Value getaccountaddress(const Array ¶ms, bool fHelp)
void GetAccountAddresses(string strAccount, set< CTxDestination > &setAddress)
Value walletpassphrase(const Array ¶ms, bool fHelp)
std::vector< CTxOut > vout
Value sendfrom(const Array ¶ms, bool fHelp)
const Object_type::value_type::Value_type & find_value(const Object_type &obj, const String_type &name)
Object operator()(const CKeyID &keyID) const
bool RecoverCompact(const uint256 &hash, const std::vector< unsigned char > &vchSig)
CBlockIndex * GetBlockIndex()
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)
bool CommitTransaction(CWalletTx &wtxNew, CReserveKey &reservekey)
std::string ToString() const
Value movecmd(const Array ¶ms, bool fHelp)
Value getinfo(const Array ¶ms, bool fHelp)
const String_type & get_str() const
An output of a transaction.
std::set< std::set< CTxDestination > > GetAddressGroupings()
int64 GetValueOut() const
Amount of bitcoins spent by this transaction.
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)
Object operator()(const CNoDestination &dest) 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.
std::string strWalletFile
void ThreadCleanWalletPassphrase(void *parg)
void ThreadTopUpKeyPool(void *parg)
bool IsCompressed() const
#define ENTER_CRITICAL_SECTION(cs)
Value signmessage(const Array ¶ms, bool fHelp)
Value ValueFromAmount(int64 amount)
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, vector< CTxDestination > &addressRet, int &nRequiredRet)
bool EncryptWallet(const SecureString &strWalletPassphrase)
A key allocated from the key pool.
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
void GetAmounts(std::list< std::pair< CTxDestination, int64 > > &listReceived, std::list< std::pair< CTxDestination, int64 > > &listSent, int64 &nFee, std::string &strSentAccount) 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)
Value setmininput(const Array ¶ms, bool fHelp)
void SetMultisig(int nRequired, const std::vector< CPubKey > &keys)
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)
bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true)
bool Unlock(const SecureString &strWalletPassphrase)
bool IsFullyValid() const
void WalletTxToJSON(const CWalletTx &wtx, Object &entry)
int GetDepthInMainChain(CBlockIndex *&pindexRet) const
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const
std::string HelpRequiringPassphrase()
std::pair< CService, int > proxyType
bool BackupWallet(const CWallet &wallet, const std::string &strDest)
std::map< CTxDestination, std::string > mapAddressBook
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)
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
Value listtransactions(const Array ¶ms, bool fHelp)
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
std::map< CTxDestination, int64 > GetAddressBalances()
unsigned int nTimeReceived
An encapsulated private key.
vector< unsigned char > DecodeBase64(const char *p, bool *pfInvalid)
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)
std::string get_str(std::string::const_iterator begin, std::string::const_iterator end)
Value encryptwallet(const Array ¶ms, bool fHelp)
std::string strOtherAccount
map< uint256, CBlockIndex * > mapBlockIndex
vector< unsigned char > ParseHex(const char *psz)
std::multimap< int64, TxPair > TxItems
bool ReadAccount(const std::string &strAccount, CAccount &account)
int64 IncOrderPosNext(CWalletDB *pwalletdb=NULL)
Increment the next transaction order id.
bool CreateTransaction(const std::vector< std::pair< CScript, int64 > > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, int64 &nFeeRet, std::string &strFailReason, const CCoinControl *coinControl=NULL)
uint256 GetBlockHash() const
TxItems OrderedTxItems(std::list< CAccountingEntry > &acentries, std::string strAccount="")
Get the wallet's activity log.
int64 GetAccountBalance(CWalletDB &walletdb, const string &strAccount, int nMinDepth)