Bitcoin Core  22.99.0
P2P Digital Currency
Classes | Functions
rpcwallet.cpp File Reference
#include <consensus/amount.h>
#include <core_io.h>
#include <interfaces/chain.h>
#include <key_io.h>
#include <node/context.h>
#include <outputtype.h>
#include <policy/feerate.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <rpc/rawtransaction_util.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <script/sign.h>
#include <util/bip32.h>
#include <util/fees.h>
#include <util/moneystr.h>
#include <util/string.h>
#include <util/system.h>
#include <util/translation.h>
#include <util/url.h>
#include <util/vector.h>
#include <wallet/coincontrol.h>
#include <wallet/context.h>
#include <wallet/feebumper.h>
#include <wallet/load.h>
#include <wallet/receive.h>
#include <wallet/rpcwallet.h>
#include <wallet/spend.h>
#include <wallet/wallet.h>
#include <wallet/walletdb.h>
#include <wallet/walletutil.h>
#include <optional>
#include <stdint.h>
#include <univalue.h>
#include <map>
Include dependency graph for rpcwallet.cpp:

Go to the source code of this file.

Classes

struct  tallyitem
 
class  DescribeWalletAddressVisitor
 

Functions

bool HaveKey (const SigningProvider &wallet, const CKey &key)
 Checks if a CKey is in the given CWallet compressed or otherwise. More...
 
static void WalletTxToJSON (const CWallet &wallet, const CWalletTx &wtx, UniValue &entry)
 
static void SetFeeEstimateMode (const CWallet &wallet, CCoinControl &cc, const UniValue &conf_target, const UniValue &estimate_mode, const UniValue &fee_rate, bool override_min_fee)
 Update coin control with fee estimation based on the given parameters. More...
 
static RPCHelpMan getnewaddress ()
 
static RPCHelpMan getrawchangeaddress ()
 
static RPCHelpMan setlabel ()
 
void ParseRecipients (const UniValue &address_amounts, const UniValue &subtract_fee_outputs, std::vector< CRecipient > &recipients)
 
UniValue SendMoney (CWallet &wallet, const CCoinControl &coin_control, std::vector< CRecipient > &recipients, mapValue_t map_value, bool verbose)
 
static RPCHelpMan sendtoaddress ()
 
static RPCHelpMan listaddressgroupings ()
 
