6#include <bitcoin-build-config.h>
38 "You need to rescan the blockchain in order to correctly mark used "
39 "destinations in the past. Until this is done, some destinations may "
40 "be considered unused, even if the opposite is the case."},
46 "Returns an object containing various wallet state info.\n",
53 {
RPCResult::Type::NUM,
"walletversion",
"(DEPRECATED) only related to unsupported legacy wallet, returns the latest version 169900 for backwards compatibility"},
56 {
RPCResult::Type::NUM,
"keypoolsize",
"how many new keys are pre-generated (only counts external keys)"},
57 {
RPCResult::Type::NUM,
"keypoolsize_hd_internal",
true,
"how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)"},
58 {
RPCResult::Type::NUM_TIME,
"unlocked_until",
true,
"the " +
UNIX_EPOCH_TIME +
" until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets)"},
59 {
RPCResult::Type::BOOL,
"private_keys_enabled",
"false if privatekeys are disabled for this wallet (enforced watch-only wallet)"},
60 {
RPCResult::Type::BOOL,
"avoid_reuse",
"whether this wallet tracks clean/dirty coins in terms of reuse"},
61 {
RPCResult::Type::OBJ,
"scanning",
"current scanning details, or false if no scan is in progress",
65 }, {.skip_type_check=
true}, },
66 {
RPCResult::Type::BOOL,
"descriptors",
"whether this wallet uses descriptors for output script management"},
67 {
RPCResult::Type::BOOL,
"external_signer",
"whether this wallet is configured to use an external signer such as a hardware wallet"},
68 {
RPCResult::Type::BOOL,
"blank",
"Whether this wallet intentionally does not contain any keys, scripts, or descriptors"},
69 {
RPCResult::Type::NUM_TIME,
"birthtime",
true,
"The start time for blocks scanning. It could be modified by (re)importing any descriptor with an earlier timestamp."},
88 pwallet->BlockUntilSyncedToCurrentChain();
90 LOCK(pwallet->cs_wallet);
94 const int latest_legacy_wallet_minversion{169900};
96 size_t kpExternalSize = pwallet->KeypoolCountExternalKeys();
97 obj.
pushKV(
"walletname", pwallet->GetName());
98 obj.
pushKV(
"walletversion", latest_legacy_wallet_minversion);
99 obj.
pushKV(
"format", pwallet->GetDatabase().Format());
100 obj.
pushKV(
"txcount", pwallet->mapWallet.size());
101 obj.
pushKV(
"keypoolsize", kpExternalSize);
102 obj.
pushKV(
"keypoolsize_hd_internal", pwallet->GetKeyPoolSize() - kpExternalSize);
104 if (pwallet->HasEncryptionKeys()) {
105 obj.
pushKV(
"unlocked_until", pwallet->nRelockTime);
109 if (pwallet->IsScanning()) {
111 scanning.
pushKV(
"duration", Ticks<std::chrono::seconds>(pwallet->ScanningDuration()));
112 scanning.
pushKV(
"progress", pwallet->ScanningProgress());
113 obj.
pushKV(
"scanning", std::move(scanning));
115 obj.
pushKV(
"scanning",
false);
120 if (int64_t birthtime = pwallet->GetBirthTime(); birthtime !=
UNKNOWN_TIME) {
121 obj.
pushKV(
"birthtime", birthtime);
126 uint64_t wallet_flags = pwallet->GetWalletFlags();
127 for (uint64_t i = 0; i < 64; ++i) {
128 uint64_t flag = uint64_t{1} << i;
129 if (flag & wallet_flags) {
148 "Returns a list of wallets in the wallet directory.\n",
158 {
RPCResult::Type::ARR,
"warnings",
true,
"Warning messages, if any, related to loading the wallet.",
175 wallet.pushKV(
"name", path.utf8string());
177 if (db_type ==
"bdb") {
178 warnings.
push_back(
"This wallet is a legacy wallet and will need to be migrated with migratewallet before it can be loaded");
180 wallet.pushKV(
"warnings", warnings);
185 result.
pushKV(
"wallets", std::move(wallets));
194 "Returns a list of currently loaded wallets.\n"
195 "For full information on the wallet, use \"getwalletinfo\"\n",
226 "Loads a wallet from a wallet file or directory."
227 "\nNote that all wallet command-line options used when starting bitcoind will be"
228 "\napplied to the new wallet.\n",
230 {
"filename",
RPCArg::Type::STR,
RPCArg::Optional::NO,
"The path to the directory of the wallet to be loaded, either absolute or relative to the \"wallets\" directory. The \"wallets\" directory is set by the -walletdir option and defaults to the \"wallets\" folder within the data directory."},
237 {
RPCResult::Type::ARR,
"warnings",
true,
"Warning messages, if any, related to loading the wallet.",
244 "\nLoad wallet from the wallet dir:\n"
247 +
"\nLoad wallet using absolute path (Unix):\n"
250 +
"\nLoad wallet using absolute path (Windows):\n"
251 +
HelpExampleCli(
"loadwallet",
"\"DriveLetter:\\path\\to\\walletname\\\"")
252 +
HelpExampleRpc(
"loadwallet",
"\"DriveLetter:\\path\\to\\walletname\\\"")
257 const std::string
name(request.params[0].get_str());
264 std::vector<bilingual_str> warnings;
265 std::optional<bool> load_on_start = request.params[1].isNull() ? std::nullopt : std::optional<bool>(request.params[1].get_bool());
269 if (std::any_of(context.wallets.begin(), context.wallets.end(), [&
name](
const auto&
wallet) { return wallet->GetName() == name; })) {
274 std::shared_ptr<CWallet>
const wallet =
LoadWallet(context,
name, load_on_start, options, status, error, warnings);
292 flags += (
flags ==
"" ?
"" :
", ") + it.first;
296 "Change the state of the given wallet flag for a wallet.\n",
318 std::string flag_str = request.params[0].get_str();
319 bool value = request.params[1].isNull() || request.params[1].get_bool();
333 if (pwallet->IsWalletFlagSet(flag) == value) {
337 res.pushKV(
"flag_name", flag_str);
338 res.pushKV(
"flag_state", value);
341 pwallet->SetWalletFlag(flag);
343 pwallet->UnsetWalletFlag(flag);
359 "Creates and loads a new wallet.\n",
365 {
"avoid_reuse",
RPCArg::Type::BOOL,
RPCArg::Default{
false},
"Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind."},
368 {
"external_signer",
RPCArg::Type::BOOL,
RPCArg::Default{
false},
"Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true."},
373 {
RPCResult::Type::STR,
"name",
"The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path."},
374 {
RPCResult::Type::ARR,
"warnings",
true,
"Warning messages, if any, related to creating and loading the wallet.",
383 +
HelpExampleCliNamed(
"createwallet", {{
"wallet_name",
"descriptors"}, {
"avoid_reuse",
true}, {
"load_on_startup",
true}})
384 +
HelpExampleRpcNamed(
"createwallet", {{
"wallet_name",
"descriptors"}, {
"avoid_reuse",
true}, {
"load_on_startup",
true}})
390 if (!request.params[1].isNull() && request.params[1].get_bool()) {
394 if (!request.params[2].isNull() && request.params[2].get_bool()) {
398 passphrase.reserve(100);
399 std::vector<bilingual_str> warnings;
400 if (!request.params[3].isNull()) {
401 passphrase = std::string_view{request.params[3].get_str()};
402 if (passphrase.empty()) {
404 warnings.emplace_back(
Untranslated(
"Empty string given as passphrase, wallet will not be encrypted."));
408 if (!request.params[4].isNull() && request.params[4].get_bool()) {
412 if (!self.
Arg<
bool>(
"descriptors")) {
413 throw JSONRPCError(
RPC_WALLET_ERROR,
"descriptors argument must be set to \"true\"; it is no longer possible to create a legacy wallet.");
415 if (!request.params[7].isNull() && request.params[7].get_bool()) {
416#ifdef ENABLE_EXTERNAL_SIGNER
430 std::optional<bool> load_on_start = request.params[6].isNull() ? std::nullopt : std::optional<bool>(request.params[6].get_bool());
431 const std::shared_ptr<CWallet>
wallet =
CreateWallet(context, request.params[0].get_str(), load_on_start, options, status, error, warnings);
446 "Unloads the wallet referenced by the request endpoint or the wallet_name argument.\n"
447 "If both are specified, they must be identical.",
449 {
"wallet_name",
RPCArg::Type::STR,
RPCArg::DefaultHint{
"the wallet name from the RPC endpoint"},
"The name of the wallet to unload. If provided both here and in the RPC endpoint, the two must be identical."},
453 {
RPCResult::Type::ARR,
"warnings",
true,
"Warning messages, if any, related to unloading the wallet.",
472 std::vector<bilingual_str> warnings;
482 std::optional<bool> load_on_start{self.
MaybeArg<
bool>(
"load_on_startup")};
501 "simulaterawtransaction",
502 "Calculate the balance change resulting in the signing and broadcasting of the given transaction(s).\n",
533 const auto& txs = request.params[0].get_array();
535 std::map<COutPoint, CAmount> new_utxos;
536 std::set<COutPoint> spent;
538 for (
size_t i = 0; i < txs.size(); ++i) {
540 if (!
DecodeHexTx(mtx, txs[i].get_str(),
true,
true)) {
545 std::map<COutPoint, Coin> coins;
549 wallet.chain().findCoins(coins);
553 for (
const auto& txin : mtx.
vin) {
554 const auto& outpoint = txin.
prevout;
555 if (spent.contains(outpoint)) {
558 if (new_utxos.contains(outpoint)) {
559 changes -= new_utxos.at(outpoint);
560 new_utxos.erase(outpoint);
562 if (coins.at(outpoint).IsSpent()) {
565 changes -=
wallet.GetDebit(txin);
567 spent.insert(outpoint);
575 const auto& hash = mtx.
GetHash();
576 for (
size_t i = 0; i < mtx.
vout.size(); ++i) {
577 const auto& txout = mtx.
vout[i];
578 bool is_mine =
wallet.IsMine(txout);
579 changes += new_utxos[
COutPoint(hash, i)] = is_mine ? txout.nValue : 0;
595 "Migrate the wallet to a descriptor wallet.\n"
596 "A new wallet backup will need to be made.\n"
597 "\nThe migration process will create a backup of the wallet before migrating. This backup\n"
598 "file will be named <wallet name>-<timestamp>.legacy.bak and can be found in the directory\n"
599 "for this wallet. In the event of an incorrect migration, the backup can be restored using restorewallet."
600 "\nEncrypted wallets must have the passphrase provided as an argument to this call.\n"
601 "\nThis RPC may take a long time to complete. Increasing the RPC client timeout is recommended.",
603 {
"wallet_name",
RPCArg::Type::STR,
RPCArg::DefaultHint{
"the wallet name from the RPC endpoint"},
"The name of the wallet to migrate. If provided both here and in the RPC endpoint, the two must be identical."},
611 {
RPCResult::Type::STR,
"watchonly_name",
true,
"The name of the migrated wallet containing the watchonly scripts"},
612 {
RPCResult::Type::STR,
"solvables_name",
true,
"The name of the migrated wallet containing solvable but not watched scripts"},
625 wallet_pass.reserve(100);
626 if (!request.params[1].isNull()) {
627 wallet_pass = std::string_view{request.params[1].get_str()};
639 r.pushKV(
"wallet_name", res->wallet_name);
640 if (res->watchonly_wallet_name.
has_value()) {
641 r.pushKV(
"watchonly_name", res->watchonly_wallet_name.
value());
643 if (res->solvables_wallet_name.
has_value()) {
644 r.pushKV(
"solvables_name", res->solvables_wallet_name.
value());
646 r.pushKV(
"backup_path", res->backup_path.utf8string());
657 "List all BIP 32 HD keys in the wallet and which descriptors use them.\n",
674 {
RPCResult::Type::BOOL,
"active",
"Whether this descriptor is currently used to generate new addresses"},
692 const bool active_only{options.exists(
"active_only") ? options[
"active_only"].get_bool() :
false};
693 const bool priv{options.exists(
"private") ? options[
"private"].get_bool() :
false};
698 std::map<CExtPubKey, std::set<std::tuple<std::string, bool, bool>>> wallet_xpubs;
699 std::map<CExtPubKey, CExtKey> wallet_xprvs;
700 for (
const auto& [xpub, spkms] :
wallet->GetHDPubKeys(active_only ? HDKeyFilter::Active : HDKeyFilter::All)) {
701 for (
auto* desc_spkm : spkms) {
702 LOCK(desc_spkm->cs_desc_man);
703 std::string desc_str;
704 bool ok = desc_spkm->GetDescriptorString(desc_str,
false);
706 wallet_xpubs[xpub].emplace(desc_str,
wallet->IsActiveScriptPubKeyMan(*desc_spkm), desc_spkm->HasPrivKey(xpub.pubkey.GetID()));
707 if (std::optional<CKey> key = priv ? desc_spkm->GetKey(xpub.pubkey.GetID()) : std::nullopt) {
708 wallet_xprvs[xpub] =
CExtKey(xpub, *key);
714 for (
const auto& [xpub, descs] : wallet_xpubs) {
715 bool has_xprv =
false;
717 for (
const auto& [desc, active, has_priv] : descs) {
720 d.
pushKV(
"active", active);
721 has_xprv |= has_priv;
727 xpub_info.
pushKV(
"has_private", has_xprv);
728 if (priv && has_xprv) {
731 xpub_info.
pushKV(
"descriptors", std::move(descriptors));
733 response.
push_back(std::move(xpub_info));
743 return RPCMethod{
"createwalletdescriptor",
744 "Creates the wallet's descriptor for the given address type. "
745 "The address type must be one that the wallet does not already have a descriptor for."
750 {
"internal",
RPCArg::Type::BOOL,
RPCArg::DefaultHint{
"Both external and internal will be generated unless this parameter is specified"},
"Whether to only make one descriptor that is internal (if parameter is true) or external (if parameter is false)"},
751 {
"hdkey",
RPCArg::Type::STR,
RPCArg::DefaultHint{
"The HD key used by all other active descriptors"},
"The HD key that the wallet knows the private key of, listed using 'gethdkeys', to use for this descriptor's key"},
771 std::optional<OutputType> output_type =
ParseOutputType(request.params[0].get_str());
777 UniValue internal_only{options[
"internal"]};
780 std::vector<bool> internals;
781 if (internal_only.isNull()) {
783 internals.push_back(
true);
785 internals.push_back(internal_only.get_bool());
788 LOCK(pwallet->cs_wallet);
792 if (hdkey.isNull()) {
793 HDPubKeyMap active_xpubs = pwallet->GetHDPubKeys(HDKeyFilter::Active);
794 if (active_xpubs.size() != 1) {
797 xpub = active_xpubs.begin()->first;
805 std::optional<CKey> key = pwallet->GetKey(xpub.
pubkey.
GetID());
809 CExtKey active_hdkey(xpub, *key);
811 std::vector<std::reference_wrapper<DescriptorScriptPubKeyMan>> spkms;
813 for (
bool internal : internals) {
816 if (!pwallet->GetScriptPubKeyMan(w_id)) {
817 spkms.emplace_back(pwallet->SetupDescriptorScriptPubKeyMan(batch, active_hdkey, *output_type, internal));
826 for (
const auto& spkm : spkms) {
827 std::string desc_str;
828 bool ok = spkm.get().GetDescriptorString(desc_str,
false);
830 descs.push_back(desc_str);
833 out.pushKV(
"descs", std::move(descs));
843 "Add a BIP 32 HD key to the wallet that can be used with 'createwalletdescriptor'\n",
845 {
"hdkey",
RPCArg::Type::STR,
RPCArg::DefaultHint{
"Automatically generated new key"},
"The BIP 32 extended private key to add. If none is provided, a randomly generated one will be added."},
868 if (request.params[0].isNull()) {
885 std::string desc_str =
"unused(" +
EncodeExtKey(hdkey) +
")";
888 std::vector<std::unique_ptr<Descriptor>> descs =
Parse(desc_str,
keys, error,
false);
891 if (
wallet->GetDescriptorScriptPubKeyMan(w_desc) !=
nullptr) {
895 auto spkm =
wallet->AddWalletDescriptor(w_desc,
keys,
"",
false);
903 std::set<CPubKey> pubkeys;
904 std::set<CExtPubKey> extpubs;
917 return RPCMethod{
"exportwatchonlywallet",
918 "Creates a wallet file at the specified destination containing a watchonly version "
919 "of the current wallet. This watchonly wallet contains the wallet's public descriptors, "
920 "its transactions, and address book data. Descriptors that use hardened derivation will "
921 "only have a limited number of derived keys included in the export due to hardened "
922 "derivation requiring private keys. Descriptors with unhardened derivation do not have "
923 "this limitation. The watchonly wallet can be imported into another node using 'restorewallet'.",
934 HelpExampleCli(
"exportwatchonlywallet",
"\"/path/to/export.dat\"")
935 +
HelpExampleRpc(
"exportwatchonlywallet",
"\"/path/to/export.dat\"")
943 std::string dest = request.params[0].get_str();
945 LOCK(pwallet->cs_wallet);
946 pwallet->TopUpKeyPool();
952 out.pushKV(
"exported_file", *exported);
962 "Derive extended public or private key from HD key in the wallet at a given path.\n"
963 "Derivation uses wallet private key material.\n"
969 {
"hdkey",
RPCArg::Type::STR,
RPCArg::DefaultHint{
"Either the HD key of an unused(KEY) descriptor, or any other active descriptor."},
"The HD key that the wallet knows the private key of, listed using 'gethdkeys', to use for derivation"},
994 std::vector<uint32_t> path =
ParsePathBIP32(request.params[0].get_str());
996 const bool priv{options.exists(
"private") ? options[
"private"].get_bool() :
false};
1009 if (!hdkey.isNull()) {
1017 std::set<CExtPubKey> xpub_candidates;
1018 for (
const auto& candidate :
wallet->GetHDPubKeys(HDKeyFilter::UnusedKey)) {
1019 xpub_candidates.insert(candidate.first);
1021 for (
const auto& candidate :
wallet->GetHDPubKeys(HDKeyFilter::Active)) {
1022 xpub_candidates.insert(candidate.first);
1024 if (!xpub_candidates.contains(xpub)) {
1031 if (hdkey.isNull()) {
1034 if (wallet_xpubs.size() > 1) {
1036 }
else if (wallet_xpubs.size() == 1) {
1037 xpub = wallet_xpubs.begin()->first;
1040 if (active_xpubs.empty()) {
1044 if (active_xpubs.size() > 1) {
1048 xpub = active_xpubs.begin()->first;
1052 std::optional<CExtKey> xprv{
wallet->GetExtKey(xpub)};
1057 std::optional<std::pair<CExtKey, KeyOriginInfo>> child{
DeriveExtKey(*xprv, path)};
1064 const std::string fingerprint{
HexStr(child->second.fingerprint)};
1085#ifdef ENABLE_EXTERNAL_SIGNER
1194#ifdef ENABLE_EXTERNAL_SIGNER
int64_t CAmount
Amount in satoshis (Can be negative)
std::string FormatHDKeypath(const std::vector< uint32_t > &path, bool apostrophe)
bool HasHardenedDerivation(std::span< const uint32_t > keypath)
Whether a parsed HD keypath contains at least one hardened derivation step.
#define CHECK_NONFATAL(condition)
Identity function.
An encapsulated private key.
bool IsValid() const
Check whether this private key is valid.
An outpoint - a combination of a transaction hash and an index n into its vout.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
An input of a transaction.
auto MaybeArg(std::string_view key) const
Helper to get an optional request argument.
auto Arg(std::string_view key) const
Helper to get a required or default-valued request argument.
void push_back(UniValue val)
void pushKV(std::string key, UniValue val)
bool has_value() const noexcept
std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal...
const T & value() const LIFETIMEBOUND
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
std::map< CExtPubKey, std::set< DescriptorScriptPubKeyMan * > > HDPubKeyMap
HDKeyFilter
Which descriptors GetHDPubKeys() should consider.
WalletDescriptor GetWalletDescriptor() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man)
RecursiveMutex cs_desc_man
Access to the wallet database.
Descriptor with some wallet metadata.
std::shared_ptr< Descriptor > descriptor
RAII object to check and reserve a wallet rescan.
bool reserve(bool with_passphrase=false)
static UniValue Parse(std::string_view raw, ParamFormat format=ParamFormat::JSON)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
bool DecodeHexTx(CMutableTransaction &tx, const std::string &hex_tx, bool try_no_witness, bool try_witness)
UniValue ValueFromAmount(const CAmount amount)
static path PathFromString(const std::string &string)
Convert byte string to path object.
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
std::optional< std::pair< CExtKey, KeyOriginInfo > > DeriveExtKey(const CExtKey &ext_key, const std::vector< uint32_t > &path)
Get extended key and origin info for a given path.
CKey GenerateRandomKey(bool compressed) noexcept
std::string EncodeExtKey(const CExtKey &key)
CExtPubKey DecodeExtPubKey(const std::string &str)
std::string EncodeExtPubKey(const CExtPubKey &key)
CExtKey DecodeExtKey(const std::string &str)
void ReadDatabaseArgs(const ArgsManager &args, DBOptions &options)
bilingual_str ErrorString(const Result< T > &result)
RPCMethod abandontransaction()
RPCMethod walletpassphrase()
void ReadDatabaseArgs(const ArgsManager &args, DatabaseOptions &options)
std::shared_ptr< CWallet > LoadWallet(WalletContext &context, const std::string &name, std::optional< bool > load_on_start, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
RPCMethod gettransaction()
std::shared_ptr< CWallet > GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
RPCMethod simulaterawtransaction()
RPCMethod fundrawtransaction()
std::vector< std::shared_ptr< CWallet > > GetWallets(WalletContext &context)
CWallet::HDPubKeyMap HDPubKeyMap
RPCMethod listsinceblock()
static RPCMethod unloadwallet()
const RPCResult RESULT_LAST_PROCESSED_BLOCK
RPCMethod walletpassphrasechange()
void HandleWalletError(const std::shared_ptr< CWallet > &wallet, DatabaseStatus &status, bilingual_str &error)
RPCMethod importdescriptors()
util::Result< MigrationResult > MigrateLegacyToDescriptor(std::shared_ptr< CWallet > local_wallet, const SecureString &passphrase, WalletContext &context, bool load_wallet)
Requirement: The wallet provided to this function must be isolated, with no attachment to the node's ...
RPCMethod listlockunspent()
RPCMethod getreceivedbyaddress()
static RPCMethod createwalletdescriptor()
void EnsureWalletIsUnlocked(const CWallet &wallet)
std::string EnsureUniqueWalletName(const JSONRPCRequest &request, std::optional< std::string_view > wallet_name)
Ensures that a wallet name is specified across the endpoint and wallet_name.
RPCMethod rescanblockchain()
RPCMethod walletcreatefundedpsbt()
const std::string HELP_REQUIRING_PASSPHRASE
static RPCMethod setwalletflag()
RPCMethod listtransactions()
RPCMethod getaddressinfo()
bool RemoveWallet(WalletContext &context, const std::shared_ptr< CWallet > &wallet, std::optional< bool > load_on_start)
WalletContext & EnsureWalletContext(const std::any &context)
RPCMethod removeprunedfunds()
RPCMethod encryptwallet()
fs::path GetWalletDir()
Get the path of the wallet directory.
RPCMethod listreceivedbyaddress()
RPCMethod walletdisplayaddress()
RPCMethod listaddressgroupings()
RPCMethod importprunedfunds()
constexpr int64_t UNKNOWN_TIME
Constant representing an unknown spkm creation time.
RPCMethod keypoolrefill()
RPCMethod signrawtransactionwithwallet()
RPCMethod listdescriptors()
void AppendLastProcessedBlock(UniValue &entry, const CWallet &wallet)
RPCMethod walletprocesspsbt()
util::Result< std::string > ExportWatchOnlyWallet(const CWallet &wallet, const fs::path &destination, WalletContext &context)
Make a new watchonly wallet file containing the public descriptors from this wallet The exported watc...
RPCMethod getaddressesbylabel()
static RPCMethod migratewallet()
constexpr uint64_t KNOWN_WALLET_FLAGS
static RPCMethod exportwatchonlywallet()
static RPCMethod loadwallet()
static const std::map< uint64_t, std::string > WALLET_FLAG_CAVEATS
static RPCMethod listwallets()
RPCMethod getreceivedbylabel()
static RPCMethod getwalletinfo()
std::shared_ptr< CWallet > CreateWallet(WalletContext &context, const std::string &name, std::optional< bool > load_on_start, DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
RPCMethod sendtoaddress()
static RPCMethod listwalletdir()
RPCMethod listreceivedbylabel()
RPCMethod getrawchangeaddress()
@ WALLET_FLAG_EXTERNAL_SIGNER
Indicates that the wallet needs an external signer.
@ WALLET_FLAG_AVOID_REUSE
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
@ WALLET_FLAG_DISABLE_PRIVATE_KEYS
@ WALLET_FLAG_BLANK_WALLET
Flag set when a wallet contains no HD seed and no private keys, scripts, addresses,...
void WaitForDeleteWallet(std::shared_ptr< CWallet > &&wallet)
Explicitly delete the wallet.
const std::map< std::string, WalletFlags > STRING_TO_WALLET_FLAG
constexpr uint64_t MUTABLE_WALLET_FLAGS
std::shared_ptr< CWallet > GetWallet(WalletContext &context, const std::string &name)
RPCMethod getnewaddress()
static RPCMethod createwallet()
std::span< const CRPCCommand > GetWalletRPCCommands()
const std::map< WalletFlags, std::string > WALLET_FLAG_TO_STRING
RPCMethod restorewallet()
std::vector< std::pair< fs::path, std::string > > ListDatabases(const fs::path &wallet_dir)
Recursively list database paths in directory.
WalletDescriptor GenerateWalletDescriptor(const CExtPubKey &master_key, const OutputType &addr_type, bool internal)
std::optional< OutputType > ParseOutputType(std::string_view type)
std::string FormatAllOutputTypes()
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_WALLET_ERROR
Wallet errors.
@ RPC_WALLET_ALREADY_LOADED
This same wallet is already loaded.
@ RPC_WALLET_NOT_FOUND
Invalid wallet specified.
@ RPC_DESERIALIZATION_ERROR
Error parsing or validating structure in raw format.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
std::vector< uint32_t > ParsePathBIP32(const std::string &path)
Parse BIP32 path.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
std::string HelpExampleRpcNamed(const std::string &methodname, const RPCArgList &args)
void PushWarnings(const UniValue &warnings, UniValue &obj)
Push warning messages to an RPC "warnings" field as a JSON array of strings.
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
std::string HelpExampleCliNamed(const std::string &methodname, const RPCArgList &args)
uint256 DescriptorID(const Descriptor &desc)
Unique identifier that may not change over time, unless explicitly marked as not backwards compatible...
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
void SetSeed(std::span< const std::byte > seed)
A mutable version of CTransaction.
std::vector< CTxOut > vout
Txid GetHash() const
Compute the hash of this CMutableTransaction.
@ STR_HEX
Special type that is a STR with only hex chars.
@ OBJ_NAMED_PARAMS
Special type that behaves almost exactly like OBJ, defining an options object with a list of pre-defi...
std::string DefaultHint
Hint for default value.
@ OMITTED
Optional argument for which the default value is omitted from help text for one of two reasons:
@ NUM_TIME
Special numeric to denote unix epoch time.
@ STR_AMOUNT
Special string to represent a floating point amount.
SecureString create_passphrase
WalletContext struct containing references to state shared between CWallet instances,...
std::vector< uint16_t > keys
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.