Complete Ethereum & Celo library and wallet implementation in Rust. https://docs.rs/ethers
Go to file
Georgios Konstantopoulos ee03703ed4
feat: add get_block
2020-05-24 23:11:47 +03:00
.circleci add circleci 2020-05-24 21:58:01 +03:00
examples use builder pattern for txs 2020-05-24 21:34:56 +03:00
src feat: add get_block 2020-05-24 23:11:47 +03:00
.gitignore lock 2020-05-24 19:33:24 +03:00
Cargo.lock cleanup 2020-05-24 19:43:47 +03:00
Cargo.toml cleanup 2020-05-24 19:43:47 +03:00
README.md update readme 2020-05-24 21:56:10 +03:00

README.md

ethers.rs

Complete Ethereum wallet implementation and utilities in Rust (with WASM and FFI support).

Features

  • User friendly transaction APIs
  • Type-safe EIP-155 transactions
  • Event Monitoring
  • Deploy and interact with smart contracts
  • Type safe smart contract bindings
  • Hardware wallet support
  • ...

Examples

Sending a transaction with an offline key

use ethers::{types::TransactionRequest, HttpProvider, MainnetWallet};
use std::convert::TryFrom;

// connect to the network
let provider = HttpProvider::try_from("http://localhost:8545")?;

// create a wallet and connect it to the provider
let client = "15c42bf2987d5a8a73804a8ea72fb4149f88adf73e98fc3f8a8ce9f24fcb7774"
    .parse::<MainnetWallet>()?
    .connect(&provider);

// craft the transaction using the builder pattern
let tx = TransactionRequest::new()
    .send_to_str("986eE0C8B91A58e490Ee59718Cca41056Cf55f24")?
    .value(10000);

// send it!
let tx = client.sign_and_send_transaction(tx, None).await?;

// get the mined tx
let tx = client.get_transaction(tx.hash).await?;

println!("{}", serde_json::to_string(&tx)?);