Struct bdk::descriptor::derived::DerivedDescriptorKey
source · [−]pub struct DerivedDescriptorKey<'s>(_, _);
Expand description
Extended DescriptorPublicKey
that has been derived
Derived keys are guaranteed to never contain wildcards of any kind
Implementations
sourceimpl<'s> DerivedDescriptorKey<'s>
impl<'s> DerivedDescriptorKey<'s>
sourcepub fn new(
key: DescriptorPublicKey,
secp: &'s Secp256k1<All>
) -> DerivedDescriptorKey<'s>
pub fn new(
key: DescriptorPublicKey,
secp: &'s Secp256k1<All>
) -> DerivedDescriptorKey<'s>
Construct a new derived key
Panics if the key is wildcard
Methods from Deref<Target = DescriptorPublicKey>
sourcepub fn master_fingerprint(&self) -> Fingerprint
pub fn master_fingerprint(&self) -> Fingerprint
The fingerprint of the master key associated with this key, 0x00000000
if none.
sourcepub fn full_derivation_path(&self) -> DerivationPath
pub fn full_derivation_path(&self) -> DerivationPath
Full path, from the master key
For wildcard keys this will return the path up to the wildcard, so you can get full paths by appending one additional derivation step, according to the wildcard type (hardened or normal)
sourcepub fn is_deriveable(&self) -> bool
pub fn is_deriveable(&self) -> bool
Whether or not the key has a wildcards
sourcepub fn derive_public_key<C>(
&self,
secp: &Secp256k1<C>
) -> Result<PublicKey, ConversionError>where
C: Verification,
pub fn derive_public_key<C>(
&self,
secp: &Secp256k1<C>
) -> Result<PublicKey, ConversionError>where
C: Verification,
Computes the public key corresponding to this descriptor key.
When deriving from an XOnlyPublicKey, it adds the default 0x02 y-coordinate
and returns the obtained full bitcoin::PublicKey
. All BIP32 derivations
always return a compressed key
Will return an error if the descriptor key has any hardened derivation steps in its path, or if the key has any wildcards.
To ensure there are no wildcards, call .derive(0)
or similar;
to avoid hardened derivation steps, start from a DescriptorSecretKey
and call as_public
, or call TranslatePk2::translate_pk2
with
some function which has access to secret key data.
Trait Implementations
sourceimpl<'s> Clone for DerivedDescriptorKey<'s>
impl<'s> Clone for DerivedDescriptorKey<'s>
sourcefn clone(&self) -> DerivedDescriptorKey<'s>
fn clone(&self) -> DerivedDescriptorKey<'s>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'s> Debug for DerivedDescriptorKey<'s>
impl<'s> Debug for DerivedDescriptorKey<'s>
sourceimpl<'s> Deref for DerivedDescriptorKey<'s>
impl<'s> Deref for DerivedDescriptorKey<'s>
type Target = DescriptorPublicKey
type Target = DescriptorPublicKey
The resulting type after dereferencing.
sourceimpl<'s> Display for DerivedDescriptorKey<'s>
impl<'s> Display for DerivedDescriptorKey<'s>
sourceimpl<'s> Hash for DerivedDescriptorKey<'s>
impl<'s> Hash for DerivedDescriptorKey<'s>
sourceimpl<'s> MiniscriptKey for DerivedDescriptorKey<'s>
impl<'s> MiniscriptKey for DerivedDescriptorKey<'s>
type Hash = DerivedDescriptorKey<'s>
type Hash = DerivedDescriptorKey<'s>
The associated Hash type with the publicKey
sourcefn to_pubkeyhash(&self) -> Self::Hash
fn to_pubkeyhash(&self) -> Self::Hash
Converts an object to PublicHash
sourcefn is_uncompressed(&self) -> bool
fn is_uncompressed(&self) -> bool
Check if the publicKey is uncompressed. The default implementation returns false Read more
sourcefn is_x_only_key(&self) -> bool
fn is_x_only_key(&self) -> bool
Check if the publicKey is x-only. The default implementation returns false Read more
sourceimpl<'s> Ord for DerivedDescriptorKey<'s>
impl<'s> Ord for DerivedDescriptorKey<'s>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'s> PartialEq<DerivedDescriptorKey<'s>> for DerivedDescriptorKey<'s>
impl<'s> PartialEq<DerivedDescriptorKey<'s>> for DerivedDescriptorKey<'s>
sourceimpl<'s> PartialOrd<DerivedDescriptorKey<'s>> for DerivedDescriptorKey<'s>
impl<'s> PartialOrd<DerivedDescriptorKey<'s>> for DerivedDescriptorKey<'s>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'s> ToPublicKey for DerivedDescriptorKey<'s>
impl<'s> ToPublicKey for DerivedDescriptorKey<'s>
sourcefn to_public_key(&self) -> PublicKey
fn to_public_key(&self) -> PublicKey
Converts an object to a public key
sourcefn to_x_only_pubkey(&self) -> XOnlyPublicKey
fn to_x_only_pubkey(&self) -> XOnlyPublicKey
Convert an object to x-only pubkey
sourcefn hash_to_hash160(hash: &Self::Hash) -> Hash
fn hash_to_hash160(hash: &Self::Hash) -> Hash
Converts a hashed version of the public key to a hash160
hash. Read more
impl<'s> Eq for DerivedDescriptorKey<'s>
Auto Trait Implementations
impl<'s> RefUnwindSafe for DerivedDescriptorKey<'s>
impl<'s> Send for DerivedDescriptorKey<'s>
impl<'s> Sync for DerivedDescriptorKey<'s>
impl<'s> Unpin for DerivedDescriptorKey<'s>
impl<'s> UnwindSafe for DerivedDescriptorKey<'s>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more