mirror of
https://github.com/status-im/eth-rpc-proxy.git
synced 2026-08-27 17:51:11 +00:00
master
Status Network is shutting down, so drop its Sepolia and Hoodi RPC entries plus leftover docs, tests, and test-api paths.
Ethereum RPC Proxy
The Ethereum RPC Proxy System provides a robust solution for managing and monitoring Ethereum RPC providers. It consists of four main components:
- RPC Health Checker: Monitors and validates RPC provider health
- nginx-proxy: Acts as a reverse proxy with provider failover and three-level caching
- KeyDB: Persistent L3 cache service for distributed caching across instances
- Auth Service: Handles JWT-based authentication with puzzle solving
Running on the local machine
Run the complete system:
-
Generate provider configuration files and store them in the secrets folder:
# Create secrets directory if it doesn't exist mkdir -p secrets # Generate default_providers.json with different authentication methods python3 rpc-health-checker/generate_providers.py \ --providers infura:YOUR_INFURA_TOKEN grove:YOUR_GROVE_TOKEN alchemy:YOUR_ALCHEMY_TOKEN robinhood \ --networks mainnet sepolia testnet \ --chains ethereum optimism arbitrum base robinhood \ --output secrets/default_providers.json # Or use mix of token, basic auth, and no-auth providers python3 rpc-health-checker/generate_providers.py \ --providers infura:YOUR_INFURA_TOKEN grove:username:password alchemy:YOUR_ALCHEMY_TOKEN robinhood \ --networks mainnet sepolia testnet \ --chains ethereum optimism arbitrum base robinhood \ --output secrets/default_providers.json # Generate reference_providers.json with single provider per chain python3 rpc-health-checker/generate_providers.py \ --single-provider \ --providers infura:YOUR_INFURA_TOKEN_REFERENCE alchemy:YOUR_ALCHEMY_TOKEN robinhood \ --networks mainnet sepolia testnet \ --chains ethereum optimism arbitrum base robinhood \ --output secrets/reference_providers.jsonPlease replace:
YOUR_INFURA_TOKENandYOUR_INFURA_TOKEN_REFERENCEwith your Infura API tokensYOUR_GROVE_TOKENwith your Grove API token, or useusername:passwordfor basic authYOUR_ALCHEMY_TOKENwith your Alchemy API token- Other provider credentials as needed
Note:
--providersaccepts multiple providers with different authentication methods:- No auth format: just provider name (e.g.,
robinhood) - Token auth format:
provider:token(e.g.,infura:abc123,alchemy:xyz789) - Basic auth format:
provider:username:password(e.g.,grove:user:pass) - Example:
--providers infura:TOKEN1 grove:user:pass robinhood nodefleet:TOKEN2 alchemy:TOKEN3
-
Create .htpasswd file for nginx proxy authentication:
htpasswd -c secrets/.htpasswd dev -
Execute the following commands to start the system:
docker-compose -f docker-compose-local.yml up -d --build -
Run test requests:
# For Ethereum mainnet using any available provider (with automatic failover between all providers) curl -u dev:<password> -X POST http://localhost:8080/ethereum/mainnet \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' # For Robinhood Chain mainnet using specific provider type curl -u dev:<password> -X POST http://localhost:8080/robinhood/mainnet/robinhood \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' # For Ethereum mainnet using Infura providers (with automatic failover between all Infura instances) curl -u dev:<password> -X POST http://localhost:8080/ethereum/mainnet/infura \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
The services will be accessible under:
- RPC Health Checker: http://localhost:8081
- Check the list of validated providers at http://localhost:8081/providers
- nginx-proxy: http://localhost:8080
- The RPC endpoint is available in two formats:
http://localhost:8080/{chain}/{network}- uses any available provider with failover across all providershttp://localhost:8080/{chain}/{network}/{provider_type}- uses providers of the specified type with failover between instances of that type
- Features three-level cache architecture (L1/L2/L3) for optimized performance
- Example paths:
/ethereum/mainnet- tries all available providers until success/ethereum/mainnet/infura- tries all available Infura providers until success/robinhood/mainnet/robinhood- tries all available Robinhood providers until success
- The RPC endpoint is available in two formats:
- KeyDB: Persistent L3 cache service (Redis-compatible)
- Provides distributed caching across proxy instances
- Prometheus: http://localhost:9090
- Metrics and monitoring interface
- Grafana: http://localhost:3000 (default credentials: admin/admin)
- Visualization dashboards for RPC metrics and health status
Sub projects
Description
A robust Ethereum RPC proxy system with health checking and automatic failover between providers. Supports multiple chains (Ethereum, Optimism, Arbitrum, Base, Status and others) and networks (mainnet, sepolia) with comprehensive monitoring via Prometheus and Grafana
1.5 MiB
Languages
Go
59.5%
JavaScript
20%
Lua
12.4%
Python
4.4%
Shell
1.2%
Other
2.5%
