Using eRPC with Chainstack: Quickstart
TLDR
- Set up eRPC as a fault-tolerant proxy for your Chainstack RPC endpoints with enhanced reliability, caching, and failover capabilities.
- Use eRPC’s built-in Chainstack integration with a key.
- Configure automatic failover, intelligent caching, rate limiting, and monitoring with a simple YAML configuration.
- Deploy using Docker with pre-built images and test with standard JSON-RPC calls for production-ready blockchain infrastructure.
Main article
This tutorial will guide you through setting up eRPC as a fault-tolerant proxy for your Chainstack RPC endpoints, providing enhanced reliability, caching, and failover capabilities.
Prerequisites
Before starting, ensure you have:
- A Chainstack account with deployed nodes
- Chainstack key for accessing your endpoints. You can get it on your Node details. For example in
https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d
, the key is3c6e0b8a9c15224a8228b9a98ca1531d
. - Docker installed on your system
- Basic understanding of JSON-RPC and blockchain concepts
Note: You don’t need to clone the eRPC repository. This tutorial uses the pre-built Docker image and creates configuration files from scratch.
What you’ll achieve
By the end of this tutorial, you’ll have:
- eRPC proxy running with Chainstack endpoints
- Automatic failover between multiple Chainstack nodes
- Intelligent caching to reduce RPC calls
- Rate limiting and request optimization
Run blockchain nodes on Chainstack
Start for free and get your app to production levels immediately. No credit card required. You can sign up with your GitHub, X, Google, or Microsoft account.
Supported networks
eRPC’s built-in Chainstack integration supports the following networks:
Mainnet networks:
- Ethereum (Chain ID: 1)
- BSC (Chain ID: 56)
- Arbitrum One (Chain ID: 42161)
- Base (Chain ID: 8453)
- Sonic (Chain ID: 146)
- Polygon (Chain ID: 137)
- Optimism (Chain ID: 10)
- Avalanche (Chain ID: 43114)
- Ronin (Chain ID: 2020)
- zkSync Era (Chain ID: 324)
- Scroll (Chain ID: 534352)
- Oasis Sapphire (Chain ID: 23294)
- Celo (Chain ID: 42220)
- Kaia (Chain ID: 8217)
- Gnosis (Chain ID: 100)
- Cronos (Chain ID: 25)
- Fantom (Chain ID: 250)
Testnet Networks:
- Ethereum Sepolia (Chain ID: 11155111)
- Ethereum Holesky (Chain ID: 17000)
- Ethereum Hoodi (Chain ID: 560048)
- BSC Testnet (Chain ID: 97)
- Arbitrum Sepolia (Chain ID: 421614)
- Base Sepolia (Chain ID: 84532)
- Sonic Blaze (Chain ID: 57054)
- Polygon Amoy (Chain ID: 80002)
- Optimism Sepolia (Chain ID: 11155420)
- Avalanche Fuji (Chain ID: 43113)
- Ronin Saigon (Chain ID: 2021)
- zkSync Sepolia (Chain ID: 300)
- Scroll Sepolia (Chain ID: 534351)
- Oasis Sapphire Testnet (Chain ID: 23295)
- Kaia Kairos (Chain ID: 1001)
- Gnosis Chiado (Chain ID: 17049341)
Quickstart
Step 1: Get your Chainstack key
You only need your Chainstack API key—eRPC will automatically generate the correct endpoints for each network.
You can get the key on your Node details.
For example in https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d
, the key is 3c6e0b8a9c15224a8228b9a98ca1531d
.
Note: With eRPC’s built-in Chainstack integration, you one key per supported network.
When you specify endpoint: chainstack://CHAINSTACK_KEY
, eRPC automatically generates the correct URLs like https://ethereum-mainnet.core.chainstack.com/CHAINSTACK_KEY
based on the chain ID.
Step 2: Create eRPC configuration
Create a new directory for your eRPC setup and configuration file:
Create an erpc.yaml
file with your Chainstack configuration:
Step 3: Run eRPC
Start eRPC using Docker:
Step 4: Test your setup
Test the proxy with a simple request:
Advanced configuration
For more advanced configurations and features, refer to the eRPC documentation and the eRPC GitHub repository. Don’t forget to give them a star :star: for this awesome solution.