Installation
Alloy consists of a number of crates that provide a range of functionality essential for interfacing with any Ethereum-based blockchain.
The easiest way to get started is to add the alloy crate from the command-line using Cargo:
cargo add alloyAlternatively, you can add the following to your Cargo.toml file:
alloy = "2.1.1"For a more fine-grained dependency, use the alloy crate with task-specific features or depend on
the individual crate that owns the API. See how Alloy fits together
and the feature flag reference before disabling defaults.
After alloy is added as a dependency you can now import alloy as follows:
use alloy::{
network::EthereumWallet,
node_bindings::Anvil,
primitives::U256,
providers::ProviderBuilder,
signers::local::PrivateKeySigner,
sol,
};