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

What is the Base network RPC endpoint and how do I use it?

Summary

The Base network RPC endpoint is the URL your dApp or wallet uses to communicate with the Base blockchain. OnFinality provides a public HTTPS endpoint at https://base.api.onfinality.io/public, which you can use to send JSON-RPC requests for reading data or submitting transactions. This article explains the endpoint, chain settings, how to configure your tools, and how to debug common issues.

Quick reference: Base chain settings

Before you connect, you need the exact chain parameters. The table below lists the official settings for the Base mainnet and its Sepolia testnet. Use these values when configuring wallets, SDKs, or your own node.

ParameterBase MainnetBase Sepolia Testnet
Chain ID845384532
Network NameBaseBase Sepolia Testnet
Native CurrencyETH (18 decimals)Sepolia ETH (18 decimals)
Public RPC URLhttps://base.api.onfinality.io/publichttps://base-sepolia.api.onfinality.io/public
Block Explorerhttps://basescan.orghttps://sepolia.basescan.org
TransportHTTPSHTTPS

These values are the same ones used by popular wallets and infrastructure providers. If you are building a production app, you will likely want a managed or dedicated RPC endpoint rather than the public one, which is rate-limited and shared. OnFinality offers RPC pricing for higher throughput and reliability.

Decision guide: which endpoint should you use?

Your choice of endpoint depends on your stage and traffic:

  • Prototyping or hackathon: Use the public endpoint https://base.api.onfinality.io/public. It is free and works for small request volumes.
  • Production dApp with moderate traffic: Use a managed RPC service like OnFinality's Base network RPC. You get higher rate limits, multiple endpoints, and failover.
  • High-throughput or data-intensive workloads: Consider a dedicated node for Base. This gives you exclusive access to a node, avoiding noisy neighbors and enabling heavy eth_getLogs or archive queries.
  • Testnet development: Use the Base Sepolia endpoint https://base-sepolia.api.onfinality.io/public for testing without risking mainnet funds.

If you are unsure, start with the public endpoint and monitor your request volume. When you approach rate limits or need consistent latency, move to a paid plan.

What is the Base network RPC endpoint?

The Base network RPC endpoint is a URL that accepts JSON-RPC requests over HTTPS. It allows your application to read blockchain data (balances, transaction receipts, contract state) and send transactions. The endpoint is the entry point to the Base blockchain, which is an Ethereum Layer 2 network built with the OP Stack.

OnFinality provides a public endpoint for Base mainnet: https://base.api.onfinality.io/public. This endpoint is free to use but has rate limits. For production, you should use a dedicated or managed endpoint from a provider like OnFinality.

How to configure your wallet

To add Base to a wallet like MetaMask, use the chain settings from the table above. Here is a typical configuration:

  • Network Name: Base
  • New RPC URL: https://base.api.onfinality.io/public
  • Chain ID: 8453
  • Currency Symbol: ETH
  • Block Explorer URL: https://basescan.org

For Base Sepolia, use the testnet values. This allows you to interact with dApps and test contracts.

Using the endpoint with ethers.js

In ethers.js, you can create a provider using the endpoint URL. Here is an 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 provider can be used to read data or sign and send transactions. For production, replace the URL with your managed endpoint.

Using the endpoint with viem

Viem is a modern TypeScript library. Here is how to create a client:

import { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';

const client = createPublicClient({
  chain: base,
  transport: http('https://base.api.onfinality.io/public')
});

const blockNumber = await client.getBlockNumber();
console.log(blockNumber);

Viem includes chain definitions for Base, so you only need to provide the transport URL.

Sending a raw JSON-RPC request with curl

You can test the endpoint directly with curl. Here is an example that gets the latest block number:

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

The response will be a JSON object with the block number in hexadecimal. This is a quick way to verify connectivity.

Debugging common RPC issues

When working with Base RPC, you may encounter errors. Here are common symptoms and fixes:

SymptomLikely CauseFix
ECONNREFUSED or timeoutEndpoint unreachable or network issueCheck your internet connection and the URL. Try a different provider.
429 Too Many RequestsRate limit exceeded on public endpointUse a paid plan or dedicated node. Reduce request frequency.
-32000 or -32005 errorsInvalid request or method not supportedVerify the JSON-RPC method and parameters. Check the chain ID.
nonce too lowTransaction nonce is staleRefresh the nonce using eth_getTransactionCount with the latest block.
insufficient fundsWallet balance too lowFund the wallet with ETH on Base.

For more detailed troubleshooting, see our RPC troubleshooting guide.

Production readiness checklist

Before deploying to mainnet, review this checklist:

  • Use a managed or dedicated RPC endpoint, not the public one.
  • Set up monitoring for request failures and latency.
  • Implement retry logic with exponential backoff.
  • Use WebSocket for real-time subscriptions if needed.
  • Test on Base Sepolia first.
  • Ensure your chain ID is correct (8453 for mainnet).
  • Verify that your provider supports the methods you need (e.g., eth_getLogs for event indexing).

OnFinality's Base network page provides more details on available features and plans.

Key Takeaways

  • The Base mainnet RPC endpoint is https://base.api.onfinality.io/public with chain ID 8453.
  • For production, use a managed or dedicated RPC provider to avoid rate limits and ensure reliability.
  • Configure wallets and SDKs with the correct chain settings.
  • Use curl or libraries like ethers/viem to interact with the endpoint.
  • Debug common issues by checking rate limits, nonces, and network connectivity.

Frequently Asked Questions

What is the Base network RPC endpoint?

The Base network RPC endpoint is the URL used to send JSON-RPC requests to the Base blockchain. OnFinality provides a public endpoint at https://base.api.onfinality.io/public.

Is the public Base RPC endpoint free?

Yes, the public endpoint is free to use, but it has rate limits. For production, consider a paid plan.

What is the chain ID for Base?

The chain ID for Base mainnet is 8453. For Base Sepolia testnet, it is 84532.

How do I add Base to MetaMask?

Use the chain settings from the table above: RPC URL https://base.api.onfinality.io/public, chain ID 8453, symbol ETH, and explorer https://basescan.org.

What should I do if I get a 429 error?

A 429 error means you exceeded the rate limit. Upgrade to a managed or dedicated RPC service, or reduce your request frequency.

Can I use WebSocket with Base?

Yes, but the public endpoint only supports HTTPS. For WebSocket, you need a provider that offers it, such as OnFinality's dedicated nodes.

Where can I find more information about Base RPC?

Visit the Base network page on OnFinality for details on endpoints, plans, and features.

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