Introduction

Welcome to the Rust Ethereum book, where we'll go through examples of how to interact with Ethereum using ethers-rs.

We assume familiarity with Ethereum's mechanics such as:

  • Deploying a contract & interacting with it
  • Sending funds across accounts
  • Signing messages and recovering their sender

Installing Ethers-rs

First create a new Rust project:

$ cargo new ethers-hello-world && cd ethers-hello-world

Edit your Cargo.toml and insert the following dependency:

[dependencies]

ethers = { git = "https://github.com/gakonst/ethers-rs" }

Tests require the following installed:

  1. solc. We also recommend using solc-select for more flexibility.
  2. ganache-cli

In addition, it is recommended that you set the ETHERSCAN_API_KEY environment variable for the abigen via Etherscan tests. You can get one here.