> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using eRPC with Chainstack: Quickstart

> Set up eRPC fault-tolerant proxy with Chainstack auto-discovery. Configure multi-chain RPC endpoints, caching, and failover using Platform API integration.

**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.

<Info>
  **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](/reference/platform-api-getting-started) to automatically discover and configure all your deployed nodes.
</Info>

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:

* A [Chainstack account](https://chainstack.com/) with deployed nodes.
* A [Chainstack Platform API key](/reference/platform-api-getting-started#create-api-key).
* Docker installed.

And that's about it.

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

## 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](https://console.chainstack.com).
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.

<Info>
  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.
</Info>

## Step 2: Deploy nodes

Deploy [Global Nodes](/docs/global-elastic-node) 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:

<CodeGroup>
  ```yaml theme={"system"}
  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
  ```
</CodeGroup>

Replace `YOUR_CHAINSTACK_PLATFORM_API_KEY` with your actual Platform API key.

### Advanced configuration with filtering

Chainstack's integration supports powerful filtering options:

<CodeGroup>
  ```yaml theme={"system"}
  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
  ```
</CodeGroup>

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:

<CodeGroup>
  ```bash theme={"system"}
  docker run --rm -v $(pwd)/erpc.yaml:/erpc.yaml -p 4000:4000 -p 4001:4001 ghcr.io/erpc/erpc:main
  ```
</CodeGroup>

### Step 5: Test your setup

Test the proxy with a simple request:

<CodeGroup>
  ```bash theme={"system"}
  # 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"
  }'
  ```
</CodeGroup>

## Advanced configuration

For more advanced configurations and features, refer to the [eRPC documentation](https://docs.erpc.cloud/) and the [eRPC GitHub repository](https://github.com/erpc/erpc). Don't forget to give them a star :star: for this awesome solution.

### About the author

<CardGroup>
  <Card title="Ake">
    <img src="https://mintcdn.com/chainstack/UN3rP7zhB69idvnC/images/docs/profile_images/1719912994363326464/8_Bi4fdM_400x400.jpg?fit=max&auto=format&n=UN3rP7zhB69idvnC&q=85&s=792a24ab1b4682406fa589c0ecd88e5d" alt="Ake" style={{width: '80px', height: '80px', borderRadius: '50%', objectFit: 'cover', display: 'block', margin: '0 auto'}} noZoom width="400" height="400" data-path="images/docs/profile_images/1719912994363326464/8_Bi4fdM_400x400.jpg" />

    <Icon icon="code" iconType="solid" /> Director of Developer Experience @ Chainstack
    <br /><Icon icon="screwdriver-wrench" iconType="solid" /> Talk to me all things Web3
    <br />20 years in technology | 8+ years in Web3 full time years experience

    <div style={{display: "flex", justifyContent: "center", gap: "12px"}}>
      <a href="https://github.com/akegaviar/" style={{textDecoration: "none", borderBottom: "none"}}>
        <Icon icon="github" iconType="brands" />
      </a>

      <a href="https://twitter.com/akegaviar" style={{textDecoration: "none", borderBottom: "none"}}>
        <Icon icon="twitter" iconType="brands" />
      </a>

      <a href="https://www.linkedin.com/in/ake/" style={{textDecoration: "none", borderBottom: "none"}}>
        <Icon icon="linkedin" iconType="brands" />
      </a>
    </div>
  </Card>
</CardGroup>