static CAmount GetReceived (const CWallet &wallet, const UniValue &params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
 
static RPCHelpMan getreceivedbyaddress ()
 
static RPCHelpMan getreceivedbylabel ()
 
static RPCHelpMan getbalance ()
 
static RPCHelpMan getunconfirmedbalance ()
 
static RPCHelpMan sendmany ()
 
static RPCHelpMan addmultisigaddress ()
 
static UniValue ListReceived (const CWallet &wallet, const UniValue &params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
 
static RPCHelpMan listreceivedbyaddress ()
 
static RPCHelpMan listreceivedbylabel ()
 
static void MaybePushAddress (UniValue &entry, const CTxDestination &dest)
 
static void ListTransactions (const CWallet &wallet, const CWalletTx &wtx, int nMinDepth, bool fLong, UniValue &ret, const isminefilter &filter_ismine, const std::string *filter_label) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
 List transactions based on the given criteria. More...
 
static const std::vector< RPCResultTransactionDescriptionString ()
 
static RPCHelpMan listtransactions ()
 
static RPCHelpMan listsinceblock ()
 
static RPCHelpMan gettransaction ()
 
static RPCHelpMan abandontransaction ()
 
static RPCHelpMan keypoolrefill ()
 
static RPCHelpMan newkeypool ()
 
static RPCHelpMan lockunspent ()
 
static RPCHelpMan listlockunspent ()
 
static RPCHelpMan settxfee ()
 
static RPCHelpMan getbalances ()
 
static RPCHelpMan getwalletinfo ()
 
static RPCHelpMan listwalletdir ()
 
static RPCHelpMan listwallets ()
 
static RPCHelpMan loadwallet ()
 
static RPCHelpMan setwalletflag ()
 
static RPCHelpMan createwallet ()
 
static RPCHelpMan unloadwallet ()
 
static RPCHelpMan listunspent ()
 
static std::vector< RPCArgFundTxDoc ()
 
void FundTransaction (CWallet &wallet, CMutableTransaction &tx, CAmount &fee_out, int &change_position, const UniValue &options, CCoinControl &coinControl, bool override_min_fee)
 
static RPCHelpMan fundrawtransaction ()
 
RPCHelpMan signrawtransactionwithwallet ()
 
static RPCHelpMan bumpfee_helper (std::string method_name)
 
static RPCHelpMan bumpfee ()
 
static RPCHelpMan psbtbumpfee ()
 
static RPCHelpMan rescanblockchain ()
 
static UniValue DescribeWalletAddress (const CWallet &wallet, const CTxDestination &dest)
 
static UniValue AddressBookDataToJSON (const CAddressBookData &data, const bool verbose)
 Convert CAddressBookData to JSON record. More...
 
RPCHelpMan getaddressinfo ()
 
static RPCHelpMan getaddressesbylabel ()
 
static RPCHelpMan listlabels ()
 
static RPCHelpMan send ()
 
static RPCHelpMan sethdseed ()
 
static RPCHelpMan walletprocesspsbt ()
 
static RPCHelpMan walletcreatefundedpsbt ()
 
static RPCHelpMan upgradewallet ()
 
static RPCHelpMan walletdisplayaddress ()
 
RPCHelpMan abortrescan ()
 
RPCHelpMan dumpprivkey ()
 
RPCHelpMan importprivkey ()
 
RPCHelpMan importaddress ()
 
RPCHelpMan importpubkey ()
 
RPCHelpMan dumpwallet ()
 
RPCHelpMan importwallet ()
 
RPCHelpMan importprunedfunds ()
 
RPCHelpMan removeprunedfunds ()
 
RPCHelpMan importmulti ()
 
RPCHelpMan importdescriptors ()
 
RPCHelpMan listdescriptors ()
 
RPCHelpMan signmessage ()
 
RPCHelpMan backupwallet ()
 
RPCHelpMan restorewallet ()
 
RPCHelpMan walletpassphrase ()
 
RPCHelpMan walletpassphrasechange ()
 
RPCHelpMan walletlock ()
 
RPCHelpMan encryptwallet ()
 
Span< const CRPCCommandGetWalletRPCCommands ()
 

Function Documentation

◆ abandontransaction()

static RPCHelpMan abandontransaction ( )
static

Definition at line 1618 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ abortrescan()

RPCHelpMan abortrescan ( )

Definition at line 196 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addmultisigaddress()

static RPCHelpMan addmultisigaddress ( )
static

Definition at line 800 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddressBookDataToJSON()

static UniValue AddressBookDataToJSON ( const CAddressBookData data,
const bool  verbose 
)
static

Convert CAddressBookData to JSON record.


Definition at line 3473 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ backupwallet()

RPCHelpMan backupwallet ( )

Definition at line 1845 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bumpfee()

static RPCHelpMan bumpfee ( )
static

Definition at line 3280 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bumpfee_helper()

static RPCHelpMan bumpfee_helper ( std::string  method_name)
static

Definition at line 3106 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createwallet()

static RPCHelpMan createwallet ( )
static

Definition at line 2298 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DescribeWalletAddress()

static UniValue DescribeWalletAddress ( const CWallet wallet,
const CTxDestination dest 
)
static

Definition at line 3460 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpprivkey()

RPCHelpMan dumpprivkey ( )

Definition at line 664 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpwallet()

RPCHelpMan dumpwallet ( )

Definition at line 710 of file backup.cpp.

Here is the caller graph for this function:

◆ encryptwallet()

RPCHelpMan encryptwallet ( )

Definition at line 192 of file encrypt.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fundrawtransaction()

static RPCHelpMan fundrawtransaction ( )
static

Definition at line 2907 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FundTransaction()

void FundTransaction ( CWallet wallet,
CMutableTransaction tx,
CAmount fee_out,
int &  change_position,
const UniValue options,
CCoinControl coinControl,
bool  override_min_fee 
)

Definition at line 2708 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FundTxDoc()

static std::vector<RPCArg> FundTxDoc ( )
static

Definition at line 2681 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getaddressesbylabel()

static RPCHelpMan getaddressesbylabel ( )
static

Definition at line 3627 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getaddressinfo()

RPCHelpMan getaddressinfo ( )

Definition at line 3483 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getbalance()

static RPCHelpMan getbalance ( )
static

Definition at line 627 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getbalances()

static RPCHelpMan getbalances ( )
static

Definition at line 1964 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getnewaddress()

static RPCHelpMan getnewaddress ( )
static

Definition at line 139 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getrawchangeaddress()

static RPCHelpMan getrawchangeaddress ( )
static

Definition at line 194 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetReceived()

static CAmount GetReceived ( const CWallet wallet,
const UniValue params,
bool  by_label 
)
static

Definition at line 505 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getreceivedbyaddress()

static RPCHelpMan getreceivedbyaddress ( )
static

Definition at line 551 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getreceivedbylabel()

static RPCHelpMan getreceivedbylabel ( )
static

Definition at line 589 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gettransaction()

static RPCHelpMan gettransaction ( )
static

Definition at line 1507 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getunconfirmedbalance()

static RPCHelpMan getunconfirmedbalance ( )
static

Definition at line 682 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getwalletinfo()

static RPCHelpMan getwalletinfo ( )
static

Definition at line 2031 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWalletRPCCommands()

Span<const CRPCCommand> GetWalletRPCCommands ( )

Definition at line 4347 of file rpcwallet.cpp.

◆ HaveKey()

bool HaveKey ( const SigningProvider wallet,
const CKey key 
)

Checks if a CKey is in the given CWallet compressed or otherwise.

Definition at line 52 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importaddress()

RPCHelpMan importaddress ( )

Definition at line 223 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importdescriptors()

RPCHelpMan importdescriptors ( )

Definition at line 1602 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importmulti()

RPCHelpMan importmulti ( )

Definition at line 1270 of file backup.cpp.

Here is the caller graph for this function:

◆ importprivkey()

RPCHelpMan importprivkey ( )

Definition at line 94 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importprunedfunds()

RPCHelpMan importprunedfunds ( )

Definition at line 327 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importpubkey()

RPCHelpMan importpubkey ( )

Definition at line 421 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importwallet()

RPCHelpMan importwallet ( )

Definition at line 507 of file backup.cpp.

Here is the caller graph for this function:

◆ keypoolrefill()

static RPCHelpMan keypoolrefill ( )
static

Definition at line 1659 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listaddressgroupings()

static RPCHelpMan listaddressgroupings ( )
static

Definition at line 445 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listdescriptors()

RPCHelpMan listdescriptors ( )

Definition at line 1759 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listlabels()

static RPCHelpMan listlabels ( )
static

Definition at line 3685 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listlockunspent()

static RPCHelpMan listlockunspent ( )
static

Definition at line 1870 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListReceived()

static UniValue ListReceived ( const CWallet wallet,
const UniValue params,
bool  by_label 
)
static

Definition at line 897 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listreceivedbyaddress()

static RPCHelpMan listreceivedbyaddress ( )
static

Definition at line 1044 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listreceivedbylabel()

static RPCHelpMan listreceivedbylabel ( )
static

Definition at line 1093 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listsinceblock()

static RPCHelpMan listsinceblock ( )
static

Definition at line 1368 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listtransactions()

static RPCHelpMan listtransactions ( )
static

Definition at line 1257 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListTransactions()

static void ListTransactions ( const CWallet wallet,
const CWalletTx wtx,
int  nMinDepth,
bool  fLong,
UniValue ret,
const isminefilter filter_ismine,
const std::string *  filter_label 
)
static

List transactions based on the given criteria.

Parameters
walletThe wallet.
wtxThe wallet transaction.
nMinDepthThe minimum confirmation depth.
fLongWhether to include the JSON version of the transaction.
retThe UniValue into which the result is stored.
filter_ismineThe "is mine" filter flags.
filter_labelOptional label string to filter incoming transactions.

Definition at line 1153 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listunspent()

static RPCHelpMan listunspent ( )
static

Definition at line 2444 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listwalletdir()

static RPCHelpMan listwalletdir ( )
static

Definition at line 2126 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listwallets()

static RPCHelpMan listwallets ( )
static

Definition at line 2163 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadwallet()

static RPCHelpMan loadwallet ( )
static

Definition at line 2194 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lockunspent()

static RPCHelpMan lockunspent ( )
static

Definition at line 1730 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MaybePushAddress()

static void MaybePushAddress ( UniValue entry,
const CTxDestination dest 
)
static

Definition at line 1135 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newkeypool()

static RPCHelpMan newkeypool ( )
static

Definition at line 1704 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseRecipients()

void ParseRecipients ( const UniValue address_amounts,
const UniValue subtract_fee_outputs,
std::vector< CRecipient > &  recipients 
)

Definition at line 280 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ psbtbumpfee()

static RPCHelpMan psbtbumpfee ( )
static

Definition at line 3281 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeprunedfunds()

RPCHelpMan removeprunedfunds ( )

Definition at line 383 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rescanblockchain()

static RPCHelpMan rescanblockchain ( )
static

Definition at line 3283 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restorewallet()

RPCHelpMan restorewallet ( )

Definition at line 1879 of file backup.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send()

static RPCHelpMan send ( )
static

Definition at line 3739 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendmany()

static RPCHelpMan sendmany ( )
static

Definition at line 706 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendMoney()

UniValue SendMoney ( CWallet wallet,
const CCoinControl coin_control,
std::vector< CRecipient > &  recipients,
mapValue_t  map_value,
bool  verbose 
)

Definition at line 310 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendtoaddress()

static RPCHelpMan sendtoaddress ( )
static

Definition at line 343 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFeeEstimateMode()

static void SetFeeEstimateMode ( const CWallet wallet,
CCoinControl cc,
const UniValue conf_target,
const UniValue estimate_mode,
const UniValue fee_rate,
bool  override_min_fee 
)
static

Update coin control with fee estimation based on the given parameters.

Parameters
[in]walletWallet reference
[in,out]ccCoin control to be updated
[in]conf_targetUniValue integer; confirmation target in blocks, values between 1 and 1008 are valid per policy/fees.h;
[in]estimate_modeUniValue string; fee estimation mode, valid values are "unset", "economical" or "conservative";
[in]fee_rateUniValue real; fee rate in sat/vB; if present, both conf_target and estimate_mode must either be null, or "unset"
[in]override_min_feebool; whether to set fOverrideFeeRate to true to disable minimum fee rate checks and instead verify only that fee_rate is greater than 0
Exceptions
aJSONRPCError if conf_target, estimate_mode, or fee_rate contain invalid values or are in conflict

Definition at line 115 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sethdseed()

static RPCHelpMan sethdseed ( )
static

Definition at line 3937 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setlabel()

static RPCHelpMan setlabel ( )
static

Definition at line 242 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ settxfee()

static RPCHelpMan settxfee ( )
static

Definition at line 1923 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setwalletflag()

static RPCHelpMan setwalletflag ( )
static

Definition at line 2231 of file rpcwallet.cpp.

Here is the caller graph for this function:

◆ signmessage()

RPCHelpMan signmessage ( )

Definition at line 13 of file signmessage.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signrawtransactionwithwallet()

RPCHelpMan signrawtransactionwithwallet ( )

Definition at line 3009 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransactionDescriptionString()

static const std::vector<RPCResult> TransactionDescriptionString ( )
static

Definition at line 1230 of file rpcwallet.cpp.

Here is the caller graph for this function:

◆ unloadwallet()

static RPCHelpMan unloadwallet ( )
static

Definition at line 2393 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upgradewallet()

static RPCHelpMan upgradewallet ( )
static

Definition at line 4218 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ walletcreatefundedpsbt()

static RPCHelpMan walletcreatefundedpsbt ( )
static

Definition at line 4084 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ walletdisplayaddress()

static RPCHelpMan walletdisplayaddress ( )
static

Definition at line 4283 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ walletlock()

RPCHelpMan walletlock ( )

Definition at line 154 of file encrypt.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ walletpassphrase()

RPCHelpMan walletpassphrase ( )

Definition at line 10 of file encrypt.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ walletpassphrasechange()

RPCHelpMan walletpassphrasechange ( )

Definition at line 106 of file encrypt.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ walletprocesspsbt()

static RPCHelpMan walletprocesspsbt ( )
static

Definition at line 4008 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WalletTxToJSON()

static void WalletTxToJSON ( const CWallet wallet,
const CWalletTx wtx,
UniValue entry 
)
static

Definition at line 59 of file rpcwallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: