Crates.io | cbrzn-ethers-core |
lib.rs | cbrzn-ethers-core |
version | 1.0.2 |
source | src |
created_at | 2023-02-27 16:46:04.388757 |
updated_at | 2023-02-27 16:46:04.388757 |
description | Core structures for the ethers-rs crate |
homepage | https://docs.rs/ethers |
repository | https://github.com/gakonst/ethers-rs |
max_upload_size | |
id | 796210 |
size | 1,019,262 |
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 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(())
# }
The crate provides utilities for launching local Ethereum testnets by using
ganache-cli
via the GanacheBuilder
struct.
This crate re-exports the ethabi
crate's functions
under the abi
module, as well as the
secp256k1
and rand
crates for convenience.