[][src]Struct ethers_core::types::PrivateKey

pub struct PrivateKey(_);

A private key on Secp256k1

Implementations

impl PrivateKey[src]

pub fn new<R: Rng>(rng: &mut R) -> Self[src]

pub fn sign<S>(&self, message: S) -> Signature where
    S: AsRef<[u8]>, 
[src]

Sign arbitrary string data.

The data is UTF-8 encoded and enveloped the same way as with hash_message. The returned signed data's signature is in 'Electrum' notation, that is the recovery value v is either 27 or 28 (as opposed to the standard notation where v is either 0 or 1). This is important to consider when using this signature with other crates.

pub fn sign_transaction(
    &self,
    tx: TransactionRequest,
    chain_id: Option<u64>
) -> Result<Transaction, TxError>
[src]

RLP encodes and then signs the stransaction.

If no chain_id is provided, then EIP-155 is not used.

This will return an error if called if any of the nonce, gas_price or gas fields are not populated.

Panics

If tx.to is an ENS name. The caller MUST take care of name resolution before calling this function.

Methods from Deref<Target = SecretKey>

pub fn serialize(&self) -> [u8; 32]

pub fn inv(&self) -> SecretKey

Trait Implementations

impl Clone for PrivateKey[src]

impl Debug for PrivateKey[src]

impl Deref for PrivateKey[src]

type Target = SecretKey

The resulting type after dereferencing.

impl<'de> Deserialize<'de> for PrivateKey[src]

impl Eq for PrivateKey[src]

impl<'_> From<&'_ PrivateKey> for PublicKey[src]

fn from(src: &PrivateKey) -> PublicKey[src]

Gets the public address of a private key.

impl<'_> From<&'_ PrivateKey> for Address[src]

impl From<PrivateKey> for Address[src]

impl FromStr for PrivateKey[src]

type Err = SecpError

The associated error which can be returned from parsing.

impl PartialEq<PrivateKey> for PrivateKey[src]

impl Serialize for PrivateKey[src]

impl StructuralEq for PrivateKey[src]

impl StructuralPartialEq for PrivateKey[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,