pub struct ExtendedPublicKey { /* private fields */ }Expand description
A BIP-32 extended public key for watch-only wallets.
Supports normal (non-hardened) child derivation only. Hardened derivation requires the private key.
Implementations§
Source§impl ExtendedPublicKey
impl ExtendedPublicKey
Sourcepub fn public_key_bytes(&self) -> &[u8; 33]
pub fn public_key_bytes(&self) -> &[u8; 33]
Get the compressed public key (33 bytes).
Sourcepub fn chain_code(&self) -> &[u8; 32]
pub fn chain_code(&self) -> &[u8; 32]
Get the chain code.
Sourcepub fn parent_fingerprint(&self) -> &[u8; 4]
pub fn parent_fingerprint(&self) -> &[u8; 4]
Get the parent fingerprint.
Sourcepub fn child_index(&self) -> u32
pub fn child_index(&self) -> u32
Get the child index.
Sourcepub fn derive_child_normal(&self, index: u32) -> Result<Self, SignerError>
pub fn derive_child_normal(&self, index: u32) -> Result<Self, SignerError>
Derive a normal (non-hardened) child public key.
Only normal derivation (index < 2^31) is supported. Hardened derivation requires the private key.
Sourcepub fn from_xpub(xpub: &str) -> Result<Self, SignerError>
pub fn from_xpub(xpub: &str) -> Result<Self, SignerError>
Deserialize an xpub Base58Check string.
Sourcepub fn p2wpkh_address(&self, hrp: &str) -> Result<String, SignerError>
pub fn p2wpkh_address(&self, hrp: &str) -> Result<String, SignerError>
Derive a P2WPKH (SegWit) address from this public key.
Uses Bech32 encoding: bc1q... for mainnet.
§Arguments
hrp— Human-readable part:"bc"for mainnet,"tb"for testnet
Sourcepub fn p2tr_address(&self, hrp: &str) -> Result<String, SignerError>
pub fn p2tr_address(&self, hrp: &str) -> Result<String, SignerError>
Derive a P2TR (Taproot) address from this public key.
Extracts the x-only public key (drops the prefix byte) and encodes
as a Bech32m bc1p... address.
§Arguments
hrp— Human-readable part:"bc"for mainnet,"tb"for testnet
Trait Implementations§
Source§impl Clone for ExtendedPublicKey
impl Clone for ExtendedPublicKey
Source§fn clone(&self) -> ExtendedPublicKey
fn clone(&self) -> ExtendedPublicKey
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for ExtendedPublicKey
impl RefUnwindSafe for ExtendedPublicKey
impl Send for ExtendedPublicKey
impl Sync for ExtendedPublicKey
impl Unpin for ExtendedPublicKey
impl UnsafeUnpin for ExtendedPublicKey
impl UnwindSafe for ExtendedPublicKey
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