Ethers-rs is a comprehensive library for Ethereum and Celo, written in Rust. It aims to provide a rich set of tools and features to interact with Ethereum-compatible blockchains. Despite its current deprecation in favor of Alloy, it remains a robust resource for Rust developers working with blockchain technology.
Ethers-rs offers a complete suite for Ethereum development, including:
To get started with ethers-rs, add it to your Cargo.toml
:
Detailed documentation is available on docs.rs and the online book. Examples can be found in the /examples
folder of the repository.
Ethers-rs supports multiple Ethereum-compatible chains. For chains not supporting EIP-2718 Typed Transactions, enable the legacy
feature flag:
Ethers-rs provides abigen support for Polygon and the Mumbai test network. Set the POLYGONSCAN_API_KEY
environment variable to utilize this feature.
For Avalanche and the Fuji test network, ethers-rs includes abigen support. Configure the SNOWTRACE_API_KEY
environment variable for optimal functionality.
Enable Optimism support via the optimism
feature flag:
Optimism introduces new transaction types requiring additional fields:
sourceHash
mint
isSystemTx
Ethers-rs supports Celo through the celo
feature flag:
Celo transactions include unique fields:
fee_currency
gateway_fee_recipient
gateway_fee
Ethers-rs is equipped with various other functionalities:
ws
feature flag.ipc
feature flag.rustls
and openssl
feature flags for secure connections.Enable Websockets support:
Enable IPC support:
For secure connections to HTTPS endpoints, enable either rustls
or openssl
:
While ethers-rs can compile to WASM, there are no official plans for a JS/TS-accessible library. If issues arise, users are encouraged to open an issue on GitHub. Similarly, for FFI bindings, ethers-rs can compile to C library formats, but official support is not planned.
Explore the potential of ethers-rs for your Rust-based blockchain applications, leveraging its extensive features and multi-chain support to build and interact with decentralized applications.