Avalanche RPC Quickstart | ERPC

Avalanche RPC Quickstart

This guide takes you from zero to your first Avalanche JSON-RPC response with ERPC.

1. Get Your API Key

You can obtain and check your API key on the ERPC Web Dashboard: ERPC Web Dashboard
Already using ERPC for Solana or Ethereum? You can use the same RPC key.

2. Make Your First Request

Send a JSON-RPC 2.0 request as an HTTP POST, with your API key in the api-key parameter:
bash
curl https://edge.erpc.global/ava?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","id":1,
  "method":"eth_blockNumber"
}'
The response returns the latest C-Chain block number in hexadecimal:
json
{ "jsonrpc": "2.0", "id": 1, "result": "0x..." }
You can check which chain the endpoint serves with eth_chainId. The result is 0xa86a — 43114, the Avalanche C-Chain mainnet chain ID:
bash
curl https://edge.erpc.global/ava?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","id":1,
  "method":"eth_chainId"
}'
The same endpoint also serves the native Avalanche APIs. The upstream API is selected by the exact method name, so X-Chain (avm.*) and P-Chain (platform.*) calls need no extra path or host:
bash
curl https://edge.erpc.global/ava?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","id":1,
  "method":"platform.getHeight",
  "params":{}
}'

3. Subscribe over WebSocket

The WebSocket endpoint accepts standard C-Chain eth_subscribe subscriptions:
bash
wscat -c "wss://edge.erpc.global/ava?api-key=<YOUR_API_KEY>"
# After connected, send:
{"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
For the available subscription types, refer to the official Avalanche C-Chain documentation linked below.

4. Batch Requests

You can send up to 256 JSON-RPC calls in a single HTTP request for C-Chain EVM methods. Each call in a batch is metered as its own call.
bash
curl https://edge.erpc.global/ava?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '[
  {"jsonrpc":"2.0","id":1,"method":"eth_blockNumber"},
  {"jsonrpc":"2.0","id":2,"method":"eth_gasPrice"}
]'

Next Steps