Skip to main content
proxyd is an important RPC request router and proxy used within the OP Stack infrastructure. It enables operators to efficiently route and manage RPC requests across multiple backend services, ensuring performance, fault tolerance, and security.

Key features

  • RPC method whitelisting
  • Backend request routing
  • Automatic retries for failed backend requests
  • Consensus tracking (latest, safe, and finalized blocks)
  • Request/response rewriting to enforce consensus
  • Load balancing across backend services
  • Caching of immutable responses
  • Metrics for request latency, error rates, and backend health

How it works

To start using proxyd, follow these steps:
1

Build the binary:

  • Run the following command to build the proxyd binary:
  • This will build the proxyd binary. No additional dependencies are required.
2

Configure proxyd:

  • Create a configuration file to define your proxy backends and routing rules.
  • Refer to example.config.toml for a full list of options with commentary.
3

Start the service:

Once the configuration file is ready, start the proxyd service using the following command:

Consensus awareness

Version 4.0.0 and later include consensus awareness to minimize chain reorganizations. Enable it per backend group with routing_strategy = "consensus_aware" (the older consensus_aware = true setting is deprecated, and the two cannot be set together). Consensus awareness enables:
  • Polling backends for consensus data (latest block, safe block, peer count, etc.).
  • Resolving consensus groups based on healthiest backends
  • Enforcing consensus state across client requests
consensus_aware is for execution-client backends. For consensus-layer backends, such as the follow source of a Light CL fleet, use consensus_aware_consensus_layer, described next.

Consensus-layer routing for follow sources

routing_strategy = "consensus_aware_consensus_layer" (proxyd v4.27.5 and later; use the latest release) puts a pool of op-node or op-supernode instances behind one highly available endpoint. Point the --l2.follow.source flag of your Light CLs at it instead of at a single source. In this mode, proxyd:
  • Polls each backend’s optimism_syncStatus and excludes a backend whose derivation lags L1 by more than consensus_cl_sync_threshold L1 blocks (default 10) or whose L1 head is older than consensus_cl_head_l1_max_age (default 5m).
  • Compares optimism_outputAtBlock at the consensus safe block across backends on each poll. A backend that disagrees with a strict majority is banned. If there is no majority (for example, a 1–1 split), proxyd freezes the served state at the last agreed value and rejects other requests until a majority returns, so run at least three backends.
  • Answers optimism_syncStatus from the in-consensus backend that is furthest behind on L1, so it serves the most conservative view in the pool.
  • Checks each backend’s P2P peer count through opp2p_peerStats, unless the backend sets consensus_skip_peer_count = true. Set it on backends that run with P2P disabled, such as supernodes behind a Light CL fleet that handles gossip itself; otherwise proxyd never admits them to the consensus group.
proxyd routes by RPC method, not by URL path, so run one proxyd instance per chain. For an interop dependency set, each instance’s backends are the per-chain paths (/<chainID>) of your op-supernodes. This example serves OP Mainnet (chain ID 10) from three supernodes that run with --disable-p2p=true:
Light CLs then run with --l2.follow.source=http://<this-proxyd>:8545, with no /<chainID> suffix. Repeat with the Unichain path (/130) for a second instance that serves the Unichain fleet. A Light CL only calls optimism_syncStatus on its follow source, so that is the only method the instance needs to map.

Caching and metrics

Cacheable methods

Certain immutable methods, such as eth_chainId and eth_getBlockByHash, can be cached using Redis to optimize performance.

Metrics

Extensive metrics are available to monitor request latency, error rates, backend health, and more. These can be configured via metrics.port and metrics.host in the configuration file.

Next steps