bb3a2fd27c
* release(core): 0.6.0 * release(providers): 0.6.0 * release(contract-abigen): 0.6.0 * release(contract-derive): 0.6.0 * release(derive-eip712): 0.2.0 * release(ethers-solc): 0.1.0 * release(contract): 0.6.0 * release(etherscan): 0.2.0 * release(signers): 0.6.0 * release(middleware): 0.6.0 * chore: update dev deps * refactor(core): move docs to readme * refactor(contract): move docs to readme * refactor(providers): move docs to readme * chore: bump ethers cargo toml * refactor(signers): move docs to readme * refactor(middleware): move docs to readme * fix(ethers): adjust re-exports to allow searching internal packages * docs: fix broken links we cannot use relative crate imports because the readmes are also imported by the parent crate * alias readmes to be accessible to ethers crate |
||
---|---|---|
.. | ||
ethers-derive-eip712 | ||
src | ||
Cargo.toml | ||
README.md |
README.md
Ethereum types, cryptography and utilities.
It is recommended to use the utils
, types
and abi
re-exports instead of
the core
module to simplify your imports._
This library provides type definitions for Ethereum's main datatypes along with other utilities for interacting with the Ethereum ecosystem
Signing an ethereum-prefixed message
Signing in Ethereum is done by first prefixing the message with
"\x19Ethereum Signed Message:\n" + message.length
, and then signing the hash
of the result.
# async fn foo() -> Result<(), Box<dyn std::error::Error>> {
use ethers::signers::{Signer, LocalWallet};
let message = "Some data";
let wallet = LocalWallet::new(&mut rand::thread_rng());
// Sign the message
let signature = wallet.sign_message(message).await?;
// Recover the signer from the message
let recovered = signature.recover(message)?;
assert_eq!(recovered, wallet.address());
# Ok(())
# }
Utilities
The crate provides utilities for launching local Ethereum testnets by using
ganache-cli
via the GanacheBuilder
struct.
Features
-
- ["eip712"] | Provides Eip712 trait for EIP-712 encoding of typed data for derived structs
ABI Encoding and Decoding
This crate re-exports the ethabi
crate's functions
under the abi
module, as well as the
secp256k1
and rand
crates for convenience.