Struct tapyrus::util::bip32::ExtendedPubKey
source · pub struct ExtendedPubKey {
pub network: Network,
pub depth: u8,
pub parent_fingerprint: Fingerprint,
pub child_number: ChildNumber,
pub public_key: PublicKey,
pub chain_code: ChainCode,
}
Expand description
Extended public key
Fields§
§network: Network
The network this key is to be used on
depth: u8
How many derivations this key is from the master (which is 0)
parent_fingerprint: Fingerprint
Fingerprint of the parent key
child_number: ChildNumber
Child number of the key used to derive from parent (0 for master)
public_key: PublicKey
Public key
chain_code: ChainCode
Chain code
Implementations§
source§impl ExtendedPubKey
impl ExtendedPubKey
sourcepub fn from_private<C: Signing>(
secp: &Secp256k1<C>,
sk: &ExtendedPrivKey
) -> ExtendedPubKey
pub fn from_private<C: Signing>( secp: &Secp256k1<C>, sk: &ExtendedPrivKey ) -> ExtendedPubKey
Derives a public key from a private key
sourcepub fn derive_pub<C: Verification, P: AsRef<[ChildNumber]>>(
&self,
secp: &Secp256k1<C>,
path: &P
) -> Result<ExtendedPubKey, Error>
pub fn derive_pub<C: Verification, P: AsRef<[ChildNumber]>>( &self, secp: &Secp256k1<C>, path: &P ) -> Result<ExtendedPubKey, Error>
Attempts to derive an extended public key from a path.
The path
argument can be both of type DerivationPath
or Vec<ChildNumber>
.
sourcepub fn ckd_pub_tweak(
&self,
i: ChildNumber
) -> Result<(PrivateKey, ChainCode), Error>
pub fn ckd_pub_tweak( &self, i: ChildNumber ) -> Result<(PrivateKey, ChainCode), Error>
Compute the scalar tweak added to this key to get a child key
sourcepub fn ckd_pub<C: Verification>(
&self,
secp: &Secp256k1<C>,
i: ChildNumber
) -> Result<ExtendedPubKey, Error>
pub fn ckd_pub<C: Verification>( &self, secp: &Secp256k1<C>, i: ChildNumber ) -> Result<ExtendedPubKey, Error>
Public->Public child key derivation
sourcepub fn identifier(&self) -> XpubIdentifier
pub fn identifier(&self) -> XpubIdentifier
Returns the HASH160 of the chaincode
sourcepub fn fingerprint(&self) -> Fingerprint
pub fn fingerprint(&self) -> Fingerprint
Returns the first four bytes of the identifier
Trait Implementations§
source§impl Clone for ExtendedPubKey
impl Clone for ExtendedPubKey
source§fn clone(&self) -> ExtendedPubKey
fn clone(&self) -> ExtendedPubKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ExtendedPubKey
impl Debug for ExtendedPubKey
source§impl Display for ExtendedPubKey
impl Display for ExtendedPubKey
source§impl FromStr for ExtendedPubKey
impl FromStr for ExtendedPubKey
source§impl Hash for ExtendedPubKey
impl Hash for ExtendedPubKey
source§impl Ord for ExtendedPubKey
impl Ord for ExtendedPubKey
source§fn cmp(&self, other: &ExtendedPubKey) -> Ordering
fn cmp(&self, other: &ExtendedPubKey) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for ExtendedPubKey
impl PartialEq for ExtendedPubKey
source§fn eq(&self, other: &ExtendedPubKey) -> bool
fn eq(&self, other: &ExtendedPubKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ExtendedPubKey
impl PartialOrd for ExtendedPubKey
source§fn partial_cmp(&self, other: &ExtendedPubKey) -> Option<Ordering>
fn partial_cmp(&self, other: &ExtendedPubKey) -> Option<Ordering>
1.0.0 · source§fn 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 moreimpl Copy for ExtendedPubKey
impl Eq for ExtendedPubKey
impl StructuralEq for ExtendedPubKey
impl StructuralPartialEq for ExtendedPubKey
Auto Trait Implementations§
impl RefUnwindSafe for ExtendedPubKey
impl Send for ExtendedPubKey
impl Sync for ExtendedPubKey
impl Unpin for ExtendedPubKey
impl UnwindSafe for ExtendedPubKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,
Casts the value.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,
Casts the value.