Enum bdk::descriptor::Descriptor[][src]

pub enum Descriptor<Pk> where
    Pk: MiniscriptKey
{ Bare(Bare<Pk>), Pkh(Pkh<Pk>), Wpkh(Wpkh<Pk>), Sh(Sh<Pk>), Wsh(Wsh<Pk>), }
Expand description

Script descriptor

Variants

Bare(Bare<Pk>)

A raw scriptpubkey (including pay-to-pubkey) under Legacy context

Pkh(Pkh<Pk>)

Pay-to-PubKey-Hash

Wpkh(Wpkh<Pk>)

Pay-to-Witness-PubKey-Hash

Sh(Sh<Pk>)

Pay-to-ScriptHash(includes nested wsh/wpkh/sorted multi)

Wsh(Wsh<Pk>)

Pay-to-Witness-ScriptHash with Segwitv0 context

Implementations

Create a new pk descriptor

Create a new PkH descriptor

Create a new Wpkh descriptor Will return Err if uncompressed key is used

Create a new sh wrapped wpkh from Pk. Errors when uncompressed keys are supplied

Create a new sh for a given redeem script Errors when miniscript exceeds resource limits under p2sh context or does not type check at the top level

Create a new wsh descriptor from witness script Errors when miniscript exceeds resource limits under p2sh context or does not type check at the top level

Create a new sh wrapped wsh descriptor with witness script Errors when miniscript exceeds resource limits under wsh context or does not type check at the top level

Create a new bare descriptor from witness script Errors when miniscript exceeds resource limits under bare context or does not type check at the top level

Create a new sh sortedmulti descriptor with threshold k and Vec of pks. Errors when miniscript exceeds resource limits under p2sh context

Create a new sh wrapped wsh sortedmulti descriptor from threshold k and Vec of pks Errors when miniscript exceeds resource limits under segwit context

Create a new wsh sorted multi descriptor Errors when miniscript exceeds resource limits under p2sh context

Whether or not the descriptor has any wildcards

Derives all wildcard keys in the descriptor using the supplied index

Panics if given an index ≥ 2^31

Parse a descriptor that may contain secret keys

Internally turns every secret key found into the corresponding public key and then returns a a descriptor that only contains public keys and a map to lookup the secret key given a public key.

Serialize a descriptor to string with its secret keys

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Whether the descriptor is safe Checks whether all the spend paths in the descriptor are possible on the bitcoin network under the current standardness and consensus rules Also checks whether the descriptor requires signauture on all spend paths And whether the script is malleable. In general, all the guarantees of miniscript hold only for safe scripts. All the analysis guarantees of miniscript only hold safe scripts. The signer may not be able to find satisfactions even if one exists

Computes the Bitcoin address of the descriptor, if one exists

Computes the scriptpubkey of the descriptor

Computes the scriptSig that will be in place for an unsigned input spending an output with this descriptor. For pre-segwit descriptors, which use the scriptSig for signatures, this returns the empty script.

This is used in Segwit transactions to produce an unsigned transaction whose txid will not change during signing (since only the witness data will change).

Computes the “witness script” of the descriptor, i.e. the underlying script before any hashing is done. For Bare, Pkh and Wpkh this is the scriptPubkey; for ShWpkh and Sh this is the redeemScript; for the others it is the witness script.

Returns satisfying witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S.

Computes an upper bound on the weight of a satisfying witness to the transaction. Assumes all signatures are 73 bytes, including push opcode and sighash suffix. Includes the weight of the VarInts encoding the scriptSig and witness stack length.

Get the scriptCode of a transaction output.

The scriptCode is the Script of the previous transaction output being serialized in the sighash when evaluating a CHECKSIG & co. OP code.

Attempts to produce a satisfying witness and scriptSig to spend an output controlled by the given descriptor; add the data to a given TxIn output. Read more

Formats the value using the given formatter. Read more

Extract the spending policy

Run a predicate on every key in the descriptor, returning whether the predicate returned true for every key Read more

Run a predicate on every key in the descriptor, returning whether the predicate returned true for any key Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Parse an expression tree into a descriptor

Convert the object into an abstract policy

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Convert a descriptor using abstract keys to one using specific keys This will panic if translatefpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure translatefpk returns an error in this case instead.

The associated output type. This must be Self

Calls translate_pk with conversion functions that cannot fail

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more

Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more

Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more

Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more

Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more

Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.