Logo
New RPC users get 35% off their first monthView the offer
RPC Assistant

Base RPC Node: Endpoints, Chain Settings, and Debugging

Summary

Base is an Ethereum Layer 2 network built with the OP Stack. To interact with Base, you need an RPC endpoint that lets your application read and write data on-chain. This page covers the official Base RPC endpoint, chain settings, common request patterns, and how to debug connection issues.

Quick Start: Connect to Base RPC

If you're building on Base, the first thing you need is a reliable RPC endpoint. Here's the official public endpoint provided by OnFinality:

https://base.api.onfinality.io/public

This endpoint supports HTTP JSON-RPC and is suitable for development and light production use. For higher throughput, dedicated node options are available through OnFinality's RPC service.

Chain Settings at a Glance

When configuring your wallet or application, you'll need the following Base network parameters:

ParameterValue
Network NameBase
Chain ID8453
Native CurrencyETH (Ether)
SymbolETH
Decimals18
Block Explorerhttps://basescan.org
RPC Endpointhttps://base.api.onfinality.io/public

These values are consistent with the official Base documentation and are used by most wallets and dApps.

What Is a Base RPC Node?

Base is an Ethereum Layer 2 network built on the OP Stack. It inherits Ethereum's security while offering lower fees and faster transaction finality. An RPC (Remote Procedure Call) node is the interface that allows your application to communicate with the Base blockchain. Through RPC, you can query balances, send transactions, read contract state, and subscribe to events.

Running your own Base node is possible, but it requires syncing the full chain and maintaining infrastructure. For most teams, using a managed RPC provider like OnFinality is more practical, especially when you need high availability and low latency.

How to Choose the Right Base RPC Setup

Your choice of RPC infrastructure depends on your workload. Here's a quick decision guide:

  • Development and testing: Use the public endpoint or a free tier from a provider. It's fine for small volumes and non-critical apps.
  • Production dApps with moderate traffic: A shared RPC plan with rate limits and good uptime is usually sufficient. Look for providers that offer WebSocket support for real-time updates.
  • High-throughput or data-intensive applications: Consider a dedicated Base node. This gives you dedicated resources, higher rate limits, and access to archive data if needed.

For most production apps, a managed RPC service like OnFinality offers the best balance of cost, reliability, and ease of use.

Making Your First JSON-RPC Request

Once you have an endpoint, you can interact with Base using standard Ethereum JSON-RPC methods. Here's a simple curl example to get the current block number:

curl https://base.api.onfinality.io/public \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

You should receive a response like:

{"jsonrpc":"2.0","id":1,"result":"0x123456"}

The result is a hex-encoded block number. You can convert it to decimal to see the current block height.

Using ethers.js with Base RPC

If you're building a JavaScript application, the ethers library makes it easy to connect to Base. Here's a minimal example:

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("https://base.api.onfinality.io/public");

async function getBlockNumber() {
  const blockNumber = await provider.getBlockNumber();
  console.log("Current block number:", blockNumber);
}

getBlockNumber();

This connects to the public endpoint and fetches the latest block number. For production, you'll want to use a more robust provider configuration with retries and timeouts.

Common Failure Modes and How to Debug Them

Even with a reliable RPC provider, you may encounter issues. Here are common symptoms and their fixes:

SymptomPossible CauseDebugging Step
ECONNREFUSED or timeoutNetwork issue or endpoint downCheck your internet connection and try the endpoint in a browser or curl
401 UnauthorizedInvalid API key or missing authenticationVerify your API key and that you're using the correct endpoint
429 Too Many RequestsRate limit exceededReduce request frequency or upgrade your plan
-32000 server errorInvalid JSON-RPC requestCheck the method name and parameters
nonce too lowTransaction nonce mismatchUse eth_getTransactionCount to get the correct nonce

If you're using a public endpoint and hitting rate limits, consider a dedicated node for higher limits and more consistent performance.

WebSocket Support for Real-Time Data

For applications that need real-time updates, such as transaction monitoring or event listening, WebSocket endpoints are essential. OnFinality's Base endpoint supports WebSocket connections. Here's an example using ethers:

const { ethers } = require("ethers");

const provider = new ethers.WebSocketProvider("wss://base.api.onfinality.io/public");

async function subscribeToBlocks() {
  provider.on("block", (blockNumber) => {
    console.log("New block:", blockNumber);
  });
}

subscribeToBlocks();

Note: The WebSocket URL uses the wss:// scheme. Ensure your provider supports WebSocket before relying on it.

Base Sepolia Testnet

Before deploying to mainnet, you should test on Base Sepolia. The testnet uses a different chain ID and endpoint:

ParameterValue
Network NameBase Sepolia Testnet
Chain ID84532
RPC Endpointhttps://base-sepolia.api.onfinality.io/public
Block Explorerhttps://sepolia.basescan.org

You can get test ETH from a faucet to fund your test transactions. For more details, see the Base Sepolia network page.

Production Readiness Checklist

Before launching your Base dApp, review this checklist:

  • Use a managed RPC provider with a service-level agreement (SLA) if your app is critical.
  • Implement retry logic and timeouts in your RPC calls.
  • Monitor your RPC usage and set up alerts for rate limit errors.
  • Consider using a dedicated node if you need high throughput or archive data.
  • Test on Base Sepolia before deploying to mainnet.
  • Keep your chain configuration up to date.

Key Takeaways

  • Base is an Ethereum Layer 2 network with its own RPC endpoint.
  • The official public endpoint is https://base.api.onfinality.io/public.
  • Chain ID is 8453, and the native currency is ETH.
  • Use JSON-RPC methods like eth_blockNumber and eth_getBalance for basic interactions.
  • For production, consider a managed RPC provider or dedicated node for reliability and scalability.
  • Test on Base Sepolia before mainnet deployment.

Frequently Asked Questions

What is the Base RPC endpoint?

The public Base RPC endpoint is https://base.api.onfinality.io/public. For higher limits, you can use a dedicated node from OnFinality.

What is the Base chain ID?

The Base chain ID is 8453.

How do I get test ETH on Base Sepolia?

You can use a faucet to get test ETH on Base Sepolia. Check the Base Sepolia network page for more information.

Can I use WebSocket with Base RPC?

Yes, OnFinality's Base endpoint supports WebSocket connections. Use wss://base.api.onfinality.io/public for real-time data.

What are the rate limits for the public Base RPC endpoint?

Rate limits vary by provider and plan. For production, consider a paid plan or dedicated node to avoid hitting limits.

For more information about RPC pricing and supported networks, visit RPC pricing and supported RPC networks.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started