Introduction
Getting Started
1.
Installation
2.
First steps with Alloy
Migrating from ethers-rs
3.
Reference
4.
Conversions
Building with Alloy
5.
Basic building blocks
❱
5.1.
Using big numbers
5.2.
Basic hash and address types
5.3.
Common conversions
5.4.
Creating instances
5.5.
Comparisons and equivalence
6.
Connecting to a blockchain
❱
6.1.
Setting up a Provider
6.2.
Creating an HTTP provider
6.3.
Creating a WS provider
6.4.
Creating an IPC provider
7.
Understanding Fillers
8.
Queries
9.
Transactions
❱
9.1.
Using the Transaction Builder
9.2.
Sending an EIP-1559 transaction
9.3.
Sending a legacy transaction
9.4.
Sending an EIP-4844 transaction
9.5.
Sending an EIP-7702 transaction
9.6.
Using access lists
Highlights
10.
The sol! procedural macro
11.
The transaction lifecycle
Examples
12.
Big numbers
❱
12.1.
Comparison and equivalence
12.2.
Conversion
12.3.
Creating instances
12.4.
Math operations
12.5.
Math utilities
13.
Contracts
❱
13.1.
Deploy from artifact
13.2.
Deploy from bytecode
13.3.
Deploy from contract
13.4.
Interact with ABI
13.5.
Interact with contract instance
13.6.
JSON-RPC error decoding
13.7.
Handling unknown return types
14.
Fillers
❱
14.1.
Gas estimation filler
14.2.
Nonce management filler
14.3.
Recommended fillers
14.4.
Wallet management filler
15.
Layers
❱
15.1.
Hyper transport layer
15.2.
Request / response logging layer
15.3.
Retry-backoff layer
16.
Node bindings
❱
16.1.
Deploy contract on local Anvil instance
16.2.
Fork instance on Anvil
16.3.
Fork provider on Anvil
16.4.
Local instance on Anvil
16.5.
Local provider on Anvil
16.6.
Local provider on Geth
16.7.
Local provider on Reth
16.8.
Mock WETH balance with Anvil
17.
Primitives
❱
17.1.
Bytes and address types
17.2.
Hashing functions
18.
Providers
❱
18.1.
Builder
18.2.
Builtin
18.3.
HTTP
18.4.
HTTP with authentication
18.5.
WS
18.6.
WS with authentication
18.7.
IPC
19.
Queries
❱
19.1.
Query contract storage
19.2.
Query contract deployed bytecode
19.3.
Query logs
20.
The sol! macro
❱
20.1.
Contract
20.2.
Decode returns
20.3.
Events and errors
20.4.
Structs and enums
20.5.
User defined types
21.
Subscriptions
❱
21.1.
Watch and poll for contract event logs
21.2.
Subscribe and watch blocks
21.3.
Subscribe and listen for specific contract event logs
21.4.
Subscribe and listen for all contract event logs
21.5.
Subscribe and listen to pending transactions in the public mempool
21.6.
Event multiplexer
22.
Transactions
❱
22.1.
Decode input
22.2.
Encode and decode EIP-1559 transaction
22.3.
Get gas price in USD
22.4.
Sign and send a raw transaction
22.5.
Send transaction with access list
22.6.
Send EIP-1559 transaction
22.7.
Send EIP-4844 transaction
22.8.
Send EIP-7702 transaction
22.9.
Send legacy transaction
22.10.
Send private transaction using Flashbots Protect
22.11.
Trace call
22.12.
Trace transaction
22.13.
Transfer ERC20 token
22.14.
Transfer ETH
23.
Wallets
❱
23.1.
AWS signer
23.2.
Ledger signer
23.3.
Private key signer
23.4.
Mnemonic signer
23.5.
Sign message
23.6.
Verify message
23.7.
Sign permit hash
23.8.
Trezor signer
23.9.
Yubi signer
23.10.
Keystore signer
23.11.
Create keystore
24.
Advanced
❱
24.1.
Using AnyNetwork
24.2.
Decoding with json_abi
24.3.
Encoding with dyn_abi
24.4.
Static encoding with sol!
24.5.
Using foundry-fork-db
24.6.
Wrapping Provider trait over reth-db
25.
Comparison
❱
25.1.
Compare block headers between providers
25.2.
Compare pending transactions between providers
Appendix
26.
Help us improve Alloy
Light
Rust
Coal
Navy
Ayu
Alloy Book
Contracts
Deploy from artifact
Deploy from bytecode
Deploy from contract
Interact with ABI
Interact with contract instance
Handling unknown return types