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: NetworkThe network this key is to be used on
depth: u8How many derivations this key is from the master (which is 0)
parent_fingerprint: FingerprintFingerprint of the parent key (0 for master)
child_number: ChildNumberChild number of the key used to derive from parent (0 for master)
private_key: SecretKeyPrivate key
chain_code: ChainCodeChain 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<'de> Deserialize<'de> for ExtendedPrivKey
impl<'de> Deserialize<'de> for ExtendedPrivKey
§fn deserialize<D>(
deserializer: D,
) -> Result<ExtendedPrivKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ExtendedPrivKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Display for ExtendedPrivKey
impl Display for ExtendedPrivKey
§impl FromStr for ExtendedPrivKey
impl FromStr for ExtendedPrivKey
§impl GetKey for ExtendedPrivKey
impl GetKey for ExtendedPrivKey
§type Error = GetKeyError
type Error = GetKeyError
§fn get_key<C>(
&self,
key_request: KeyRequest,
secp: &Secp256k1<C>,
) -> Result<Option<PrivateKey>, <ExtendedPrivKey as GetKey>::Error>where
C: Signing,
fn get_key<C>(
&self,
key_request: KeyRequest,
secp: &Secp256k1<C>,
) -> Result<Option<PrivateKey>, <ExtendedPrivKey as GetKey>::Error>where
C: Signing,
key_request. Read more§impl PartialEq for ExtendedPrivKey
impl PartialEq for ExtendedPrivKey
§impl Serialize for ExtendedPrivKey
impl Serialize for ExtendedPrivKey
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
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<T> AnySync for T
impl<T> AnySync for T
§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,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.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<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
§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.