Alloy Series: Installation
Installation process of alloy and brief description.
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
alloy
crate from the command-line using Cargo:
cargo add alloy
- Alternatively, you can add the following to your
Cargo.toml
file
alloy = "1.0"
- For more fine-grained control over the features you wish to include, you can add the individual crates to your
Cargo.toml
file, or use thealloy
crate with the features you need. - After
alloy
is added as a dependency you can now importalloy
as follows:
use alloy::{
network::EthereumWallet,
node_bindings::Anvil,
primitives::U256,
providers::ProviderBuilder,
signers::local::PrivateKeySigner,
sol
}
Features
- The
alloy
meta-crate defines a number of feature-flags:
Default
std
reqwest
alloy-core/default
essentials
Essentials
contract
provider-http
rpc-types
signer-local
Full
consensus
eips
essentials
k256
kzg
network
provider-ws
provider-ipc
provider-trace-api
provider-txpool-api
provider-debug-api
provider-anvil-api
pubsub
- By default
alloy
usesreqwest
HTTP client. - Alternatively one can swithc to
hyper
.
Crates
alloy
-> Meta-crate for the entire project, includingalloy-core
aloy-consensus
-> Ethereum consensus interfacealloy-contract
-> Interact with on-chain contractsalloy-eips
-> Ethereum Improvement Proposals (EIP) implementationsalloy-genesis
-> Ethereum genesis file definitions.alloy-json-rpc
-> Core data types for JSON-RPC 2.0 clientsalloy-network
-> Network abstraction for RPC typesalloy-network-primitives
-> Primitive types for the network abstraction.
alloy-node-bindings
-> Etehreum execution layer client bindingsalloy-provider
-> Interface with an Ethereum blockchain.alloy-pubsub
-> Ethereum JSON-RPC publish-subscribe tower service and type definitionsalloy-rpc-client
-> Low-level Ethereum JSON-RPC client implementationalloy-rpc-types
-> Meta-crate for all Ethereum JSON-RPC typesalloy-rpc-types-admin
-> Types for theadmin
Ethereum JSON-RPC namespacealloy-rpc-types-anvil
-> Types for theAnvil
development node's Ethereum JSON-RPC namespace.alloy-rpc-types-engine
-> Types for theengine
Ethereum JSON-RPC namespacealloy-rpc-types-eth
-> Types for theeth
Ethereum JSON-RPC namespacealloy-rpc-types-mev
-> Types for the MEV bundle JSON-RPC namespacealloy-rpc-types-trace
-> Types fooor thetrace
Ethereum JSON-RPC namespacealloy-rpc-types-txpool
-> Types for thetxpool
Ethereum JSON-RPC namespace
alloy-serde
-> Serde related utilitiesalloy-signer
-> Ethereum signer abstractionalloy-signer-aws
-> AWS KMS signer implementationalloy-signer-gcp
-> GCP KMS signer implementationalloy-signer-ledger
-> Ledger Signer implementationalloy-signer-local
-> Local signer implementationsalloy-signer-trezor
-> Trezor signer implementation
alloy-transport
-> Low-level Ethereum JSON-RPC transaport abstractionalloy-transport-http
-> HTTP Transport implementationalloy-transport-ipc
-> IPC Transport Implementationalloy-transport-ws
-> WS transport implementationalloy-core
-> consists of the following cratesalloy-dyn-abi
-> Run-time ABI and EIP-712 implementationsalloy-json-abi
-> Full Ethereum JSON-ABI implementationalloy-primitives
-> Primitive integer and byte typesalloy-sol-macor-expander
-> Expander used in the Solidity to Rust procedural macroalloy-sol-type-parser
-> A simple parser for solidity type stringsalloy-sol-types
-> Compile time ABI and EIP 712 implementationssyn-solidity
->syn
powered solidity parser