Skip to content
Logo

Feature flags

The alloy meta-crate uses feature flags to expose focused crates and select implementations. Start with the default features for a typical HTTP application, then add only the capabilities your code uses.

The exact feature graph can change between releases. For the version in your Cargo.lock, verify the docs.rs feature list or the alloy Cargo manifest.

Default: HTTP application

alloy = "2.1.1"

The defaults enable std, the Reqwest HTTP client with rustls, Alloy Core defaults, and essentials. The essentials group includes contracts, an HTTP provider, standard Ethereum RPC types, and local signers.

Broad application support

alloy = { version = "2.1.1", features = ["full"] }

full adds commonly used consensus and EIP types, WebSocket and IPC providers, pubsub, KZG, RLP, and the trace, txpool, debug, and Anvil RPC APIs. Despite its name, it is not every optional integration: node binaries, cloud and hardware signers, and several RPC namespaces remain opt-in.

No default features

alloy = { version = "2.1.1", default-features = false, features = ["sol-types"] }

Use this pattern only when you intend to assemble a minimal surface. Disabling defaults removes the HTTP provider, contracts, local signer, and std choices supplied by the default set. Feature requirements are additive, so compile every intended target after changing them.

Task-to-feature map

CapabilityFeature(s) to considerNotes
HTTP providerprovider-httpIncluded by essentials and the defaults
WebSocket provider and subscriptionsprovider-wsEnables pubsub and the default WebSocket TLS backend
WebSocket with ring or native TLSprovider-ws-ring, provider-ws-native-tlsChoose the backend required by your platform
IPC providerprovider-ipcEnables pubsub
Contract calls and bindingscontractPulls in providers and ABI features
Local private keyssigner-localIncluded by essentials
Mnemonics or keystoressigner-mnemonic, signer-keystoreAdd to signer-local behavior
AWS KMS, GCP KMS, or Turnkeysigner-aws, signer-gcp, signer-turnkeyEach integration is independent
Ledger or Trezorsigner-ledger, signer-trezorLedger also has browser and Node variants
Anvil process helpersprovider-anvil-nodeIncludes provider Anvil RPC and node bindings; not in full
Standalone node bindingsnode-bindingsRe-exports process bindings without provider helpers
debug_* RPC methodsprovider-debug-apiAlso enables debug and trace RPC types
trace_* RPC methodsprovider-trace-apiEnables trace RPC types
txpool_* RPC methodsprovider-txpool-apiEnables txpool RPC types
Admin, Engine, MEV, or Net methodsprovider-admin-api, provider-engine-api, provider-mev-api, provider-net-apiThese namespaces are not included as a group by full
Rate-limited transporttransport-throttleLow-level transport capability
Dynamic or JSON ABIdyn-abi, json-abicontract already enables both
EIP-712 signingeip712Enables support across compatible configured signers

HTTP implementation and TLS

The defaults select Reqwest with rustls. Advanced users can choose from reqwest-rustls-tls, reqwest-native-tls, reqwest-default-tls, or the hyper HTTP implementation. Disable default features before replacing the default combination, and test the target platforms you support.

WebSocket TLS choices are expressed through the provider features listed above. Avoid enabling multiple TLS backends unless a dependency requires them.

std, WebAssembly, and no_std

The networking-focused meta-crate is designed primarily for std. The wasm-bindgen feature adapts supported transport behavior for WebAssembly; it does not make every Alloy crate available in every browser environment.

For a no_std or otherwise constrained library, depend directly on the core or protocol crate you need, disable its default features, and verify its own feature list. Do not assume that disabling std on the alloy meta-crate makes provider, signer, or transport integrations no_std.

Diagnose a missing feature

If an import or method is unavailable:

  1. Open the item on docs.rs and check its Available on crate feature annotation.
  2. Inspect cargo tree -e features -i alloy to see which features are active.
  3. Add the smallest owning feature and run cargo check --all-targets.
  4. If the item belongs to an individual crate, check that crate's features rather than assuming the meta-crate uses the same flag name.