Struct ExtendedPrivKey
pub struct ExtendedPrivKey {
pub network: Network,
pub depth: u8,
pub parent_fingerprint: Fingerprint,
pub child_number: ChildNumber,
pub private_key: SecretKey,
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: SecretKey
Private key
chain_code: ChainCode
Chain code
Implementations§
§impl ExtendedPrivKey
impl ExtendedPrivKey
pub fn new_master(
network: Network,
seed: &[u8],
) -> Result<ExtendedPrivKey, Error>
pub fn new_master( network: Network, seed: &[u8], ) -> Result<ExtendedPrivKey, Error>
Construct a new master key from a seed value
pub fn to_priv(self) -> PrivateKey
pub fn to_priv(self) -> PrivateKey
Constructs ECDSA compressed private key matching internal secret key representation.
pub fn to_keypair<C>(self, secp: &Secp256k1<C>) -> KeyPairwhere
C: Signing,
pub fn to_keypair<C>(self, secp: &Secp256k1<C>) -> KeyPairwhere
C: Signing,
Constructs BIP340 keypair for Schnorr signatures and Taproot use matching the internal secret key representation.
pub fn derive_priv<C, P>(
&self,
secp: &Secp256k1<C>,
path: &P,
) -> Result<ExtendedPrivKey, Error>
pub fn derive_priv<C, P>( &self, secp: &Secp256k1<C>, 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>
.
pub fn ckd_priv<C>(
&self,
secp: &Secp256k1<C>,
i: ChildNumber,
) -> Result<ExtendedPrivKey, Error>where
C: Signing,
pub fn ckd_priv<C>(
&self,
secp: &Secp256k1<C>,
i: ChildNumber,
) -> Result<ExtendedPrivKey, Error>where
C: Signing,
Private->Private child key derivation
pub fn decode(data: &[u8]) -> Result<ExtendedPrivKey, Error>
pub fn decode(data: &[u8]) -> Result<ExtendedPrivKey, Error>
Decoding extended private key from binary data according to BIP 32
pub fn identifier<C>(&self, secp: &Secp256k1<C>) -> XpubIdentifierwhere
C: Signing,
pub fn identifier<C>(&self, secp: &Secp256k1<C>) -> XpubIdentifierwhere
C: Signing,
Returns the HASH160 of the public key belonging to the xpriv
pub fn fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
pub fn fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
Returns the first four bytes of the identifier
Trait Implementations§
§impl Clone for ExtendedPrivKey
impl Clone for ExtendedPrivKey
§fn clone(&self) -> ExtendedPrivKey
fn clone(&self) -> ExtendedPrivKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ExtendedPrivKey
impl Debug for ExtendedPrivKey
§impl Display for ExtendedPrivKey
impl Display for ExtendedPrivKey
§impl FromStr for ExtendedPrivKey
impl FromStr for ExtendedPrivKey
§impl PartialEq for ExtendedPrivKey
impl PartialEq for ExtendedPrivKey
impl Copy 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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request