pub struct ExtendedPrivKey {
pub network: Network,
pub depth: u8,
pub parent_fingerprint: Fingerprint,
pub child_number: ChildNumber,
pub private_key: PrivateKey,
pub chain_code: ChainCode,
}
Expand description
Extended private 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 (0 for master)
child_number: ChildNumber
Child number of the key used to derive from parent (0 for master)
private_key: PrivateKey
Private key
chain_code: ChainCode
Chain code
Implementations§
Source§impl ExtendedPrivKey
impl ExtendedPrivKey
Sourcepub fn new_master(
secp: &Secp256k1,
network: Network,
seed: &[u8],
) -> Result<ExtendedPrivKey, Error>
pub fn new_master( secp: &Secp256k1, network: Network, seed: &[u8], ) -> Result<ExtendedPrivKey, Error>
Construct a new master key from a seed value
Sourcepub fn derive_priv<P: AsRef<[ChildNumber]>>(
&self,
secp: &Secp256k1,
path: &P,
) -> Result<ExtendedPrivKey, Error>
pub fn derive_priv<P: AsRef<[ChildNumber]>>( &self, secp: &Secp256k1, path: &P, ) -> Result<ExtendedPrivKey, Error>
Attempts to derive an extended private key from a path.
The path
argument can be both of type DerivationPath
or Vec<ChildNumber>
.
Sourcepub fn ckd_priv(
&self,
secp: &Secp256k1,
i: ChildNumber,
) -> Result<ExtendedPrivKey, Error>
pub fn ckd_priv( &self, secp: &Secp256k1, i: ChildNumber, ) -> Result<ExtendedPrivKey, Error>
Private->Private child key derivation
Sourcepub fn decode(secp: &Secp256k1, data: &[u8]) -> Result<ExtendedPrivKey, Error>
pub fn decode(secp: &Secp256k1, data: &[u8]) -> Result<ExtendedPrivKey, Error>
Decoding extended private key from binary data according to BIP 32
Sourcepub fn identifier(&self, secp: &Secp256k1) -> XpubIdentifier
pub fn identifier(&self, secp: &Secp256k1) -> XpubIdentifier
Returns the HASH160 of the public key belonging to the xpriv
Sourcepub fn fingerprint(&self, secp: &Secp256k1) -> Fingerprint
pub fn fingerprint(&self, secp: &Secp256k1) -> Fingerprint
Returns the first four bytes of the identifier
Trait Implementations§
Source§impl Clone for ExtendedPrivKey
impl Clone for ExtendedPrivKey
Source§fn clone(&self) -> ExtendedPrivKey
fn clone(&self) -> ExtendedPrivKey
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 ExtendedPrivKey
impl Debug for ExtendedPrivKey
Source§impl Display for ExtendedPrivKey
impl Display for ExtendedPrivKey
Source§impl FromStr for ExtendedPrivKey
impl FromStr for ExtendedPrivKey
Source§impl PartialEq for ExtendedPrivKey
impl PartialEq for ExtendedPrivKey
impl Eq for ExtendedPrivKey
impl StructuralPartialEq for ExtendedPrivKey
Auto Trait Implementations§
impl Freeze for ExtendedPrivKey
impl RefUnwindSafe for ExtendedPrivKey
impl Send for ExtendedPrivKey
impl Sync for ExtendedPrivKey
impl Unpin for ExtendedPrivKey
impl UnwindSafe for ExtendedPrivKey
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