Type Alias bitcoin::bip32::ExtendendPrivKey
source · pub type ExtendendPrivKey = Xpriv;
Expand description
The old name for xpriv, extended public key (with a released typo in it).
Aliased Type§
struct ExtendendPrivKey {
pub network: NetworkKind,
pub depth: u8,
pub parent_fingerprint: Fingerprint,
pub child_number: ChildNumber,
pub private_key: SecretKey,
pub chain_code: ChainCode,
}
Fields§
§network: NetworkKind
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§
source§impl Xpriv
impl Xpriv
sourcepub 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
sourcepub fn to_priv(self) -> PrivateKey
pub fn to_priv(self) -> PrivateKey
Constructs ECDSA compressed private key matching internal secret key representation.
sourcepub fn to_keypair<C: Signing>(self, secp: &Secp256k1<C>) -> Keypair
pub fn to_keypair<C: Signing>(self, secp: &Secp256k1<C>) -> Keypair
Constructs BIP340 keypair for Schnorr signatures and Taproot use matching the internal secret key representation.
sourcepub fn derive_priv<C: Signing, P: AsRef<[ChildNumber]>>(
&self,
secp: &Secp256k1<C>,
path: &P
) -> Result<Xpriv, Error>
pub fn derive_priv<C: Signing, P: AsRef<[ChildNumber]>>( &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>
.
sourcepub 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
sourcepub fn identifier<C: Signing>(&self, secp: &Secp256k1<C>) -> XKeyIdentifier
pub fn identifier<C: Signing>(&self, secp: &Secp256k1<C>) -> XKeyIdentifier
Returns the HASH160 of the public key belonging to the xpriv
sourcepub fn fingerprint<C: Signing>(&self, secp: &Secp256k1<C>) -> Fingerprint
pub fn fingerprint<C: Signing>(&self, secp: &Secp256k1<C>) -> Fingerprint
Returns the first four bytes of the identifier