| 
 | 1 | +---  | 
 | 2 | +title: proxyd  | 
 | 3 | +lang: en-US  | 
 | 4 | +description: Learn about the proxyd service and how to configure it for use in the OP Stack.  | 
 | 5 | +---  | 
 | 6 | + | 
 | 7 | +import { Steps } from 'nextra/components'  | 
 | 8 | + | 
 | 9 | +# proxyd  | 
 | 10 | + | 
 | 11 | +`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.  | 
 | 12 | + | 
 | 13 | +## Key Features  | 
 | 14 | + | 
 | 15 | +*   RPC method whitelisting  | 
 | 16 | +*   Backend request routing  | 
 | 17 | +*   Automatic retries for failed backend requests  | 
 | 18 | +*   Consensus tracking (latest, safe, and finalized blocks)  | 
 | 19 | +*   Request/response rewriting to enforce consensus  | 
 | 20 | +*   Load balancing across backend services  | 
 | 21 | +*   Caching of immutable responses  | 
 | 22 | +*   Metrics for request latency, error rates, and backend health  | 
 | 23 | + | 
 | 24 | +## How it works  | 
 | 25 | + | 
 | 26 | +To start using `proxyd`, follow these steps:  | 
 | 27 | + | 
 | 28 | +<Steps>  | 
 | 29 | +  ### **Build the Binary**:  | 
 | 30 | + | 
 | 31 | +  *   Run the following command to build the `proxyd` binary:  | 
 | 32 | +      ```bash  | 
 | 33 | +      make proxyd  | 
 | 34 | +      ```  | 
 | 35 | +  *   This will build the `proxyd` binary. No additional dependencies are required.  | 
 | 36 | + | 
 | 37 | +  ### **Configure `proxyd`**:  | 
 | 38 | + | 
 | 39 | +  *   Create a configuration file to define your proxy backends and routing rules.  | 
 | 40 | +  *   Refer to [example.config.toml](https://github.com/ethereum-optimism/infra/blob/main/proxyd/example.config.toml) for a full list of options with commentary.  | 
 | 41 | + | 
 | 42 | +  ### **Start the Service**:  | 
 | 43 | + | 
 | 44 | +  Once the configuration file is ready, start the `proxyd` service using the following command:  | 
 | 45 | + | 
 | 46 | +  ```bash  | 
 | 47 | +  proxyd <path-to-config.toml>  | 
 | 48 | +  ```  | 
 | 49 | +</Steps>  | 
 | 50 | + | 
 | 51 | +## Consensus Awareness  | 
 | 52 | + | 
 | 53 | +Version 4.0.0 and later include consensus awareness to minimize chain reorganizations.  | 
 | 54 | + | 
 | 55 | +Set `consensus_aware` to `true` in the configuration to enable:  | 
 | 56 | + | 
 | 57 | +*   Polling backends for consensus data (latest block, safe block, peer count, etc.).  | 
 | 58 | +*   Resolving consensus groups based on healthiest backends  | 
 | 59 | +*   Enforcing consensus state across client requests  | 
 | 60 | + | 
 | 61 | +## Caching and Metrics  | 
 | 62 | + | 
 | 63 | +### Cacheable Methods  | 
 | 64 | + | 
 | 65 | +Certain immutable methods, such as `eth_chainId` and `eth_getBlockByHash`, can be cached using Redis to optimize performance.  | 
 | 66 | + | 
 | 67 | +### Metrics  | 
 | 68 | + | 
 | 69 | +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.  | 
 | 70 | + | 
 | 71 | +## Next Steps  | 
 | 72 | + | 
 | 73 | +*   Read about the [OP Stack chain architecture](/builders/chain-operators/architecture).  | 
 | 74 | +*   Find out how you can support [snap sync](/builders/chain-operators/management/snap-sync).  | 
 | 75 | +    on your chain.  | 
 | 76 | +*   Find out how you can utilize [blob space](/builders/chain-operators/management/blobs)  | 
 | 77 | +    to reduce the transaction fee cost on your chain.  | 
0 commit comments