TLDR:

  • Set up eRPC as a fault-tolerant proxy that automatically discovers and configures all your Chainstack nodes using the Platform API.
  • Unlike other providers, Chainstack integration requires only a Platform API key to automatically fetch and configure all deployed nodes across multiple chains.
  • Benefit from automatic node discovery, multi-chain support, smart filtering by project/region/provider, and dynamic configuration without manual endpoint management.
  • Deploy using Docker with simple YAML configuration and test with standard JSON-RPC calls for production-ready blockchain infrastructure.

Main article

eRPC is a fault-tolerant EVM RPC proxy with permanent caching and reorg awareness. One of its most powerful features is the built-in support for multiple blockchain infrastructure providers, including Chainstack.

What makes Chainstack unique in eRPC?

Unlike other providers that require you to manually configure each blockchain network endpoint, Chainstack’s integration with eRPC uses the Chainstack Platform API to automatically discover and configure all your deployed nodes.

This means:

  • Automatic node discovery — eRPC fetches all your Chainstack nodes via API.
  • Multi-chain support — Automatically supports all chains where you have nodes.
  • Smart filtering — Filter nodes by project, organization, region, provider, and type.
  • Dynamic configuration — No need to manually update configs when you deploy new nodes.

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:

And that’s about it.

You don’t need to clone the eRPC repository. This tutorial uses the pre-built Docker image and creates configuration files from scratch.

Step 1: Get your Chainstack Platform API key

The key difference with Chainstack is that you need a Platform API key, not a regular node endpoint API key.

Creating a Platform API key

  1. Log into your Chainstack console.
  2. Navigate to Settings > API keys.
  3. Click Create key.
  4. Give it a descriptive name (e.g., “eRPC Integration”).
  5. Copy the generated API key.

This is different from the authorization keys you get with individual node endpoints. The Platform API key lets eRPC discover and manage all your nodes automatically.

Step 2: Deploy nodes

Deploy Global Nodes for EVM networks.

For this tutorial, let’s deploy nodes on a few different networks: Ethereum Mainnet, Polygon Mainnet, Arbitrum Mainnet.

Step 3: Configure Chainstack integration

If you want a quick start, you can just stick with the basic configuration and explore other options later.

Basic configuration

Create or edit your erpc.yaml file:

projects:
  - id: main
    networks:
      - architecture: evm
        evm:
          chainId: 1
      - architecture: evm
        evm:
          chainId: 137

    upstreams:
      # Chainstack auto-discovery — will find all nodes automatically
      - id: chainstack-auto
        endpoint: chainstack://YOUR_CHAINSTACK_PLATFORM_API_KEY
        rateLimitBudget: chainstack-developer
        failsafe:
          timeout:
            duration: 15s
          retry:
            maxAttempts: 2
            delay: 1000ms
            backoffMaxDelay: 10s
            backoffFactor: 0.3
            jitter: 500ms

rateLimiters:
  budgets:
    - id: chainstack-developer
      rules:
        - method: '*'
          maxCount: 25  # The lowest limit of the free Developer plan https://chainstack.com/pricing/
          period: 1s
        - method: 'eth_getLogs'
          maxCount: 10  # The lowest limit of the free Developer plan https://chainstack.com/pricing/
          period: 1s

Replace YOUR_CHAINSTACK_PLATFORM_API_KEY with your actual Platform API key.

Advanced configuration with filtering

Chainstack’s integration supports powerful filtering options:

projects:
  - id: main
    networks:
      - architecture: evm
        evm:
          chainId: 1
      - architecture: evm
        evm:
          chainId: 137

    upstreams:
      # Chainstack auto-discovery — will find all nodes automatically
      - id: chainstack-auto
        endpoint: chainstack://YOUR_CHAINSTACK_PLATFORM_API_KEY?project=PROJECT-ID
        rateLimitBudget: chainstack-developer
        failsafe:
          timeout:
            duration: 15s
          retry:
            maxAttempts: 2
            delay: 1000ms
            backoffMaxDelay: 10s
            backoffFactor: 0.3
            jitter: 500ms

rateLimiters:
  budgets:
    - id: chainstack-developer
      rules:
        - method: '*'
          maxCount: 25  # The lowest limit of the free Developer plan https://chainstack.com/pricing/
          period: 1s
        - method: 'eth_getLogs'
          maxCount: 10  # The lowest limit of the free Developer plan https://chainstack.com/pricing/
          period: 1s

Replace YOUR_CHAINSTACK_PLATFORM_API_KEY with your actual Platform API key and PROJECT-ID with the ID of your project—for example, PR-123-456.

Step 4: Run eRPC

Start eRPC using Docker:

docker run --rm -v $(pwd)/erpc.yaml:/erpc.yaml -p 4000:4000 -p 4001:4001 ghcr.io/erpc/erpc:main

Step 5: Test your setup

Test the proxy with a simple request:

# Test Ethereum mainnet
curl --location 'http://localhost:4000/main/evm/1' \
--header 'Content-Type: application/json' \
--data '{
    "method": "eth_getBlockByNumber",
    "params": ["latest", false],
    "id": 1,
    "jsonrpc": "2.0"
}'

# Test Polygon mainnet
curl --location 'http://localhost:4000/main/evm/137' \
--header 'Content-Type: application/json' \
--data '{
    "method": "eth_blockNumber",
    "params": [],
    "id": 2,
    "jsonrpc": "2.0"
}'

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.

About the author

8_Bi4fdM_400x400

Ake

Director of Developer Experience @ Chainstack

Talk to me all things Web3

20 years in technology | 8+ years in Web3 full time years experience

Trusted advisor helping developers navigate the complexities of blockchain infrastructure