Struct Xpriv
pub struct Xpriv {
pub network: NetworkKind,
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: NetworkKindThe 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 Xpriv
impl Xpriv
pub fn new_master(
network: impl Into<NetworkKind>,
seed: &[u8],
) -> Result<Xpriv, Error>
pub fn new_master( network: impl Into<NetworkKind>, seed: &[u8], ) -> Result<Xpriv, 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<Xpriv, Error>
pub fn derive_priv<C, P>( &self, secp: &Secp256k1<C>, path: &P, ) -> Result<Xpriv, 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 decode(data: &[u8]) -> Result<Xpriv, Error>
pub fn decode(data: &[u8]) -> Result<Xpriv, Error>
Decoding extended private key from binary data according to BIP 32
pub fn identifier<C>(&self, secp: &Secp256k1<C>) -> XKeyIdentifierwhere
C: Signing,
pub fn identifier<C>(&self, secp: &Secp256k1<C>) -> XKeyIdentifierwhere
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<'de> Deserialize<'de> for Xpriv
impl<'de> Deserialize<'de> for Xpriv
§fn deserialize<D>(
deserializer: D,
) -> Result<Xpriv, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Xpriv, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl InnerXKey for Xpriv
impl InnerXKey for Xpriv
§fn xkey_fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
fn xkey_fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
§fn can_derive_hardened() -> bool
fn can_derive_hardened() -> bool
§impl InnerXKey for Xpriv
impl InnerXKey for Xpriv
§fn xkey_fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
fn xkey_fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
§fn can_derive_hardened() -> bool
fn can_derive_hardened() -> bool
§impl Serialize for Xpriv
impl Serialize for Xpriv
§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 Xpriv
impl Eq for Xpriv
impl StructuralPartialEq for Xpriv
Auto Trait Implementations§
impl Freeze for Xpriv
impl RefUnwindSafe for Xpriv
impl Send for Xpriv
impl Sync for Xpriv
impl Unpin for Xpriv
impl UnwindSafe for Xpriv
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§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,
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<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.