Skip to main content

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
For general eRPC setup and Chainstack Platform API auto-discovery, see Using eRPC with Chainstack: Quickstart.

Network parameters

1. Get your endpoints

Chainstack endpoint

  1. Navigate to your Plasma node in the Chainstack console.
  2. Copy your HTTPS endpoint from Access and credentials.

Public endpoints

Plasma provides public RPC endpoints as backup:
  • https://rpc.plasma.to — public mainnet
  • https://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 named erpc.yaml:
Replace YOUR_CHAINSTACK_PLASMA_ENDPOINT with your actual Chainstack endpoint URL.
Never commit configuration files with real endpoint URLs to version control. Use environment variables in production.

3. Run eRPC

Start the proxy with Docker:
You should see output indicating both upstreams are configured:

4. Test the setup

Basic connectivity

Expected response:
The hex value 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

In hardhat.config.js:

6. Add testnet support

To also proxy Plasma Testnet, add another network to the configuration:
Access testnet at http://localhost:4000/plasma/evm/9746.

How failover works

eRPC handles failures automatically:
  1. Primary attempt — Request goes to Chainstack first
  2. Timeout/error — If Chainstack fails or times out, eRPC retries based on failsafe config
  3. Fallback — After exhausting retries, request routes to the public endpoint
  4. Hedging — For latency-sensitive calls, eRPC can send parallel requests to multiple upstreams
The 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
Example with environment variables:
Run with:

Conclusion

You now have fault-tolerant RPC access to Plasma. When your Chainstack endpoint experiences issues, eRPC automatically fails over to public endpoints, ensuring your application stays connected. For advanced configuration options, see the eRPC documentation.
Last modified on April 13, 2026