[][src]Struct bitcoin::util::key::PrivateKey

pub struct PrivateKey {
    pub compressed: bool,
    pub network: Network,
    pub key: SecretKey,
}

A Bitcoin ECDSA private key

Fields

compressed: bool

Whether this private key should be serialized as compressed

network: Network

The network on which this key should be used

key: SecretKey

The actual ECDSA key

Methods

impl PrivateKey[src]

pub fn public_key<C: Signing>(&self, secp: &Secp256k1<C>) -> PublicKey[src]

Creates a public key from this private key

pub fn to_bytes(&self) -> Vec<u8>[src]

Serialize the private key to bytes

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<PrivateKey, Error>[src]

Parse WIF encoded private key.

Trait Implementations

impl Clone for PrivateKey[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<PrivateKey> for PrivateKey[src]

impl Eq for PrivateKey[src]

impl Copy for PrivateKey[src]

impl Display for PrivateKey[src]

impl Debug for PrivateKey[src]

impl Index<RangeFull> for PrivateKey[src]

type Output = [u8]

The returned type after indexing.

impl FromStr for PrivateKey[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Unpin for PrivateKey

impl Sync for PrivateKey

impl Send for PrivateKey

impl UnwindSafe for PrivateKey

impl RefUnwindSafe for PrivateKey

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]