[−][src]Struct bitcoin::util::privkey::Privkey
A Bitcoin ECDSA private key
Fields
compressed: bool
Whether this private key represents a compressed address
network: Network
The network on which this key should be used
key: SecretKey
The actual ECDSA key
Methods
impl Privkey
[src]
pub fn from_secret_key(
key: SecretKey,
compressed: bool,
network: Network
) -> Privkey
[src]
key: SecretKey,
compressed: bool,
network: Network
) -> Privkey
Creates a Privkey
from a raw secp256k1 secret key
pub fn public_key<C: Signing>(&self, secp: &Secp256k1<C>) -> PublicKey
[src]
Computes the public key as supposed to be used with this secret
pub fn to_address<C: Signing>(&self, secp: &Secp256k1<C>) -> Address
[src]
Converts a private key to a segwit address
pub fn to_legacy_address<C: Signing>(&self, secp: &Secp256k1<C>) -> Address
[src]
Converts a private key to a legacy (non-segwit) address
pub fn secret_key(&self) -> &SecretKey
[src]
Accessor for the underlying secp key
pub fn into_secret_key(self) -> SecretKey
[src]
Accessor for the underlying secp key that consumes the privkey
pub fn network(&self) -> Network
[src]
Accessor for the network type
pub fn is_compressed(&self) -> bool
[src]
Accessor for the compressed flag
pub fn fmt_wif(&self, fmt: &mut dyn Write) -> Result
[src]
Format the private key to WIF format.
pub fn to_wif(&self) -> String
[src]
Get WIF encoding of this private key.
pub fn from_wif(wif: &str) -> Result<Privkey, Error>
[src]
Parse WIF encoded private key.
Trait Implementations
impl Clone for Privkey
[src]
fn clone(&self) -> Privkey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Privkey
[src]
impl PartialEq<Privkey> for Privkey
[src]
impl Display for Privkey
[src]
impl Debug for Privkey
[src]
impl FromStr for Privkey
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,