Overview
This tutorial shows how to configure eRPC as a fault-tolerant proxy for Plasma, combining your Chainstack endpoint with public RPCs for automatic failover. When your primary endpoint experiences issues, eRPC seamlessly routes requests to backup providers. By the end, you will have a local proxy that:- Routes Plasma RPC calls through Chainstack as the primary provider
- Falls back to public endpoints when the primary is unavailable
- Caches responses to reduce latency and RPC calls
- Retries failed requests with exponential backoff
Prerequisites
- Chainstack account with a Plasma node deployed
- Docker installed
- Basic familiarity with JSON-RPC
Network parameters
1. Get your endpoints
Chainstack endpoint
- Navigate to your Plasma node in the Chainstack console.
- Copy your HTTPS endpoint from Access and credentials.
Public endpoints
Plasma provides public RPC endpoints as backup:https://rpc.plasma.to— public mainnethttps://rpc-testnet.plasma.to— public testnet
Public endpoints have rate limits and no SLA. Use them as fallback only, not as primary.
2. Create the configuration
Create a file namederpc.yaml:
YOUR_CHAINSTACK_PLASMA_ENDPOINT with your actual Chainstack endpoint URL.
3. Run eRPC
Start the proxy with Docker:4. Test the setup
Basic connectivity
0x2611 equals 9745 (Plasma Mainnet chain ID).
Get latest block
Check USDT balance
5. Use with your application
Point your application to the eRPC proxy instead of directly to an RPC endpoint.ethers.js
web3.py
Hardhat
Inhardhat.config.js:
6. Add testnet support
To also proxy Plasma Testnet, add another network to the configuration:http://localhost:4000/plasma/evm/9746.
How failover works
eRPC handles failures automatically:- Primary attempt — Request goes to Chainstack first
- Timeout/error — If Chainstack fails or times out, eRPC retries based on
failsafeconfig - Fallback — After exhausting retries, request routes to the public endpoint
- Hedging — For latency-sensitive calls, eRPC can send parallel requests to multiple upstreams
hedge configuration sends a backup request after 2 seconds if the primary hasn’t responded, using whichever completes first.
Production deployment
For production, consider:- Environment variables — Use
${ENV_VAR}syntax in eRPC config - Docker Compose — Run eRPC alongside your application
- Health checks — Monitor eRPC metrics on port 4001
- Multiple Chainstack nodes — Add nodes in different regions for geographic redundancy