[#wallet-CWallet]
= xref:wallet.adoc[wallet]::CWallet
:relfileprefix: ../
:mrdocs:

A CWallet maintains a set of transactions and balances, and provides the ability to create new transactions&period;

== Synopsis

Declared in `&lt;wallet&sol;wallet&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CWallet final
    : public xref:wallet/WalletStorage.adoc[WalletStorage]
    , public xref:interfaces/Chain.adoc[interfaces::Chain::Notifications]
----

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:wallet/WalletStorage.adoc[WalletStorage]`
| Wallet storage things that ScriptPubKeyMans need in order to be able to store things to the wallet database&period; It provides access to things that are part of the entire wallet and not specific to a ScriptPubKeyMan such as wallet flags, wallet version, encryption keys, encryption status, and the database itself&period; This allows a ScriptPubKeyMan to have callbacks into CWallet without causing a circular dependency&period; WalletStorage should be the same for all ScriptPubKeyMans of a wallet&period;
| `xref:interfaces/Chain.adoc[interfaces::Chain::Notifications]`
| 
|===

== Types

[cols="1,4"]
|===
| Name| Description
| xref:wallet/CWallet/AddrBookFilter.adoc[`AddrBookFilter`] 
| Filter struct for &apos;ListAddrBookAddresses&apos;
| xref:wallet/CWallet/ScanResult.adoc[`ScanResult`] 
| Outcome of scanning a range of blocks for wallet transactions&period;
|===


== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:wallet/CWallet/HDPubKeyMap.adoc[`HDPubKeyMap`] 
| Maps a descriptor xpub to the descriptor managers that use it&period;
| xref:wallet/CWallet/ListAddrBookFunc.adoc[`ListAddrBookFunc`] 
| Walk&hyphen;through the address book entries&period; Stops when the provided &apos;ListAddrBookFunc&apos; returns false&period;
| xref:wallet/CWallet/MasterKeyMap.adoc[`MasterKeyMap`] 
| Maps a master key id to its encrypted master key&period;
| xref:wallet/CWallet/TxItems.adoc[`TxItems`] 
| Maps a transaction&apos;s order position to its wallet transaction&period;
| xref:wallet/CWallet/UpdateWalletTxFn.adoc[`UpdateWalletTxFn`] 
| Callback for updating transaction metadata in mapWallet&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:wallet/CWallet/HDKeyFilter.adoc[`HDKeyFilter`] 
| Which descriptors GetHDPubKeys() should consider&period;
| xref:wallet/CWallet/SpendType.adoc[`SpendType`] 
| Describes how far along the spend of an output is&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/CWallet/2constructor.adoc[`CWallet`]         [.small]#[constructor]#
| Construct wallet with specified name and database implementation&period;
| xref:wallet/CWallet/2destructor.adoc[`&#126;CWallet`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy the wallet&semi; asserts no unload slots remain connected&period;
| xref:wallet/CWallet/AbandonTransaction-06.adoc[`AbandonTransaction`] 
| `AbandonTransaction` overloads
| xref:wallet/CWallet/AbortRescan.adoc[`AbortRescan`] 
| Request that any in&hyphen;progress rescan abort&period;
| xref:wallet/CWallet/AddActiveScriptPubKeyMan.adoc[`AddActiveScriptPubKeyMan`] 
| Adds the active ScriptPubKeyMan for the specified type and internal&period; Writes it to the wallet file
| xref:wallet/CWallet/AddToWallet.adoc[`AddToWallet`] 
| Add the transaction to the wallet, wrapping it up inside a CWalletTx
| xref:wallet/CWallet/AddWalletDescriptor.adoc[`AddWalletDescriptor`] 
| Add a descriptor to the wallet, return a ScriptPubKeyMan &amp; associated output type
| xref:wallet/CWallet/ApplyMigrationData.adoc[`ApplyMigrationData`] 
| Adds the ScriptPubKeyMans from MigrationData to this wallet, removes the LegacyDataSPKM, and moves transaction and address book entries to watchonly&lowbar;wallet or solvable&lowbar;wallet as needed&period;
| xref:wallet/CWallet/BackupWallet.adoc[`BackupWallet`] 
| Copy the wallet database file to a backup path&period;
| xref:wallet/CWallet/BlockUntilSyncedToCurrentChain.adoc[`BlockUntilSyncedToCurrentChain`] 
| Blocks until the wallet state is up&hyphen;to&hyphen;date to &sol;at least&sol; the current chain at the time this function is entered Obviously holding cs&lowbar;main&sol;cs&lowbar;wallet when going into this call may cause deadlock
| xref:wallet/CWallet/CacheNewScriptPubKeys.adoc[`CacheNewScriptPubKeys`] 
| Add scriptPubKeys for this ScriptPubKeyMan into the scriptPubKey cache
| xref:wallet/CWallet/CanGetAddresses.adoc[`CanGetAddresses`] 
| Returns true if the wallet can give out new addresses&period; This means it has keys in the keypool or can generate new keys
| xref:wallet/CWallet/CanGrindR.adoc[`CanGrindR`] 
| Whether the (external) signer performs R&hyphen;value signature grinding
| xref:wallet/CWallet/ChangeWalletPassphrase.adoc[`ChangeWalletPassphrase`] 
| Change the wallet&apos;s encryption passphrase&period;
| xref:wallet/CWallet/Close.adoc[`Close`] 
| Close wallet database
| xref:wallet/CWallet/CommitTransaction.adoc[`CommitTransaction`] 
| Submit the transaction to the node&apos;s mempool and then relay to peers&period; Should be called after CreateTransaction unless you want to abort broadcasting the transaction&period;
| xref:wallet/CWallet/ComputeTimeSmart.adoc[`ComputeTimeSmart`] 
| Estimate a smart timestamp for a transaction from block and receive times&period;
| xref:wallet/CWallet/ConnectScriptPubKeyManNotifiers.adoc[`ConnectScriptPubKeyManNotifiers`] 
| Connect the signals from ScriptPubKeyMans to the signals in CWallet
| xref:wallet/CWallet/DeactivateScriptPubKeyMan.adoc[`DeactivateScriptPubKeyMan`] 
| Remove specified ScriptPubKeyMan from set of active SPK managers&period; Writes the change to the wallet file&period;
| xref:wallet/CWallet/DelAddressBook.adoc[`DelAddressBook`] 
| Remove a destination from the address book&period;
| xref:wallet/CWallet/DelAddressBookWithDB.adoc[`DelAddressBookWithDB`] 
| Remove a destination from the address book within a database batch&period;
| xref:wallet/CWallet/DisconnectChainNotifications.adoc[`DisconnectChainNotifications`] 
| Disconnect chain notifications and wait for all notifications to be processed
| xref:wallet/CWallet/DisplayAddress.adoc[`DisplayAddress`] 
| Display address on an external signer&period;
| xref:wallet/CWallet/DisplayName.adoc[`DisplayName`] 
| Return wallet name for display, like LogName() but translates &quot;default wallet&quot; string&period;
| xref:wallet/CWallet/EncryptWallet.adoc[`EncryptWallet`] 
| Encrypt an unencrypted wallet with the given passphrase&period;
| xref:wallet/CWallet/EraseAddressReceiveRequest.adoc[`EraseAddressReceiveRequest`] 
| Erase a stored receive request for a destination&period;
| xref:wallet/CWallet/FillPSBT.adoc[`FillPSBT`] 
| Fills out a PSBT with information from the wallet&period; Fills in UTXOs if we have them&period; Tries to sign if options&period;sign&equals;true&period; Sets `complete` if the PSBT is now complete (i&period;e&period; has all required signatures or signature&hyphen;parts, and is ready to finalize&period;)
| xref:wallet/CWallet/FindAddressBookEntry.adoc[`FindAddressBookEntry`] 
| Look up an address book entry for a destination&period;
| xref:wallet/CWallet/ForEachAddrBookEntry.adoc[`ForEachAddrBookEntry`] 
| Invoke a callback for each address book entry until it returns false&period;
| xref:wallet/CWallet/GetActiveScriptPubKeyMans.adoc[`GetActiveScriptPubKeyMans`] 
| Returns all unique ScriptPubKeyMans in m&lowbar;internal&lowbar;spk&lowbar;managers and m&lowbar;external&lowbar;spk&lowbar;managers
| xref:wallet/CWallet/GetAddressReceiveRequests.adoc[`GetAddressReceiveRequests`] 
| Return the identifiers of all stored receive requests&period;
| xref:wallet/CWallet/GetAllScriptPubKeyMans.adoc[`GetAllScriptPubKeyMans`] 
| Returns all unique ScriptPubKeyMans
| xref:wallet/CWallet/GetBirthTime.adoc[`GetBirthTime`] 
| Returns the time of the first created key or, in case of an import, it could be the time of the first received transaction
| xref:wallet/CWallet/GetBroadcastTransactions.adoc[`GetBroadcastTransactions`] 
| Inquire whether this wallet broadcasts transactions&period;
| xref:wallet/CWallet/GetConflicts.adoc[`GetConflicts`] 
| Get wallet transactions that conflict with given transaction (spend same outputs)
| xref:wallet/CWallet/GetDatabase.adoc[`GetDatabase`]  [.small]#[virtual]#
| Access the wallet&apos;s database backend&period;
| xref:wallet/CWallet/GetDebit-01.adoc[`GetDebit`] 
| `GetDebit` overloads
| xref:wallet/CWallet/GetDescriptorScriptPubKeyMan.adoc[`GetDescriptorScriptPubKeyMan`] 
| Return the DescriptorScriptPubKeyMan for a WalletDescriptor if it is already in the wallet
| xref:wallet/CWallet/GetDescriptorsForLegacy.adoc[`GetDescriptorsForLegacy`] 
| Get all of the descriptors from a legacy wallet
| xref:wallet/CWallet/GetExtKey.adoc[`GetExtKey`] 
| Reconstruct the extended private key for an HD xpub&period; Returns nullopt when no descriptor has the private key, or the wallet is locked&period;
| xref:wallet/CWallet/GetHDPubKeys.adoc[`GetHDPubKeys`] 
| Retrieve descriptor xpubs matching the requested filter&period;
| xref:wallet/CWallet/GetKey.adoc[`GetKey`] 
| Find the private key for the given key id from the wallet&apos;s descriptors, if available Returns nullopt when no descriptor has the key or if the wallet is locked&period;
| xref:wallet/CWallet/GetKeyPoolSize.adoc[`GetKeyPoolSize`] 
| Count the keys currently available in the keypool&period;
| xref:wallet/CWallet/GetLastBlockHash.adoc[`GetLastBlockHash`] 
| Get the hash of the last block processed by the wallet&period;
| xref:wallet/CWallet/GetLastBlockHeight.adoc[`GetLastBlockHeight`] 
| Get last block processed height
| xref:wallet/CWallet/GetLegacyDataSPKM.adoc[`GetLegacyDataSPKM`] 
| Get the LegacyDataSPKM used for all legacy output types and both internal and external chains&period;
| xref:wallet/CWallet/GetName.adoc[`GetName`] 
| Get a name for this wallet for logging&sol;debugging purposes&period;
| xref:wallet/CWallet/GetNewChangeDestination.adoc[`GetNewChangeDestination`] 
| Generate a new change destination of the given type&period;
| xref:wallet/CWallet/GetNewDestination.adoc[`GetNewDestination`] 
| Generate a new receiving destination of the given type&period;
| xref:wallet/CWallet/GetOrCreateLegacyDataSPKM.adoc[`GetOrCreateLegacyDataSPKM`] 
| Return the legacy data ScriptPubKeyMan, creating it if it does not exist&period;
| xref:wallet/CWallet/GetScriptPubKeyMan-0f.adoc[`GetScriptPubKeyMan`] 
| `GetScriptPubKeyMan` overloads
| xref:wallet/CWallet/GetScriptPubKeyMans.adoc[`GetScriptPubKeyMans`] 
| Get all the ScriptPubKeyMans for a script
| xref:wallet/CWallet/GetSolvingProvider-054.adoc[`GetSolvingProvider`] 
| `GetSolvingProvider` overloads
| xref:wallet/CWallet/GetTXO.adoc[`GetTXO`] 
| Look up a single wallet output by outpoint&period;
| xref:wallet/CWallet/GetTXOs.adoc[`GetTXOs`] 
| Access the cache of transaction outputs owned by this wallet&period;
| xref:wallet/CWallet/GetTxBlocksToMaturity.adoc[`GetTxBlocksToMaturity`] 
| Return the number of blocks until a coinbase transaction matures&period;
| xref:wallet/CWallet/GetTxConflicts.adoc[`GetTxConflicts`] 
| Find wallet transactions that conflict with the given transaction&period;
| xref:wallet/CWallet/GetTxDepthInMainChain.adoc[`GetTxDepthInMainChain`] 
| Return depth of transaction in blockchain&colon; &lt;0 &colon; conflicts with a transaction this deep in the blockchain 0 &colon; in memory pool, waiting to be included in a block &gt;&equals;1 &colon; this many blocks deep in the main chain
| xref:wallet/CWallet/GetWalletDescriptors.adoc[`GetWalletDescriptors`] 
| Get the wallet descriptors for a script&period;
| xref:wallet/CWallet/GetWalletFlags.adoc[`GetWalletFlags`] 
| Retrieve all of the wallet&apos;s flags
| xref:wallet/CWallet/GetWalletTx.adoc[`GetWalletTx`] 
| Look up a wallet transaction by its txid&period;
| xref:wallet/CWallet/HasEncryptionKeys.adoc[`HasEncryptionKeys`]  [.small]#[virtual]#
| Report whether the wallet holds any encryption keys&period;
| xref:wallet/CWallet/HasWalletSpend.adoc[`HasWalletSpend`] 
| Check if a given transaction has any of its outputs spent by another transaction in the wallet
| xref:wallet/CWallet/HaveChain.adoc[`HaveChain`] 
| Interface to assert chain access
| xref:wallet/CWallet/HaveCryptedKeys.adoc[`HaveCryptedKeys`] 
| Report whether the wallet holds any encrypted private keys&period;
| xref:wallet/CWallet/HowSpent.adoc[`HowSpent`] 
| Determine how an output has been spent&period;
| xref:wallet/CWallet/IncOrderPosNext.adoc[`IncOrderPosNext`] 
| Increment the next transaction order id
| xref:wallet/CWallet/InitWalletFlags.adoc[`InitWalletFlags`] 
| overwrite all flags by the given uint64&lowbar;t flags must be uninitialised (or 0) only known flags may be present
| xref:wallet/CWallet/IsAbortingRescan.adoc[`IsAbortingRescan`] 
| Report whether a rescan abort has been requested&period;
| xref:wallet/CWallet/IsActiveScriptPubKeyMan.adoc[`IsActiveScriptPubKeyMan`] 
| Report whether a ScriptPubKeyMan is one of the wallet&apos;s active managers&period;
| xref:wallet/CWallet/IsAddressPreviouslySpent.adoc[`IsAddressPreviouslySpent`] 
| Report whether a destination has been marked as previously spent&period;
| xref:wallet/CWallet/IsFromMe.adoc[`IsFromMe`] 
| should probably be renamed to IsRelevantToMe
| xref:wallet/CWallet/IsHDEnabled.adoc[`IsHDEnabled`] 
| Returns true if HD is enabled
| xref:wallet/CWallet/IsInternalScriptPubKeyMan.adoc[`IsInternalScriptPubKeyMan`] 
| Returns whether the provided ScriptPubKeyMan is internal
| xref:wallet/CWallet/IsLocked.adoc[`IsLocked`]  [.small]#[virtual]#
| Report whether the wallet&apos;s keys are currently locked (encrypted and unavailable)&period;
| xref:wallet/CWallet/IsLockedCoin.adoc[`IsLockedCoin`] 
| Report whether an output is locked against spending&period;
| xref:wallet/CWallet/IsMine-08c.adoc[`IsMine`] 
| `IsMine` overloads
| xref:wallet/CWallet/IsScanning.adoc[`IsScanning`] 
| Report whether a rescan is running&period;
| xref:wallet/CWallet/IsScanningWithPassphrase.adoc[`IsScanningWithPassphrase`] 
| Report whether the running rescan holds the wallet passphrase&period;
| xref:wallet/CWallet/IsSpent.adoc[`IsSpent`] 
| Report whether an output is spent by any known transaction&period;
| xref:wallet/CWallet/IsSpentKey.adoc[`IsSpentKey`] 
| Whether this or any known scriptPubKey with the same single key has been spent&period;
| xref:wallet/CWallet/IsTxImmatureCoinBase.adoc[`IsTxImmatureCoinBase`] 
| Report whether a transaction is an immature coinbase output&period;
| xref:wallet/CWallet/IsWalletFlagSet.adoc[`IsWalletFlagSet`]  [.small]#[virtual]#
| check if a certain wallet flag is set
| xref:wallet/CWallet/KeypoolCountExternalKeys.adoc[`KeypoolCountExternalKeys`] 
| Count the external (receiving) keys available in the keypool&period;
| xref:wallet/CWallet/ListAddrBookAddresses.adoc[`ListAddrBookAddresses`] 
| Filter and retrieve destinations stored in the addressbook
| xref:wallet/CWallet/ListAddrBookLabels.adoc[`ListAddrBookLabels`] 
| Retrieve all the known labels in the address book
| xref:wallet/CWallet/ListLockedCoins.adoc[`ListLockedCoins`] 
| List all currently locked outputs&period;
| xref:wallet/CWallet/LoadActiveScriptPubKeyMan.adoc[`LoadActiveScriptPubKeyMan`] 
| Loads an active ScriptPubKeyMan for the specified type and internal&period; (used by LoadWallet)
| xref:wallet/CWallet/LoadAddressPreviouslySpent.adoc[`LoadAddressPreviouslySpent`] 
| Marks destination as previously spent&period;
| xref:wallet/CWallet/LoadAddressReceiveRequest.adoc[`LoadAddressReceiveRequest`] 
| Appends payment request to destination&period;
| xref:wallet/CWallet/LoadDescriptorScriptPubKeyMan.adoc[`LoadDescriptorScriptPubKeyMan`] 
| Instantiate a descriptor ScriptPubKeyMan from the WalletDescriptor and load it
| xref:wallet/CWallet/LoadLockedCoin.adoc[`LoadLockedCoin`] 
| Load a locked coin from the database into memory&period;
| xref:wallet/CWallet/LoadToWallet.adoc[`LoadToWallet`] 
| Load a wallet transaction read from the database into memory&period;
| xref:wallet/CWallet/LoadWalletFlags.adoc[`LoadWalletFlags`] 
| Loads the flags into the wallet&period; (used by LoadWallet)
| xref:wallet/CWallet/Lock.adoc[`Lock`] 
| Lock the wallet, clearing the decrypted master key from memory&period;
| xref:wallet/CWallet/LockCoin.adoc[`LockCoin`] 
| Lock an output so it is not selected for spending&period;
| xref:wallet/CWallet/LogName.adoc[`LogName`]  [.small]#[virtual]#
| Return wallet name for use in logs, will return &quot;default wallet&quot; if the wallet has no name&period;
| xref:wallet/CWallet/LogStats.adoc[`LogStats`] 
| Write summary statistics about the wallet to the log&period;
| xref:wallet/CWallet/MarkDestinationsDirty.adoc[`MarkDestinationsDirty`] 
| Marks all outputs in each one of the destinations dirty, so their cache is reset and does not return outdated information&period;
| xref:wallet/CWallet/MarkDirty.adoc[`MarkDirty`] 
| Mark cached balances dirty so they are recomputed on next access&period;
| xref:wallet/CWallet/MarkReplaced.adoc[`MarkReplaced`] 
| Mark a transaction as replaced by another transaction&period;
| xref:wallet/CWallet/MaybeUpdateBirthTime.adoc[`MaybeUpdateBirthTime`] 
| Updates wallet birth time if &apos;time&apos; is below it
| xref:wallet/CWallet/MigrateToSQLite.adoc[`MigrateToSQLite`] 
| Move all records from the BDB database to a new SQLite database for storage&period; The original BDB file will be deleted and replaced with a new SQLite file&period; A backup is not created&period; May crash if something unexpected happens in the filesystem&period;
| xref:wallet/CWallet/PopulateWalletFromDB.adoc[`PopulateWalletFromDB`] 
| Load wallet records from the database into memory&period;
| xref:wallet/CWallet/RefreshAllTXOs.adoc[`RefreshAllTXOs`] 
| Cache outputs that belong to the wallet for all transactions in the wallet
| xref:wallet/CWallet/RefreshTXOsFromTx.adoc[`RefreshTXOsFromTx`] 
| Cache outputs that belong to the wallet from a single transaction
| xref:wallet/CWallet/RemoveTxs-079.adoc[`RemoveTxs`] 
| `RemoveTxs` overloads
| xref:wallet/CWallet/ReorderTransactions.adoc[`ReorderTransactions`] 
| Reassign order positions to all wallet transactions&period;
| xref:wallet/CWallet/RescanFromTime.adoc[`RescanFromTime`] 
| Rescan the chain for wallet transactions from a given start time&period;
| xref:wallet/CWallet/ResubmitWalletTransactions.adoc[`ResubmitWalletTransactions`] 
| Resubmit unconfirmed wallet transactions to the mempool and peers&period;
| xref:wallet/CWallet/ScanForWalletTransactions.adoc[`ScanForWalletTransactions`] 
| Scan a range of blocks for transactions relevant to this wallet&period;
| xref:wallet/CWallet/ScanningDuration.adoc[`ScanningDuration`] 
| Measure how long the running rescan has been in progress&period;
| xref:wallet/CWallet/ScanningProgress.adoc[`ScanningProgress`] 
| Report the progress of the running rescan&period;
| xref:wallet/CWallet/SetAddressBook.adoc[`SetAddressBook`] 
| Set the address book label and purpose for a destination&period;
| xref:wallet/CWallet/SetAddressPreviouslySpent.adoc[`SetAddressPreviouslySpent`] 
| Record whether a destination has been previously spent&period;
| xref:wallet/CWallet/SetAddressReceiveRequest.adoc[`SetAddressReceiveRequest`] 
| Store or update a receive request for a destination&period;
| xref:wallet/CWallet/SetBroadcastTransactions.adoc[`SetBroadcastTransactions`] 
| Set whether this wallet broadcasts transactions&period;
| xref:wallet/CWallet/SetLastBlockProcessed.adoc[`SetLastBlockProcessed`] 
| Set last block processed height, and write to database
| xref:wallet/CWallet/SetNextResend.adoc[`SetNextResend`] 
| Set the next time this wallet should resend transactions to 12&hyphen;36 hours from now, &#126;1 day on average&period;
| xref:wallet/CWallet/SetSpentKeyState.adoc[`SetSpentKeyState`] 
| Record whether the key behind a transaction output has been spent&period;
| xref:wallet/CWallet/SetWalletFlag.adoc[`SetWalletFlag`] 
| set a single wallet flag
| xref:wallet/CWallet/SetupDescriptorScriptPubKeyMan.adoc[`SetupDescriptorScriptPubKeyMan`] 
| Create new DescriptorScriptPubKeyMan and add it to the wallet
| xref:wallet/CWallet/SetupDescriptorScriptPubKeyMans-05.adoc[`SetupDescriptorScriptPubKeyMans`] 
| `SetupDescriptorScriptPubKeyMans` overloads
| xref:wallet/CWallet/SetupLegacyDataSPKM.adoc[`SetupLegacyDataSPKM`] 
| Create a LegacyDataSPKM and set it for all legacy output types and both internal and external chains&period;
| xref:wallet/CWallet/SetupOwnDescriptorScriptPubKeyMans.adoc[`SetupOwnDescriptorScriptPubKeyMans`] 
| Create new seed and default DescriptorScriptPubKeyMans for this wallet
| xref:wallet/CWallet/SetupWalletGeneration.adoc[`SetupWalletGeneration`] 
| Setup new descriptors or seed for new address generation
| xref:wallet/CWallet/ShouldResend.adoc[`ShouldResend`] 
| Return true if all conditions for periodically resending transactions are met&period;
| xref:wallet/CWallet/SignMessage.adoc[`SignMessage`] 
| Sign an arbitrary message with the key for a public key hash&period;
| xref:wallet/CWallet/SignTransaction-06.adoc[`SignTransaction`] 
| `SignTransaction` overloads
| xref:wallet/CWallet/SubmitTxMemoryPoolAndRelay.adoc[`SubmitTxMemoryPoolAndRelay`] 
| Pass this transaction to node for optional mempool insertion and relay to peers&period;
| xref:wallet/CWallet/TopUpCallback-0a.adoc[`TopUpCallback`] 
| `TopUpCallback` overloads
| xref:wallet/CWallet/TopUpKeyPool.adoc[`TopUpKeyPool`] 
| Refill the keypool up to the target size&period;
| xref:wallet/CWallet/TransactionCanBeAbandoned.adoc[`TransactionCanBeAbandoned`] 
| Return whether transaction can be abandoned
| xref:wallet/CWallet/TransactionChangeType.adoc[`TransactionChangeType`] 
| Choose the change output type for a transaction&period;
| xref:wallet/CWallet/Unlock.adoc[`Unlock`] 
| Unlock the wallet using the given passphrase&period;
| xref:wallet/CWallet/UnlockAllCoins.adoc[`UnlockAllCoins`] 
| Unlock every locked output&period;
| xref:wallet/CWallet/UnlockCoin.adoc[`UnlockCoin`] 
| Unlock a previously locked output&period;
| xref:wallet/WalletStorage/UnsetBlankWalletFlag.adoc[`UnsetBlankWalletFlag`]  [.small]#[virtual]#
| Clears the &quot;blank wallet&quot; flag, recording the change in the given batch&period;
| xref:wallet/CWallet/UnsetWalletFlag.adoc[`UnsetWalletFlag`] 
| Unsets a single wallet flag
| xref:wallet/CWallet/UpgradeDescriptorCache.adoc[`UpgradeDescriptorCache`] 
| Upgrade DescriptorCaches
| xref:wallet/CWallet/WalletLogPrintf.adoc[`WalletLogPrintf`] 
| Prepends the wallet name in logging output to ease debugging in multi&hyphen;wallet use cases
| xref:wallet/CWallet/WithEncryptionKey.adoc[`WithEncryptionKey`]  [.small]#[virtual]#
| Invoke a callback with the decrypted master key while holding the encryption lock&period;
| xref:wallet/CWallet/WriteBestBlock.adoc[`WriteBestBlock`] 
| Write the current best block to database
| xref:wallet/CWallet/blockConnected-0b.adoc[`blockConnected`] 
| Handle a block being connected to the chain tip&period;
| xref:wallet/CWallet/blockDisconnected-0a.adoc[`blockDisconnected`] 
| Handle a block being disconnected from the chain tip&period;
| xref:wallet/CWallet/chain.adoc[`chain`] 
| Interface for accessing chain state&period;
| xref:wallet/CWallet/chainStateFlushed.adoc[`chainStateFlushed`]  [.small]#[virtual]#
| 
| xref:wallet/CWallet/postInitProcess.adoc[`postInitProcess`] 
| Wallet post&hyphen;init setup Gives the wallet a chance to register repetitive tasks and complete post&hyphen;init tasks
| xref:wallet/CWallet/transactionAddedToMempool.adoc[`transactionAddedToMempool`]  [.small]#[virtual]#
| Handle a transaction being added to the node&apos;s mempool&period;
| xref:wallet/CWallet/transactionRemovedFromMempool.adoc[`transactionRemovedFromMempool`]  [.small]#[virtual]#
| Handle a transaction being removed from the node&apos;s mempool&period;
| xref:wallet/CWallet/updatedBlockTip.adoc[`updatedBlockTip`]  [.small]#[virtual]#
| Handle the chain tip being updated&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/CWallet/CreateNew.adoc[`CreateNew`] 
| Initializes, creates and returns a new CWallet&semi; returns a null pointer in case of an error
| xref:wallet/CWallet/LoadExisting.adoc[`LoadExisting`] 
| Initializes, loads, and returns a CWallet from an existing wallet&semi; returns a null pointer in case of an error
| xref:wallet/CWallet/LoadWalletArgs.adoc[`LoadWalletArgs`] 
| Apply command&hyphen;line and configuration arguments to a wallet&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:wallet/CWallet/NotifyAddressBookChanged.adoc[`NotifyAddressBookChanged`] 
| Address book entry changed&period;
| xref:wallet/CWallet/NotifyCanGetAddressesChanged.adoc[`NotifyCanGetAddressesChanged`] 
| Keypool has new keys
| xref:wallet/CWallet/NotifyStatusChanged.adoc[`NotifyStatusChanged`] 
| Wallet status (encrypted, locked) changed&period; Note&colon; Called without locks held&period;
| xref:wallet/CWallet/NotifyTransactionChanged.adoc[`NotifyTransactionChanged`] 
| Wallet transaction added, removed or updated&period;
| xref:wallet/CWallet/NotifyUnload.adoc[`NotifyUnload`] 
| Wallet is about to be unloaded
| xref:wallet/CWallet/ShowProgress.adoc[`ShowProgress`] 
| Show progress e&period;g&period; for rescan
| xref:wallet/CWallet/cs_wallet.adoc[`cs&lowbar;wallet`] 
| Main wallet lock&period; This lock protects all the fields added by CWallet&period;
| xref:wallet/CWallet/m_address_book.adoc[`m&lowbar;address&lowbar;book`] 
| Address book entries indexed by destination&period;
| xref:wallet/CWallet/m_allow_fallback_fee.adoc[`m&lowbar;allow&lowbar;fallback&lowbar;fee`] 
| will be false if &hyphen;fallbackfee&equals;0
| xref:wallet/CWallet/m_chain_notifications_handler.adoc[`m&lowbar;chain&lowbar;notifications&lowbar;handler`] 
| Registered interfaces&colon;&colon;Chain&colon;&colon;Notifications handler&period;
| xref:wallet/CWallet/m_confirm_target.adoc[`m&lowbar;confirm&lowbar;target`] 
| Default confirmation target (in blocks) for fee estimation&period;
| xref:wallet/CWallet/m_consolidate_feerate.adoc[`m&lowbar;consolidate&lowbar;feerate`] 
| When the actual feerate is less than the consolidate feerate, we will tend to make transactions which consolidate inputs&period; When the actual feerate is greater than the consolidate feerate, we will tend to make transactions which have the lowest fees&period;
| xref:wallet/CWallet/m_default_address_type.adoc[`m&lowbar;default&lowbar;address&lowbar;type`] 
| Default output type for newly generated receiving addresses&period;
| xref:wallet/CWallet/m_default_change_type.adoc[`m&lowbar;default&lowbar;change&lowbar;type`] 
| Default output type for change outputs&period; When unset, automatically choose type based on address type setting and the types other of non&hyphen;change outputs (see &hyphen;changetype option documentation and implementation in CWallet&colon;&colon;TransactionChangeType for details)&period;
| xref:wallet/CWallet/m_default_max_tx_fee.adoc[`m&lowbar;default&lowbar;max&lowbar;tx&lowbar;fee`] 
| Absolute maximum transaction fee (in satoshis) used by default for the wallet
| xref:wallet/CWallet/m_discard_rate.adoc[`m&lowbar;discard&lowbar;rate`] 
| If the cost to spend a change output at this feerate is greater than the value of the output itself, just drop it to fees&period;
| xref:wallet/CWallet/m_fallback_fee.adoc[`m&lowbar;fallback&lowbar;fee`] 
| If fee estimation does not have enough data to provide estimates, use this fee instead&period; Has no effect if not using fee estimation Override with &hyphen;fallbackfee
| xref:wallet/CWallet/m_keypool_size.adoc[`m&lowbar;keypool&lowbar;size`] 
| Number of pre&hyphen;generated keys&sol;scripts by each spkm (part of the look&hyphen;ahead process, used to detect payments)
| xref:wallet/CWallet/m_locked_coins.adoc[`m&lowbar;locked&lowbar;coins`] 
| Set of Coins owned by this wallet that we won&apos;t try to spend from&period; A Coin may be locked if it has already been used to fund a transaction that hasn&apos;t confirmed yet&period; We wouldn&apos;t consider the Coin spent already, but also shouldn&apos;t try to use it again&period; bool to track whether this locked coin is persisted to disk&period;
| xref:wallet/CWallet/m_max_aps_fee.adoc[`m&lowbar;max&lowbar;aps&lowbar;fee`] 
| note&colon; this is absolute fee, not fee rate
| xref:wallet/CWallet/m_min_fee.adoc[`m&lowbar;min&lowbar;fee`] 
| Minimum fee rate to use when creating transactions&period;
| xref:wallet/CWallet/m_notify_tx_changed_script.adoc[`m&lowbar;notify&lowbar;tx&lowbar;changed&lowbar;script`] 
| Notify external script when a wallet transaction comes in or is updated (handled by &hyphen;walletnotify)
| xref:wallet/CWallet/m_relock_mutex.adoc[`m&lowbar;relock&lowbar;mutex`] 
| Used to prevent deleting the passphrase from memory when it is still in use&period;
| xref:wallet/CWallet/m_signal_rbf.adoc[`m&lowbar;signal&lowbar;rbf`] 
| Whether new transactions signal opt&hyphen;in Replace&hyphen;By&hyphen;Fee&period;
| xref:wallet/CWallet/m_spend_zero_conf_change.adoc[`m&lowbar;spend&lowbar;zero&lowbar;conf&lowbar;change`] 
| Allow Coin Selection to pick unconfirmed UTXOs that were sent from our own wallet if it cannot fund the transaction otherwise&period;
| xref:wallet/CWallet/m_unlock_mutex.adoc[`m&lowbar;unlock&lowbar;mutex`] 
| Used to prevent concurrent calls to walletpassphrase RPC&period;
| xref:wallet/CWallet/mapMasterKeys.adoc[`mapMasterKeys`] 
| Encrypted master keys held by this wallet, indexed by id&period;
| xref:wallet/CWallet/mapWallet.adoc[`mapWallet`] 
| Map from txid to CWalletTx for all transactions this wallet is interested in, including received and sent transactions&period;
| xref:wallet/CWallet/nMasterKeyMaxID.adoc[`nMasterKeyMaxID`] 
| Highest master key id assigned so far&period;
| xref:wallet/CWallet/nOrderPosNext.adoc[`nOrderPosNext`] 
| Order position to assign to the next transaction added to the wallet&period;
| xref:wallet/CWallet/nRelockTime.adoc[`nRelockTime`] 
| Holds a timestamp at which point the wallet is scheduled (externally) to be relocked&period; Caller must arrange for actual relocking to occur via Lock()&period;
| xref:wallet/CWallet/wtxOrdered.adoc[`wtxOrdered`] 
| Wallet transactions ordered by their insertion order position&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:wallet/WalletRescanReserver.adoc[wallet::WalletRescanReserver]`
| RAII object to check and reserve a wallet rescan
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/AllInputsMine.adoc[`AllInputsMine`]
| Returns whether all of the inputs belong to the wallet
| xref:wallet/AutomaticCoinSelection.adoc[`AutomaticCoinSelection`]
| Select a set of coins such that nTargetValue is met&semi; never select unconfirmed coins if they are not ours
| xref:wallet/AvailableCoins.adoc[`AvailableCoins`]
| Populate the CoinsResult struct with vectors of available COutputs, organized by OutputType&period;
| xref:wallet/CachedTxGetAmounts.adoc[`CachedTxGetAmounts`]
| Splits a wallet transaction into received and sent entries plus its fee&period;
| xref:wallet/CachedTxGetChange.adoc[`CachedTxGetChange`]
| Returns the cached change amount of a wallet transaction&period;
| xref:wallet/CachedTxGetCredit.adoc[`CachedTxGetCredit`]
| Returns the cached total credit of a wallet transaction&period;
| xref:wallet/CachedTxGetDebit.adoc[`CachedTxGetDebit`]
| Returns the cached total debit of a wallet transaction&period;
| xref:wallet/CachedTxIsFromMe.adoc[`CachedTxIsFromMe`]
| Returns whether a wallet transaction debits from the wallet&period;
| xref:wallet/CachedTxIsTrusted-0c.adoc[`CachedTxIsTrusted`]
| Returns whether a wallet transaction is trusted&period;
| xref:wallet/CachedTxIsTrusted-0e.adoc[`CachedTxIsTrusted`]
| Returns whether a wallet transaction is trusted, tracking visited parents&period;
| xref:wallet/CreateTransaction.adoc[`CreateTransaction`]
| Create a new transaction paying the recipients with a set of coins selected by SelectCoins()&semi; Also create the change output, when needed
| xref:wallet/CreateWallet.adoc[`CreateWallet`]
| Create a new wallet and load it into the context&period;
| xref:wallet/EnsureWalletIsUnlocked.adoc[`EnsureWalletIsUnlocked`]
| Throws an RPC error if the wallet is locked&period;
| xref:wallet/ExportDescriptors.adoc[`ExportDescriptors`]
| Export the descriptors from a wallet so that they can be imported elsewhere
| xref:wallet/ExportWatchOnlyWallet.adoc[`ExportWatchOnlyWallet`]
| Make a new watchonly wallet file containing the public descriptors from this wallet The exported watchonly wallet file will be named and placed at the path specified in &apos;destination&apos;
| xref:wallet/FetchSelectedInputs.adoc[`FetchSelectedInputs`]
| Fetch and validate coin control selected inputs&period; Coins could be internal (from the wallet) or external&period;
| xref:wallet/FindNonChangeParentOutput.adoc[`FindNonChangeParentOutput`]
| Find non&hyphen;change parent output&period;
| xref:wallet/FundTransaction.adoc[`FundTransaction`]
| Insert additional inputs into the transaction by calling CreateTransaction()&semi;
| xref:wallet/GetAddressBalances.adoc[`GetAddressBalances`]
| Returns the confirmed balance held at each of the wallet&apos;s addresses&period;
| xref:wallet/GetAddressGroupings.adoc[`GetAddressGroupings`]
| Groups addresses that are believed to share a common owner&period;
| xref:wallet/GetAvoidReuseFlag.adoc[`GetAvoidReuseFlag`]
| Resolves the effective avoid&hyphen;reuse flag from a request parameter&period;
| xref:wallet/GetBalance.adoc[`GetBalance`]
| Computes the wallet&apos;s balance broken down by category&period;
| xref:wallet/GetDefaultWallet.adoc[`GetDefaultWallet`]
| Return the default wallet and report how many wallets are loaded&period;
| xref:wallet/GetDiscardRate.adoc[`GetDiscardRate`]
| Return the maximum feerate for discarding change&period;
| xref:wallet/GetMinimumFeeRate.adoc[`GetMinimumFeeRate`]
| Estimate the minimum fee rate considering user set parameters and the required fee
| xref:wallet/GetRequiredFee.adoc[`GetRequiredFee`]
| Return the minimum required absolute fee for this size based on the required fee rate
| xref:wallet/GetRequiredFeeRate.adoc[`GetRequiredFeeRate`]
| Return the minimum required feerate taking into account the minimum relay feerate and user set minimum transaction feerate
| xref:wallet/GetWallet.adoc[`GetWallet`]
| Look up a loaded wallet by name&period;
| xref:wallet/GetWalletForJSONRPCRequest.adoc[`GetWalletForJSONRPCRequest`]
| Figures out what wallet, if any, to use for a JSONRPCRequest&period;
| xref:wallet/GroupOutputs.adoc[`GroupOutputs`]
| Group coins by the provided filters&period;
| xref:wallet/HasLegacyRecords-08.adoc[`HasLegacyRecords`]
| Returns true if there are any DBKeys&colon;&colon;LEGACY&lowbar;TYPES record in the wallet db&period;
| xref:wallet/HasLegacyRecords-0f.adoc[`HasLegacyRecords`]
| Returns true if there are any DBKeys&colon;&colon;LEGACY&lowbar;TYPES record in the wallet db
| xref:wallet/InputIsMine.adoc[`InputIsMine`]
| Returns whether the output spent by an input belongs to the wallet&period;
| xref:wallet/ListCoins.adoc[`ListCoins`]
| Return list of available coins and locked coins grouped by non&hyphen;change output address&period;
| xref:wallet/LoadCryptedKey.adoc[`LoadCryptedKey`]
| Loads an encrypted key from a database record into the wallet&period;
| xref:wallet/LoadEncryptionKey.adoc[`LoadEncryptionKey`]
| Loads a master encryption key from a database record into the wallet&period;
| xref:wallet/LoadHDChain.adoc[`LoadHDChain`]
| Loads HD chain data from a database record into the wallet&period;
| xref:wallet/LoadKey.adoc[`LoadKey`]
| Loads an unencrypted key from a database record into the wallet&period;
| xref:wallet/LoadWallet.adoc[`LoadWallet`]
| Load an existing wallet from disk into the context&period;
| xref:wallet/OutputGetChange.adoc[`OutputGetChange`]
| Returns the change amount an output contributes&period;
| xref:wallet/OutputGetCredit.adoc[`OutputGetCredit`]
| Returns the credit an output contributes if it belongs to the wallet&period;
| xref:wallet/OutputIsChange.adoc[`OutputIsChange`]
| Returns whether an output is a change output of the wallet&period;
| xref:wallet/PushParentDescriptors.adoc[`PushParentDescriptors`]
| Fetch parent descriptors of this scriptPubKey&period;
| xref:wallet/RestoreWallet.adoc[`RestoreWallet`]
| Restore a wallet from a backup file&period;
| xref:wallet/ScriptIsChange.adoc[`ScriptIsChange`]
| Returns whether a script is a change output of the wallet&period;
| xref:wallet/SelectCoins.adoc[`SelectCoins`]
| Select all coins from coin&lowbar;control, and if coin&lowbar;control &apos;m&lowbar;allow&lowbar;other&lowbar;inputs&equals;true&apos;, call &apos;AutomaticCoinSelection&apos; to select a set of coins such that nTargetValue &hyphen; pre&lowbar;set&lowbar;inputs&period;total&lowbar;amount is met&period;
| xref:wallet/TxGetChange.adoc[`TxGetChange`]
| Returns the total change amount of a transaction&period;
| xref:wallet/TxGetCredit.adoc[`TxGetCredit`]
| Returns the total credit of a transaction&apos;s outputs owned by the wallet&period;
| xref:wallet/feebumper/CommitTransaction.adoc[`feebumper&colon;&colon;CommitTransaction`]
| Commit the bumpfee transaction&period;
| xref:wallet/feebumper/CreateRateBumpTransaction.adoc[`feebumper&colon;&colon;CreateRateBumpTransaction`]
| Create bumpfee transaction based on feerate estimates&period;
| xref:wallet/feebumper/SignTransaction.adoc[`feebumper&colon;&colon;SignTransaction`]
| Sign the new transaction,
| xref:wallet/feebumper/TransactionCanBeBumped.adoc[`feebumper&colon;&colon;TransactionCanBeBumped`]
| Return whether transaction can be bumped&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
