Interface for parsed descriptor objects.

Synopsis

Declared in <script/descriptor.h>

struct Descriptor;

Description

Descriptors are strings that describe a set of scriptPubKeys, together with all information necessary to solve them. By combining all information into one, they avoid the need to separately import keys and scripts.

Descriptors may be ranged, which occurs when the public keys inside are specified in the form of HD chains (xpubs).

Descriptors always represent public information ‐ public keys and scripts ‐ but in cases where private keys need to be conveyed along with a descriptor, they can be included inside by changing public keys to private keys (WIF format), and changing xpubs by xprvs.

Reference documentation about the descriptor language can be found in doc/descriptors.md.

Member Functions

Name

Description

~Descriptor [destructor] [virtual]

Destroy the descriptor and any subdescriptors it owns.

CanSelfExpand [virtual]

Whether the descriptor can be used to produce its address(es) without needing a cache or private keys.

Expand [virtual]

Expand a descriptor at a specified position.

ExpandFromCache [virtual]

Expand a descriptor at a specified position using cached expansion data.

ExpandPrivate [virtual]

Expand the private key for a descriptor at a specified position, if possible.

GetKeyCount [virtual]

Get the number of key expressions in this descriptor. Used only for tests

GetMaxKeyExpr [virtual]

Get the maximum key expression index. Used only for tests

GetOutputType [virtual]

Report the output type of the scripts produced by this descriptor.

GetPubKeys [virtual]

Return all (extended) public keys for this descriptor, including any from subdescriptors.

HasScripts [virtual]

Whether this descriptor produces any scripts with the Expand functions

HavePrivateKeys [virtual]

Whether the given provider has all private keys required by this descriptor.

IsRange [virtual]

Whether the expansion of this descriptor depends on the position.

IsSingleType [virtual]

Whether this descriptor will return at most one scriptPubKey or multiple (aka is or is not combo)

IsSolvable [virtual]

Whether this descriptor has all information about signing ignoring lack of private keys. This is true for all descriptors except ones that use raw or addr constructions.

MaxSatisfactionElems [virtual]

Get the maximum size number of stack elements for satisfying this descriptor.

MaxSatisfactionWeight [virtual]

Get the maximum size of a satisfaction for this descriptor, in weight units.

ScriptSize [virtual]

Get the size of the scriptPubKey for this descriptor.

ToNormalizedString [virtual]

Convert the descriptor to a normalized string. Normalized descriptors have the xpub at the last hardened step. This fails if the provided provider does not have the private keys to derive that xpub.

ToPrivateString [virtual]

Convert the descriptor to a private string. This uses public keys if the relevant private keys are not in the SigningProvider. If none of the relevant private keys are available, the output string in the "out" parameter will not contain any private key information, and this function will return "false".

ToString [virtual]

Convert the descriptor back to a string, undoing parsing.

Warnings [virtual]

Semantic/safety warnings (includes subdescriptors).

Non-Member Functions

Name

Description

DescriptorID

Unique identifier that may not change over time, unless explicitly marked as not backwards compatible. This is not part of BIP 380, not guaranteed to be interoperable and should not be exposed to the user.

InferDescriptor

Find a descriptor for the specified script, using information from provider where possible.

Created with MrDocs