Struct PrivateKey
pub struct PrivateKey {
pub compressed: bool,
pub network: Network,
pub inner: SecretKey,
}
Expand description
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
inner: SecretKey
The actual ECDSA key
Implementations§
§impl PrivateKey
impl PrivateKey
pub fn new(key: SecretKey, network: Network) -> PrivateKey
pub fn new(key: SecretKey, network: Network) -> PrivateKey
Constructs compressed ECDSA private key from the provided generic Secp256k1 private key and the specified network
pub fn new_uncompressed(key: SecretKey, network: Network) -> PrivateKey
pub fn new_uncompressed(key: SecretKey, network: Network) -> PrivateKey
Constructs uncompressed (legacy) ECDSA private key from the provided generic Secp256k1 private key and the specified network
pub fn public_key<C>(&self, secp: &Secp256k1<C>) -> PublicKeywhere
C: Signing,
pub fn public_key<C>(&self, secp: &Secp256k1<C>) -> PublicKeywhere
C: Signing,
Creates a public key from this private key
pub fn from_slice(data: &[u8], network: Network) -> Result<PrivateKey, Error>
pub fn from_slice(data: &[u8], network: Network) -> Result<PrivateKey, Error>
Deserialize a private key from a slice
pub fn fmt_wif(&self, fmt: &mut dyn Write) -> Result<(), Error>
pub fn fmt_wif(&self, fmt: &mut dyn Write) -> Result<(), Error>
Format the private key to WIF format.
pub fn from_wif(wif: &str) -> Result<PrivateKey, Error>
pub fn from_wif(wif: &str) -> Result<PrivateKey, Error>
Parse WIF encoded private key.
Trait Implementations§
§impl Clone for PrivateKey
impl Clone for PrivateKey
§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for PrivateKey
impl Debug for PrivateKey
§impl Display for PrivateKey
impl Display for PrivateKey
§impl FromStr for PrivateKey
impl FromStr for PrivateKey
§impl Index<RangeFull> for PrivateKey
impl Index<RangeFull> for PrivateKey
§impl PartialEq for PrivateKey
impl PartialEq for PrivateKey
impl Copy for PrivateKey
impl Eq for PrivateKey
impl StructuralPartialEq for PrivateKey
Auto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations§
§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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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
Compare self to
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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key
and return true
if they are equal.§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request