Avalanche RPC Guide: How to Connect and Build on Avalanche (2026)
Avalanche is a high-throughput, EVM-compatible blockchain with a distinctive multi-chain architecture and sub-second transaction finality. If you are building a dApp, running a trading bot, or indexing on-chain data, understanding how Avalanche RPC works is the first step.
This guide covers what an Avalanche RPC endpoint is, how the multi-chain architecture maps to RPC access, which JSON-RPC methods you will use most, how to connect with ethers.js, Web3.py, or curl, plus what to watch for in production.
What is an Avalanche RPC Endpoint
An Avalanche RPC endpoint is an HTTP or WebSocket URL that exposes the Avalanche JSON-RPC API. Your application sends structured method calls to the endpoint and receives on-chain data: block state, transaction receipts, contract return values, event logs.
When developers talk about an Avalanche RPC endpoint, they almost always mean access to the C-Chain (Contract Chain). The C-Chain is Avalanche’s EVM-compatible chain where smart contracts live. It accepts the same eth_ method namespace as Ethereum, which means any library, tool, or integration built for Ethereum works on Avalanche C-Chain with just an endpoint swap.
Avalanche Multi-Chain Architecture
Avalanche is not a single blockchain. The network has three native chains with separate purposes and separate APIs:
| Chain | Purpose | API Type | EVM Compatible |
|---|---|---|---|
| C-Chain | Smart contracts, DeFi, EVM apps | JSON-RPC (eth_ methods) | Yes |
| X-Chain | Asset transfers, UTXO model | Avalanche-native API | No |
| P-Chain | Staking, subnet management | Avalanche-native API | No |
For most developers, only the C-Chain matters. The X-Chain and P-Chain use Avalanche’s own API format, not the Ethereum JSON-RPC standard. If you are deploying Solidity contracts, reading DeFi protocol state, or building anything EVM-based, you are on the C-Chain.
The C-Chain runs at Chain ID 43114 on mainnet. The Fuji testnet C-Chain runs at Chain ID 43113.
Avalanche also supports Subnets: independent blockchains launched within the Avalanche network with their own validator sets. Many Subnets are EVM-compatible but use different chain IDs. The C-Chain mainnet endpoint does not provide access to Subnet chains. Verify Subnet chain IDs and endpoints separately.
Example Avalanche RPC Methods
Because the C-Chain is fully EVM-compatible, all standard eth_ methods work. These are the ones you will call most often:
| Method | What It Does |
|---|---|
eth_blockNumber | Returns the latest C-Chain block number |
eth_getBalance | Returns the AVAX balance of an address |
eth_call | Executes a read-only call against a smart contract |
eth_sendRawTransaction | Broadcasts a signed transaction |
eth_getTransactionReceipt | Returns receipt including status and logs |
eth_getLogs | Fetches event logs by address and topic filter |
eth_subscribe | Opens a WebSocket subscription for new blocks or logs |
eth_gasPrice | Returns the current base fee estimate |
eth_estimateGas | Estimates gas required for a transaction |
One important note for eth_getLogs: Avalanche’s public RPC nodes enforce a block range limit. Queries spanning more than 2048 blocks are rejected on some providers. When fetching historical logs at scale, chunk your requests into smaller block ranges.
Public Avalanche RPC Endpoints
These are the publicly available endpoints for testing. They have no authentication requirement but rate-limit aggressively under load.
| Provider | HTTP Endpoint | Notes |
|---|---|---|
| Avalanche Foundation | https://api.avax.network/ext/bc/C/rpc | Official public node |
| Avalanche Foundation (Fuji) | https://api.avax-test.network/ext/bc/C/rpc | Official testnet |
| ANKR | https://rpc.ankr.com/avalanche | Free tier available |
| PublicNode | https://avalanche-c-chain-rpc.publicnode.com | Community maintained |
Public endpoints are suitable for development and initial testing. For production workloads, the rate limits and shared infrastructure introduce latency and errors that dedicated providers avoid.
Connecting Step by Step
ethers.js
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider(
"https://eu.endpoints.matrixed.link/rpc/avax?auth=YOUR_KEY"
);
// Get latest block
const block = await provider.getBlock("latest");
console.log("Block number:", block.number);
// Read AVAX balance
const balance = await provider.getBalance("0xYourAddress");
console.log("Balance:", ethers.formatEther(balance), "AVAX");
For WebSocket subscriptions (new blocks, pending transactions, contract events):
const wsProvider = new ethers.WebSocketProvider(
"wss://eu.endpoints.matrixed.link/ws/avax?auth=YOUR_KEY"
);
wsProvider.on("block", (blockNumber) => {
console.log("New block:", blockNumber);
});
Web3.py
from web3 import Web3
w3 = Web3(Web3.HTTPProvider(
"https://eu.endpoints.matrixed.link/rpc/avax?auth=YOUR_KEY"
))
print("Connected:", w3.is_connected())
print("Chain ID:", w3.eth.chain_id) # 43114
# Read AVAX balance
balance = w3.eth.get_balance("0xYourAddress")
print("Balance:", w3.from_wei(balance, "ether"), "AVAX")
curl
curl https://eu.endpoints.matrixed.link/rpc/avax?auth=YOUR_KEY \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Expected response:
{"jsonrpc":"2.0","id":1,"result":"0x1a2b3c"}
Avalanche-Specific Considerations
Snowman Consensus and Finality
Avalanche uses the Snowman consensus protocol on the C-Chain. Snowman is a DAG-optimized BFT consensus that achieves finality in under one second under normal network conditions. This is materially different from Ethereum, where cryptographic finality takes roughly 13 minutes (two checkpoint epochs).
Practical implication: on Avalanche, you do not need to wait many block confirmations before treating a transaction as final. Most production applications on Avalanche use 1 to 3 block confirmations. If your code was written for Ethereum and waits 12 confirmations, you are adding unnecessary latency.
Important: “included in a block” and “finalized” are not the same thing even on Avalanche. Under rare network stress, block reorganizations can occur. For high-value operations, confirm finality via the chain state rather than relying only on block inclusion.
AVAX Gas Mechanics
AVAX is the native token used for gas on the C-Chain. Avalanche uses a dynamic fee model (EIP-1559 compatible) with a base fee and optional priority tip. The minimum base fee is 25 nAVAX (nanoAVAX). Gas estimation via eth_estimateGas works the same as on Ethereum.
C-Chain Block Time vs Finality
The C-Chain produces a new block approximately every 2 seconds. Finality via Snowman consensus is typically confirmed within 1 second of block production. This combination means that for most practical purposes, Avalanche transactions are both fast and final within seconds.
Common Issues and Fixes
Rate limit errors on public endpoints (429 responses) Public nodes throttle aggressively. Switch to a dedicated provider or implement exponential backoff with jitter in your retry logic.
eth_getLogs block range rejection
Avalanche nodes often reject log queries spanning more than 2048 blocks. Split historical log fetching into chunks: query 1000 blocks at a time and paginate.
Wrong chain ID (transaction rejected) Always set Chain ID 43114 explicitly when signing transactions. A mismatch causes the transaction to be rejected at the RPC level before it reaches the mempool.
WebSocket disconnections
Long-lived WebSocket connections require reconnect logic. Implement an on('error') handler and automatic reconnection with exponential backoff. Most production Avalanche applications reconnect after 30 seconds of silence.
Subnet RPC confusion If you are building on an Avalanche Subnet (Dexalot, DFK Chain, etc.), the Subnet has its own endpoint and chain ID. The C-Chain endpoint does not proxy Subnet calls. Confirm which chain your contract is deployed on before debugging RPC errors.
Choosing a Provider
Public endpoints work for prototyping. For production, the key criteria are:
Reliability under load. Avalanche DeFi protocols generate high RPC volume, particularly during volatile market conditions. A provider that rate-limits or degrades under load directly impacts your application’s response time.
WebSocket support. If your application subscribes to events (DEX trades, price updates, liquidation triggers), you need stable WebSocket connections. Not all providers treat WebSocket as a first-class feature.
Latency relative to your infrastructure. Avalanche’s sub-second finality means the chain is rarely the bottleneck. RPC latency becomes a more significant factor in overall application response time. Choose a provider with infrastructure close to your own deployment region.
Security certifications for enterprise use. Institutional DeFi teams deploying on Avalanche often require infrastructure that meets compliance baselines. ISO 27001:2022 certification covers the information security management system of the underlying infrastructure, providing a documented audit trail for due diligence.
For MetaMask configuration, Fuji testnet setup, full endpoint details, plus BoltRPC’s Avalanche plan options, see the BoltRPC Avalanche chain page.
FAQ
What is the Avalanche C-Chain RPC URL?
The Avalanche C-Chain mainnet RPC endpoint format is https://[provider]/ext/bc/C/rpc for public nodes or a dedicated URL from your RPC provider. The chain ID is 43114. BoltRPC’s Avalanche endpoint is https://eu.endpoints.matrixed.link/rpc/avax?auth=YOUR_KEY. Get a key at trial.boltrpc.io.
Does the Avalanche RPC endpoint cover X-Chain and P-Chain?
No. The C-Chain JSON-RPC endpoint covers only the C-Chain. The X-Chain and P-Chain use Avalanche’s own API format at different paths (/ext/bc/X and /ext/bc/P). Most developer use cases are C-Chain only. X-Chain and P-Chain APIs are used for AVAX transfers between chains and validator staking operations.
Why does eth_getLogs fail on Avalanche?
Avalanche nodes enforce a block range limit on log queries. If your query spans more than 2048 blocks, the request is rejected. Break your log fetch into smaller chunks of 1000 blocks and paginate through the range. This applies to both public nodes and most managed RPC providers.
What is the Avalanche Fuji testnet RPC URL?
The Fuji testnet C-Chain RPC is https://api.avax-test.network/ext/bc/C/rpc with Chain ID 43113. Use Fuji for smart contract testing before mainnet deployment. AVAX on Fuji is free from the official faucet at faucet.avax.network.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is the Avalanche C-Chain RPC URL?",
"acceptedAnswer": {
"@type": "Answer",
"text": "The Avalanche C-Chain mainnet RPC endpoint uses chain ID 43114. BoltRPC's Avalanche endpoint is https://eu.endpoints.matrixed.link/rpc/avax?auth=YOUR_KEY. Get a key at trial.boltrpc.io."
}
},
{
"@type": "Question",
"name": "Does the Avalanche RPC endpoint cover X-Chain and P-Chain?",
"acceptedAnswer": {
"@type": "Answer",
"text": "No. The C-Chain JSON-RPC endpoint covers only the C-Chain. The X-Chain and P-Chain use Avalanche's own API format at different paths. Most developer use cases are C-Chain only."
}
},
{
"@type": "Question",
"name": "Why does eth_getLogs fail on Avalanche?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Avalanche nodes enforce a block range limit on log queries. If your query spans more than 2048 blocks, the request is rejected. Break your log fetch into smaller chunks of 1000 blocks and paginate through the range."
}
},
{
"@type": "Question",
"name": "What is the Avalanche Fuji testnet RPC URL?",
"acceptedAnswer": {
"@type": "Answer",
"text": "The Fuji testnet C-Chain RPC is https://api.avax-test.network/ext/bc/C/rpc with Chain ID 43113. Use Fuji for smart contract testing before mainnet deployment."
}
}
]
}
</script>