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>)
Expand description
A raw scriptpubkey (including pay-to-pubkey) under Legacy context
Pkh(Pkh<Pk>)
Expand description
Pay-to-PubKey-Hash
Wpkh(Wpkh<Pk>)
Expand description
Pay-to-Witness-PubKey-Hash
Sh(Sh<Pk>)
Expand description
Pay-to-ScriptHash(includes nested wsh/wpkh/sorted multi)
Wsh(Wsh<Pk>)
Expand description
Pay-to-Witness-ScriptHash with Segwitv0 context
Implementations
impl<Pk> Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
impl<Pk> Descriptor<Pk> where
Pk: MiniscriptKey,
[src]pub fn new_pk(pk: Pk) -> Descriptor<Pk>
[src]
pub fn new_pk(pk: Pk) -> Descriptor<Pk>
[src]Create a new pk descriptor
pub fn new_pkh(pk: Pk) -> Descriptor<Pk>
[src]
pub fn new_pkh(pk: Pk) -> Descriptor<Pk>
[src]Create a new PkH descriptor
pub fn new_wpkh(pk: Pk) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_wpkh(pk: Pk) -> Result<Descriptor<Pk>, Error>
[src]Create a new Wpkh descriptor Will return Err if uncompressed key is used
pub fn new_sh_wpkh(pk: Pk) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_sh_wpkh(pk: Pk) -> Result<Descriptor<Pk>, Error>
[src]Create a new sh wrapped wpkh from Pk
.
Errors when uncompressed keys are supplied
pub fn new_sh(ms: Miniscript<Pk, Legacy>) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_sh(ms: Miniscript<Pk, Legacy>) -> Result<Descriptor<Pk>, Error>
[src]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
pub fn new_wsh(ms: Miniscript<Pk, Segwitv0>) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_wsh(ms: Miniscript<Pk, Segwitv0>) -> Result<Descriptor<Pk>, Error>
[src]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
pub fn new_sh_wsh(ms: Miniscript<Pk, Segwitv0>) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_sh_wsh(ms: Miniscript<Pk, Segwitv0>) -> Result<Descriptor<Pk>, Error>
[src]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
pub fn new_bare(ms: Miniscript<Pk, BareCtx>) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_bare(ms: Miniscript<Pk, BareCtx>) -> Result<Descriptor<Pk>, Error>
[src]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
pub fn new_sh_sortedmulti(
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_sh_sortedmulti(
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
[src]Create a new sh sortedmulti descriptor with threshold k
and Vec of pks
.
Errors when miniscript exceeds resource limits under p2sh context
pub fn new_sh_wsh_sortedmulti(
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_sh_wsh_sortedmulti(
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
[src]Create a new sh wrapped wsh sortedmulti descriptor from threshold
k
and Vec of pks
Errors when miniscript exceeds resource limits under segwit context
pub fn new_wsh_sortedmulti(
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
[src]
pub fn new_wsh_sortedmulti(
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
[src]Create a new wsh sorted multi descriptor Errors when miniscript exceeds resource limits under p2sh context
pub fn desc_type(&self) -> DescriptorType
[src]
pub fn desc_type(&self) -> DescriptorType
[src]Get the DescriptorType of Descriptor
impl Descriptor<DescriptorPublicKey>
[src]
impl Descriptor<DescriptorPublicKey>
[src]pub fn is_deriveable(&self) -> bool
[src]
pub fn is_deriveable(&self) -> bool
[src]Whether or not the descriptor has any wildcards
pub fn derive(&self, index: u32) -> Descriptor<DescriptorPublicKey>
[src]
pub fn derive(&self, index: u32) -> Descriptor<DescriptorPublicKey>
[src]Derives all wildcard keys in the descriptor using the supplied index
Panics if given an index ≥ 2^31
pub fn parse_descriptor<C>(
secp: &Secp256k1<C>,
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>), Error> where
C: Signing,
[src]
pub fn parse_descriptor<C>(
secp: &Secp256k1<C>,
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>), Error> where
C: Signing,
[src]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.
pub fn to_string_with_secret(
&self,
key_map: &HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>
) -> String
[src]
pub fn to_string_with_secret(
&self,
key_map: &HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>
) -> String
[src]Serialize a descriptor to string with its secret keys
Trait Implementations
impl<Pk> Clone for Descriptor<Pk> where
Pk: Clone + MiniscriptKey,
[src]
impl<Pk> Clone for Descriptor<Pk> where
Pk: Clone + MiniscriptKey,
[src]pub fn clone(&self) -> Descriptor<Pk>
[src]
pub fn clone(&self) -> Descriptor<Pk>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<Pk> Debug for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
impl<Pk> Debug for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]impl<Pk> DescriptorTrait<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
impl<Pk> DescriptorTrait<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]pub fn sanity_check(&self) -> Result<(), Error>
[src]
pub fn sanity_check(&self) -> Result<(), Error>
[src]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
pub fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
pub fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]Computes the Bitcoin address of the descriptor, if one exists
pub fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
pub fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]Computes the scriptpubkey of the descriptor
pub fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
pub fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]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).
pub fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
pub fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]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.
pub fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8, Global>, Global>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
pub fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8, Global>, Global>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]Returns satisfying witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S.
pub fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
pub fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]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.
pub fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
pub fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]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.
impl<Pk> Display for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
impl<Pk> Display for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]impl ExtractPolicy for Descriptor<DescriptorPublicKey>
[src]
impl ExtractPolicy for Descriptor<DescriptorPublicKey>
[src]fn extract_policy(
&self,
signers: &SignersContainer,
build_sat: BuildSatisfaction<'_>,
secp: &Secp256k1<All>
) -> Result<Option<Policy>, Error>
[src]
fn extract_policy(
&self,
signers: &SignersContainer,
build_sat: BuildSatisfaction<'_>,
secp: &Secp256k1<All>
) -> Result<Option<Policy>, Error>
[src]Extract the spending policy
impl<Pk> ForEachKey<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
impl<Pk> ForEachKey<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]pub fn for_each_key<'a, F>(&'a self, pred: F) -> bool where
F: FnMut(ForEach<'a, Pk>) -> bool,
Pk: 'a,
<Pk as MiniscriptKey>::Hash: 'a,
[src]
pub fn for_each_key<'a, F>(&'a self, pred: F) -> bool where
F: FnMut(ForEach<'a, Pk>) -> bool,
Pk: 'a,
<Pk as MiniscriptKey>::Hash: 'a,
[src]Run a predicate on every key in the descriptor, returning whether the predicate returned true for every key Read more
fn for_any_key<'a, F>(&'a self, pred: F) -> bool where
F: FnMut(ForEach<'a, Pk>) -> bool,
Pk: 'a,
<Pk as MiniscriptKey>::Hash: 'a,
[src]
fn for_any_key<'a, F>(&'a self, pred: F) -> bool where
F: FnMut(ForEach<'a, Pk>) -> bool,
Pk: 'a,
<Pk as MiniscriptKey>::Hash: 'a,
[src]Run a predicate on every key in the descriptor, returning whether the predicate returned true for any key Read more
impl<Pk> FromStr for Descriptor<Pk> where
Pk: MiniscriptKey + FromStr,
<Pk as MiniscriptKey>::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
impl<Pk> FromStr for Descriptor<Pk> where
Pk: MiniscriptKey + FromStr,
<Pk as MiniscriptKey>::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]impl<Pk> FromTree for Descriptor<Pk> where
Pk: MiniscriptKey + FromStr,
<Pk as MiniscriptKey>::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
impl<Pk> FromTree for Descriptor<Pk> where
Pk: MiniscriptKey + FromStr,
<Pk as MiniscriptKey>::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]impl<Pk> Liftable<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
impl<Pk> Liftable<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]impl<Pk> Ord for Descriptor<Pk> where
Pk: Ord + MiniscriptKey,
[src]
impl<Pk> Ord for Descriptor<Pk> where
Pk: Ord + MiniscriptKey,
[src]impl<Pk> PartialEq<Descriptor<Pk>> for Descriptor<Pk> where
Pk: PartialEq<Pk> + MiniscriptKey,
[src]
impl<Pk> PartialEq<Descriptor<Pk>> for Descriptor<Pk> where
Pk: PartialEq<Pk> + MiniscriptKey,
[src]pub fn eq(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn eq(&self, other: &Descriptor<Pk>) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
pub fn ne(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn ne(&self, other: &Descriptor<Pk>) -> bool
[src]This method tests for !=
.
impl<Pk> PartialOrd<Descriptor<Pk>> for Descriptor<Pk> where
Pk: PartialOrd<Pk> + MiniscriptKey,
[src]
impl<Pk> PartialOrd<Descriptor<Pk>> for Descriptor<Pk> where
Pk: PartialOrd<Pk> + MiniscriptKey,
[src]pub fn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
[src]
pub fn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<P, Q> TranslatePk<P, Q> for Descriptor<P> where
P: MiniscriptKey,
Q: MiniscriptKey,
[src]
impl<P, Q> TranslatePk<P, Q> for Descriptor<P> where
P: MiniscriptKey,
Q: MiniscriptKey,
[src]pub fn translate_pk<Fpk, Fpkh, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
Q: MiniscriptKey,
Fpk: FnMut(&P) -> Result<Q, E>,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> Result<<Q as MiniscriptKey>::Hash, E>,
[src]
pub fn translate_pk<Fpk, Fpkh, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
Q: MiniscriptKey,
Fpk: FnMut(&P) -> Result<Q, E>,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> Result<<Q as MiniscriptKey>::Hash, E>,
[src]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.
type Output = Descriptor<Q>
type Output = Descriptor<Q>
The associated output type. This must be Self
fn translate_pk_infallible<Fpk, Fpkh>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Self::Output where
Fpk: FnMut(&P) -> Q,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> <Q as MiniscriptKey>::Hash,
[src]
fn translate_pk_infallible<Fpk, Fpkh>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Self::Output where
Fpk: FnMut(&P) -> Q,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> <Q as MiniscriptKey>::Hash,
[src]Calls translate_pk
with conversion functions that cannot fail
impl<Pk> Eq for Descriptor<Pk> where
Pk: Eq + MiniscriptKey,
[src]
Pk: Eq + MiniscriptKey,
impl<Pk> StructuralEq for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
impl<Pk> StructuralPartialEq for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
Auto Trait Implementations
impl<Pk> RefUnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> Send for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Sync for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for Descriptor<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> UnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
[src]
impl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
[src]impl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
T: TranslatePk<P, Q>,
Q: MiniscriptKey,
[src]
impl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
T: TranslatePk<P, Q>,
Q: MiniscriptKey,
[src]impl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = Hash>,
[src]
impl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = Hash>,
[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,