Enum bdk::descriptor::Descriptor [−][src]
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
impl<Pk> Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
pub fn new_pk(pk: Pk) -> Descriptor<Pk>
[src]
Create a new pk descriptor
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]
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]
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]
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]
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]
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]
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]
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
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]
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
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]
k: usize,
pks: Vec<Pk, Global>
) -> Result<Descriptor<Pk>, Error>
Create a new wsh sorted multi descriptor Errors when miniscript exceeds resource limits under p2sh context
pub fn desc_type(&self) -> DescriptorType
[src]
Get the DescriptorType of Descriptor
impl Descriptor<DescriptorPublicKey>
[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]
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]
secp: &Secp256k1<C>,
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>), Error> where
C: Signing,
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]
&self,
key_map: &HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>
) -> String
Serialize a descriptor to string with its secret keys
Trait Implementations
impl<Pk> Clone for Descriptor<Pk> where
Pk: Clone + MiniscriptKey,
[src]
Pk: Clone + MiniscriptKey,
pub fn clone(&self) -> Descriptor<Pk>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Pk> Debug for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
impl<Pk> DescriptorTrait<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
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]
Pk: ToPublicKey,
Computes the Bitcoin address of the descriptor, if one exists
pub fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the scriptpubkey of the descriptor
pub fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
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]
Pk: ToPublicKey,
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]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8, Global>, Global>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
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]
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]
Pk: ToPublicKey,
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.
pub fn satisfy<S>(&self, txin: &mut TxIn, satisfier: S) -> Result<(), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
Pk: ToPublicKey,
S: Satisfier<Pk>,
impl<Pk> Display for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
impl<Pk> Eq for Descriptor<Pk> where
Pk: Eq + MiniscriptKey,
[src]
Pk: Eq + MiniscriptKey,
impl ExtractPolicy for Descriptor<DescriptorPublicKey>
[src]
fn extract_policy(
&self,
signers: &SignersContainer,
secp: &Secp256k1<All>
) -> Result<Option<Policy>, Error>
[src]
&self,
signers: &SignersContainer,
secp: &Secp256k1<All>
) -> Result<Option<Policy>, Error>
impl<Pk> ForEachKey<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
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]
F: FnMut(ForEach<'a, Pk>) -> bool,
Pk: 'a,
<Pk as MiniscriptKey>::Hash: 'a,
pub 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]
F: FnMut(ForEach<'a, Pk>) -> bool,
Pk: 'a,
<Pk as MiniscriptKey>::Hash: 'a,
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]
Pk: MiniscriptKey + FromStr,
<Pk as MiniscriptKey>::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
type Err = Error
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Descriptor<Pk>, Error>
[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]
Pk: MiniscriptKey + FromStr,
<Pk as MiniscriptKey>::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
pub fn from_tree(top: &Tree<'_>) -> Result<Descriptor<Pk>, Error>
[src]
Parse an expression tree into a descriptor
impl<Pk> Liftable<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
impl<Pk> Ord for Descriptor<Pk> where
Pk: Ord + MiniscriptKey,
[src]
Pk: Ord + MiniscriptKey,
pub fn cmp(&self, other: &Descriptor<Pk>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<Pk> PartialEq<Descriptor<Pk>> for Descriptor<Pk> where
Pk: PartialEq<Pk> + MiniscriptKey,
[src]
Pk: PartialEq<Pk> + MiniscriptKey,
pub fn eq(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn ne(&self, other: &Descriptor<Pk>) -> bool
[src]
impl<Pk> PartialOrd<Descriptor<Pk>> for Descriptor<Pk> where
Pk: PartialOrd<Pk> + MiniscriptKey,
[src]
Pk: PartialOrd<Pk> + MiniscriptKey,
pub fn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<Pk> StructuralEq for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
impl<Pk> StructuralPartialEq for Descriptor<Pk> where
Pk: MiniscriptKey,
[src]
Pk: MiniscriptKey,
impl<P, Q> TranslatePk<P, Q> for Descriptor<P> where
P: MiniscriptKey,
Q: MiniscriptKey,
[src]
P: MiniscriptKey,
Q: MiniscriptKey,
type Output = Descriptor<Q>
The associated output type. This must be Self
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]
&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>,
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.
pub 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]
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Self::Output where
Fpk: FnMut(&P) -> Q,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> <Q as MiniscriptKey>::Hash,
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
[src]
P: MiniscriptKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
pub fn translate_pk1<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<Self::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
[src]
&self,
translatefpk: Fpk
) -> Result<Self::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
pub fn translate_pk1_infallible<Fpk>(&self, translatefpk: Fpk) -> Self::Output where
Fpk: FnMut(&P) -> Q,
[src]
Fpk: FnMut(&P) -> Q,
impl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
T: TranslatePk<P, Q>,
Q: MiniscriptKey,
[src]
P: MiniscriptKey<Hash = P>,
T: TranslatePk<P, Q>,
Q: MiniscriptKey,
pub fn translate_pk2<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<Self::Output, E> where
Fpk: Fn(&P) -> Result<Q, E>,
[src]
&self,
translatefpk: Fpk
) -> Result<Self::Output, E> where
Fpk: Fn(&P) -> Result<Q, E>,
pub fn translate_pk2_infallible<Fpk>(&self, translatefpk: Fpk) -> Self::Output where
Fpk: Fn(&P) -> Q,
[src]
Fpk: Fn(&P) -> Q,
impl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = Hash>,
[src]
P: MiniscriptKey + ToPublicKey,
T: TranslatePk<P, Q>,
Q: MiniscriptKey<Hash = Hash>,
pub fn translate_pk3<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<Self::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
[src]
&self,
translatefpk: Fpk
) -> Result<Self::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
pub fn translate_pk3_infallible<Fpk>(&self, translatefpk: Fpk) -> Self::Output where
Fpk: FnMut(&P) -> Q,
[src]
Fpk: FnMut(&P) -> Q,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,