Struct Descriptor

Source
pub struct Descriptor {
    pub extended_descriptor: ExtendedDescriptor,
    pub key_map: KeyMap,
}
Expand description

An expression of how to derive output scripts: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md

Fields§

§extended_descriptor: ExtendedDescriptor§key_map: KeyMap

Implementations§

Source§

impl Descriptor

Source

pub fn new( descriptor: String, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>

Parse a string as a descriptor for the given network.

Source

pub fn new_bip44( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self

Multi-account hierarchy descriptor: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

Source

pub fn new_bip44_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>

Multi-account hierarchy descriptor: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

Source

pub fn new_bip49( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self

P2SH nested P2WSH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki

Source

pub fn new_bip49_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>

P2SH nested P2WSH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki

Source

pub fn new_bip84( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self

Pay to witness PKH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki

Source

pub fn new_bip84_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>

Pay to witness PKH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki

Source

pub fn new_bip86( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self

Single key P2TR descriptor: https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki

Source

pub fn new_bip86_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>

Single key P2TR descriptor: https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki

Source

pub fn new_wsh_sortedmulti( k: u32, pks: Vec<String>, ) -> Result<Self, DescriptorError>

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

Source

pub fn new_sh_sortedmulti( k: u32, pks: Vec<String>, ) -> Result<Self, DescriptorError>

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

Source

pub fn new_sh_wsh_sortedmulti( k: u32, pks: Vec<String>, ) -> Result<Self, DescriptorError>

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

Source

pub fn new_pk(pk: String) -> Result<Self, DescriptorError>

Create a new pay-to-pubkey descriptor from a public key string.

Source

pub fn new_pkh(pk: String) -> Result<Self, DescriptorError>

Create a new PkH descriptor

Source

pub fn new_wpkh(pk: String) -> Result<Self, DescriptorError>

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

Source

pub fn new_sh_wpkh(pk: String) -> Result<Self, DescriptorError>

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

Source

pub fn new_wsh(mini_script: String) -> Result<Self, DescriptorError>

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

Source

pub fn new_sh_wsh(mini_script: String) -> Result<Self, DescriptorError>

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

Source

pub fn new_sh(mini_script: String) -> Result<Self, DescriptorError>

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

Source

pub fn new_bare(mini_script: String) -> Result<Self, DescriptorError>

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

Source

pub fn to_string_with_secret(&self) -> String

Dangerously convert the descriptor to a string.

Source

pub fn is_multipath(&self) -> bool

Does this descriptor contain paths: https://github.com/bitcoin/bips/blob/master/bip-0389.mediawiki

Source

pub fn descriptor_id(&self) -> Arc<DescriptorId>

A unique identifier for the descriptor.

Source

pub fn to_single_descriptors( &self, ) -> Result<Vec<Arc<Descriptor>>, MiniscriptError>

Return descriptors for all valid paths.

Source

pub fn max_weight_to_satisfy(&self) -> Result<u64, DescriptorError>

Computes an upper bound on the difference between a non-satisfied TxIn’s segwit_weight and a satisfied TxIn’s segwit_weight.

Source

pub fn desc_type(&self) -> DescriptorType

Source

pub fn derive_address( &self, index: u32, network: Network, ) -> Result<Arc<Address>, DescriptorError>

Source

pub fn has_wildcard(&self) -> bool

Whether or not the descriptor has any wildcards.

Source

pub fn sanity_check(&self) -> Result<(), DescriptorError>

Checks 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 signatures on all spend paths and whether the script is malleable.

In general, all the guarantees of miniscript hold only for safe scripts. The signer may not be able to find satisfactions even if one exists.

Trait Implementations§

Source§

impl Debug for Descriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Descriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<UT> LiftRef<UT> for Descriptor

Source§

impl<UT> LowerError<UT> for Descriptor

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for Descriptor

Source§

type ReturnType = <Arc<Descriptor> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for Descriptor

Source§

const TYPE_ID_META: MetadataBuffer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,