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

A ScriptPubKeyMan backed by a single output descriptor&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class DescriptorScriptPubKeyMan
    : public xref:wallet/ScriptPubKeyMan.adoc[ScriptPubKeyMan]
----

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:wallet/ScriptPubKeyMan.adoc[ScriptPubKeyMan]`
| A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used in a wallet&period; It contains the scripts and keys related to the scriptPubKeys it manages&period; A ScriptPubKeyMan will be able to give out scriptPubKeys to be used, as well as marking when a scriptPubKey has been used&period; It also handles when and how to store a scriptPubKey and its related scripts and keys, including encryption&period;
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/DescriptorScriptPubKeyMan/CanGetAddresses.adoc[`CanGetAddresses`]  [.small]#[virtual]#
| Returns whether this spkm can hand out new addresses&period;
| xref:wallet/DescriptorScriptPubKeyMan/CanProvide.adoc[`CanProvide`]  [.small]#[virtual]#
| Returns whether this spkm can contribute solving data for the given script&period;
| xref:wallet/DescriptorScriptPubKeyMan/CanUpdateToWalletDescriptor.adoc[`CanUpdateToWalletDescriptor`] 
| Returns whether this spkm can be updated to the given descriptor&period;
| xref:wallet/DescriptorScriptPubKeyMan/CheckDecryptionKey.adoc[`CheckDecryptionKey`]  [.small]#[virtual]#
| Checks whether the given master key decrypts this spkm&apos;s keys&period;
| xref:wallet/DescriptorScriptPubKeyMan/Encrypt.adoc[`Encrypt`]  [.small]#[virtual]#
| Encrypts this spkm&apos;s keys with the given master key&period;
| xref:wallet/DescriptorScriptPubKeyMan/FillPSBT.adoc[`FillPSBT`]  [.small]#[virtual]#
| Adds descriptor and derivation information to a PSBT and optionally signs it&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetDescriptorString.adoc[`GetDescriptorString`] 
| Serializes the descriptor to a string, optionally including private keys&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetEndRange.adoc[`GetEndRange`] 
| Returns the end of the descriptor&apos;s derivation range&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetID.adoc[`GetID`]  [.small]#[virtual]#
| Returns a stable identifier for this spkm derived from its descriptor&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetKey.adoc[`GetKey`] 
| Retrieve the particular key if it is available&period; Returns nullopt if the key is not in the wallet, or if the wallet is locked&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetKeyPoolSize.adoc[`GetKeyPoolSize`]  [.small]#[virtual]#
| Returns the number of pre&hyphen;generated keys&sol;scripts in the cache&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetMetadata.adoc[`GetMetadata`]  [.small]#[virtual]#
| Returns the key metadata for the given destination, or nullptr if none is known&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetNewDestination-03.adoc[`GetNewDestination`] 
| `GetNewDestination` overloads
| xref:wallet/DescriptorScriptPubKeyMan/GetReservedDestination-0a.adoc[`GetReservedDestination`] 
| `GetReservedDestination` overloads
| xref:wallet/DescriptorScriptPubKeyMan/GetScriptPubKeys-0a.adoc[`GetScriptPubKeys`] 
| `GetScriptPubKeys` overloads
| xref:wallet/DescriptorScriptPubKeyMan/GetSigningProvider.adoc[`GetSigningProvider`] 
| Fetch the SigningProvider for the given pubkey and always include private keys&period; This should only be called by signing code&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetSolvingProvider.adoc[`GetSolvingProvider`]  [.small]#[virtual]#
| Returns a SigningProvider able to solve the given script&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetTimeFirstKey.adoc[`GetTimeFirstKey`]  [.small]#[virtual]#
| Returns the creation time of the descriptor, used as the wallet&apos;s birth time&period;
| xref:wallet/DescriptorScriptPubKeyMan/GetWalletDescriptor.adoc[`GetWalletDescriptor`] 
| Returns a copy of this spkm&apos;s wallet descriptor&period;
| xref:wallet/DescriptorScriptPubKeyMan/HasPrivKey.adoc[`HasPrivKey`] 
| Returns whether the private key for the given key id is present&period;
| xref:wallet/DescriptorScriptPubKeyMan/HasWalletDescriptor.adoc[`HasWalletDescriptor`] 
| Returns whether this spkm holds the given wallet descriptor&period;
| xref:wallet/DescriptorScriptPubKeyMan/HaveCryptedKeys.adoc[`HaveCryptedKeys`]  [.small]#[virtual]#
| Returns whether this spkm holds any encrypted private keys&period;
| xref:wallet/DescriptorScriptPubKeyMan/HavePrivateKeys.adoc[`HavePrivateKeys`]  [.small]#[virtual]#
| Returns whether this spkm holds any unencrypted private keys&period;
| xref:wallet/DescriptorScriptPubKeyMan/IsHDEnabled.adoc[`IsHDEnabled`]  [.small]#[virtual]#
| Returns whether this descriptor uses HD derivation&period;
| xref:wallet/DescriptorScriptPubKeyMan/IsMine.adoc[`IsMine`]  [.small]#[virtual]#
| Returns whether the given script is derived from this descriptor&period;
| xref:wallet/ScriptPubKeyMan/KeepDestination.adoc[`KeepDestination`]  [.small]#[virtual]#
| Marks a previously reserved destination as used so it is not handed out again&period;
| xref:wallet/DescriptorScriptPubKeyMan/MarkUnusedAddresses.adoc[`MarkUnusedAddresses`]  [.small]#[virtual]#
| Marks addresses up to and including the one for the given script as used&period;
| xref:wallet/DescriptorScriptPubKeyMan/ReturnDestination.adoc[`ReturnDestination`]  [.small]#[virtual]#
| Returns a previously reserved destination to the cache for reuse&period;
| xref:wallet/DescriptorScriptPubKeyMan/SignMessage.adoc[`SignMessage`]  [.small]#[virtual]#
| Signs a message with the key for the given script&period;
| xref:wallet/DescriptorScriptPubKeyMan/SignTransaction.adoc[`SignTransaction`]  [.small]#[virtual]#
| Creates signatures for this spkm&apos;s inputs and adds them to the transaction&period;
| xref:wallet/DescriptorScriptPubKeyMan/TopUp.adoc[`TopUp`]  [.small]#[virtual]#
| Tops up the descriptor cache and m&lowbar;map&lowbar;script&lowbar;pub&lowbar;keys&period; The cache is stored in the wallet file and is used to expand the descriptor in GetNewDestination&period; Descriptor wallets rely more on ephemeral data than legacy wallets&period; For wallets using unhardened derivation (with or without private keys), the &quot;keypool&quot; is a single xpub&period;
| xref:wallet/DescriptorScriptPubKeyMan/UpdateWalletDescriptor.adoc[`UpdateWalletDescriptor`] 
| Updates this spkm&apos;s descriptor, e&period;g&period; to add private keys or cache data&period;
| xref:wallet/DescriptorScriptPubKeyMan/UpgradeDescriptorCache.adoc[`UpgradeDescriptorCache`] 
| Upgrades the on&hyphen;disk descriptor cache to the current format&period;
| xref:wallet/ScriptPubKeyMan/WalletLogPrintf.adoc[`WalletLogPrintf`] 
| Prepends the wallet name in logging output to ease debugging in multi&hyphen;wallet use cases
| xref:wallet/DescriptorScriptPubKeyMan/WriteDescriptor.adoc[`WriteDescriptor`] 
| Writes this spkm&apos;s descriptor to the wallet database&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/DescriptorScriptPubKeyMan/CreateFromImport.adoc[`CreateFromImport`] 
| Creates a DescriptorScriptPubKeyMan from an imported descriptor and signing provider&period;
| xref:wallet/DescriptorScriptPubKeyMan/CreateFromMigration.adoc[`CreateFromMigration`] 
| Creates a DescriptorScriptPubKeyMan while migrating a legacy wallet&period;
| xref:wallet/DescriptorScriptPubKeyMan/GenerateNewSingleSig.adoc[`GenerateNewSingleSig`] 
| Generates a new single&hyphen;signature DescriptorScriptPubKeyMan from a master key&period;
| xref:wallet/DescriptorScriptPubKeyMan/LoadFromStorage.adoc[`LoadFromStorage`] 
| Loads a DescriptorScriptPubKeyMan from stored wallet data&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:wallet/ScriptPubKeyMan/NotifyCanGetAddressesChanged.adoc[`NotifyCanGetAddressesChanged`] 
| Keypool has new keys
| xref:wallet/ScriptPubKeyMan/NotifyFirstKeyTimeChanged.adoc[`NotifyFirstKeyTimeChanged`] 
| Birth time changed
| xref:wallet/DescriptorScriptPubKeyMan/cs_desc_man.adoc[`cs&lowbar;desc&lowbar;man`] 
| Guards this spkm&apos;s descriptor, key, and cache state&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/DescriptorScriptPubKeyMan/2constructor-07.adoc[`DescriptorScriptPubKeyMan`]         [.small]#[constructor]#
| Constructors
| xref:wallet/DescriptorScriptPubKeyMan/DecIndex.adoc[`DecIndex`] 
| Rewinds the descriptor&apos;s next&hyphen;index counter by one&period;
| xref:wallet/DescriptorScriptPubKeyMan/IncIndex.adoc[`IncIndex`] 
| Advances the descriptor&apos;s next&hyphen;index counter by one&period;
| xref:wallet/DescriptorScriptPubKeyMan/SetRangeEnd.adoc[`SetRangeEnd`] 
| Sets the end of the descriptor&apos;s derivation range&period;
| xref:wallet/DescriptorScriptPubKeyMan/TopUpWithDB.adoc[`TopUpWithDB`] 
| Same as &apos;TopUp&apos; but designed for use within a batch transaction context
|===


== Protected Data Members

[cols="1,4"]
|===
| Name| Description
| xref:wallet/ScriptPubKeyMan/m_storage.adoc[`m&lowbar;storage`] 
| The wallet storage this ScriptPubKeyMan uses to persist and query wallet&hyphen;wide state&period;
| xref:wallet/DescriptorScriptPubKeyMan/m_wallet_descriptor.adoc[`m&lowbar;wallet&lowbar;descriptor`] 
| The wallet descriptor backing this spkm&period;
|===



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