DEV Community

OnFinality
OnFinality

Posted on Originally published at onfinality.io

Base RPC Endpoint: Chain Settings & Provider Guide

Base is an Ethereum Layer 2 network built on the OP Stack, designed for low-cost, high-throughput dApps. To interact with Base, you need an RPC endpoint that lets your wallet or application read and write data to the chain. This page covers the essential chain settings, how to choose an RPC provider, and how to debug common connection issues.

Chain settings at a glance

Before connecting to Base, you need the correct network parameters. These are the same for any RPC provider, whether you use a public endpoint or a dedicated node.

Setting Value
Network Name Base Mainnet
Chain ID 8453 (0x2105)
Native Currency ETH
Block Explorer https://basescan.org
RPC Endpoint (public) https://mainnet.base.org
WebSocket Endpoint (public) wss://mainnet.base.org

For testnet development, use Base Sepolia with chain ID 84532. You can find the full list of Base networks on OnFinality's Base network page.

How to add Base to your wallet

Most wallets like MetaMask let you add a custom network. You'll need the chain ID, RPC URL, and currency symbol. Here's a typical configuration:

{
  "chainId": "0x2105",
  "chainName": "Base Mainnet",
  "nativeCurrency": {
    "name": "Ether",
    "symbol": "ETH",
    "decimals": 18
  },
  "rpcUrls": ["https://mainnet.base.org"],
  "blockExplorerUrls": ["https://basescan.org"]
}
Enter fullscreen mode Exit fullscreen mode

You can also use the wallet_addEthereumChain method to add Base programmatically from your dApp.

Public vs production RPC: what to choose

Public RPC endpoints like https://mainnet.base.org are free and convenient for testing, but they are often rate-limited and may not be reliable for production workloads. For a dApp serving real users, you need an RPC provider that offers higher throughput, better uptime, and dedicated infrastructure.

Here's a quick decision guide:

  • Prototyping or hackathon: Use a public endpoint or a free tier from a provider.
  • Production dApp: Use a managed RPC service with a dedicated node or a high-tier shared endpoint.
  • High-frequency trading or indexing: Consider a dedicated node to avoid rate limits and ensure consistent performance.

OnFinality offers RPC pricing that scales with your usage, and you can see which networks are supported on the networks page.

Making your first RPC call

Once you have an endpoint, you can test it with a simple JSON-RPC request. Here's a curl example to get the latest block number:

curl https://mainnet.base.org \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Enter fullscreen mode Exit fullscreen mode

You should get a response like {"jsonrpc":"2.0","result":"0x2f5a1b","id":1}. The result is a hex-encoded block number.

For WebSocket subscriptions, you can use a library like ethers:

import { ethers } from "ethers";

const provider = new ethers.WebSocketProvider("wss://mainnet.base.org");

provider.on("block", (blockNumber) => {
  console.log("New block:", blockNumber);
});
Enter fullscreen mode Exit fullscreen mode

Remember to close the WebSocket connection when you're done to avoid memory leaks.

Debugging common RPC issues

Even with the right endpoint, you may run into issues. Here are common failure modes and how to fix them:

Symptom Likely Cause Fix
eth_chainId returns wrong value Wrong network selected Verify chain ID is 8453
Request timeout Public endpoint rate-limited Switch to a provider with higher limits
nonce too low Transaction nonce mismatch Reset nonce or use eth_getTransactionCount
insufficient funds Wallet not funded Get test ETH from a faucet on testnet
WebSocket disconnects Idle timeout Implement reconnection logic

If you're using a public endpoint and hitting rate limits, consider a dedicated node or a paid plan. OnFinality's dedicated node service gives you your own infrastructure with no shared rate limits.

Provider evaluation matrix

When choosing a Base RPC provider, compare them on these criteria:

Criterion What to Check Why It Matters
Throughput Requests per second (RPS) limits Determines if your app can scale
Reliability Uptime history and redundancy Avoids downtime for your users
Data Access Archive data, trace methods Needed for indexing and analytics
WebSocket Support WSS endpoint availability Required for real-time updates
Pricing Free tier, pay-as-you-go, dedicated Aligns with your budget and usage

For production, you want a provider that offers both HTTP and WebSocket endpoints, archive data if you need historical state, and a clear pricing model. OnFinality provides these features across its supported networks.

Testnet vs mainnet: when to use Base Sepolia

Before deploying to mainnet, test your dApp on Base Sepolia. The testnet uses the same OP Stack architecture but with a different chain ID and faucet. You can get test ETH from the Base Sepolia faucet and use the testnet RPC endpoint from OnFinality's Base Sepolia page.

Key Takeaways

  • Base mainnet uses chain ID 8453 and ETH as the native currency.
  • Public RPC endpoints are fine for testing but not for production.
  • Choose a provider based on throughput, reliability, and data access needs.
  • Always test on Base Sepolia before mainnet deployment.
  • Use WebSocket for real-time data and implement reconnection logic.

Frequently Asked Questions

What is the Base RPC endpoint?

The public Base mainnet RPC endpoint is https://mainnet.base.org. For production, you should use a managed RPC provider like OnFinality.

What is the Base chain ID?

Base mainnet chain ID is 8453 (0x2105). Base Sepolia testnet uses 84532.

How do I get free Base RPC?

You can use the public endpoint https://mainnet.base.org for free, but it's rate-limited. Many providers offer free tiers, including OnFinality's RPC service.

Why is my Base RPC request failing?

Check your network configuration, ensure you're using the correct chain ID, and verify that your endpoint is not rate-limited. If you're using a public endpoint, consider upgrading to a dedicated node.

Can I use WebSocket with Base RPC?

Yes, Base supports WebSocket connections. Use wss://mainnet.base.org for public access, or your provider's WSS endpoint.

What is the difference between Base mainnet and Base Sepolia?

Base Sepolia is a testnet with the same functionality but uses test ETH and a different chain ID. It's for development and testing before mainnet deployment.

Related resources

Originally published at OnFinality.

Top comments (0)