Logo
新用户订阅 RPC,首月享 6.5 折优惠查看优惠
RPC Assistant

What is the Base public RPC URL and which dev tools should you use with it?

摘要

The Base public RPC URL is a shared, no-key HTTP endpoint that lets you read chain data and send transactions to Base mainnet. OnFinality publishes a public endpoint at https://base.api.onfinality.io/public, and the Base Sepolia testnet equivalent is https://base-sepolia.api.onfinality.io/public. Public endpoints are ideal for prototyping, scripts, and low-volume reads, but they are shared infrastructure, so heavy or latency-sensitive workloads should move to a dedicated or managed RPC plan.

This page explains the chain settings you need (chain ID 8453 for mainnet, 84532 for Sepolia), how to wire the endpoint into common dev tools such as viem, ethers, Foundry, Hardhat, and wallet network configs, and how to decide when a public URL is enough versus when you need dedicated nodes. It also covers the failure modes you will hit first — rate limits, missing archive or trace methods, and WebSocket gaps — and how to debug them.

Chain settings at a glance

Before you paste an endpoint into any tool, confirm the four values that Base tooling checks first: the RPC URL, the chain ID, the native currency, and the block explorer. Getting the chain ID wrong is the most common reason a wallet or framework silently connects to the wrong network.

SettingBase mainnetBase Sepolia testnet
RPC URL (public)https://base.api.onfinality.io/publichttps://base-sepolia.api.onfinality.io/public
Chain ID845384532
Chain nameBaseBase Sepolia Testnet
Native currencyETH (18 decimals)ETH (18 decimals)
Block explorerhttps://basescan.orghttps://sepolia.basescan.org
TransportHTTPHTTP

Base is an OP Stack L2, so it behaves like an EVM chain: the same JSON-RPC methods, the same address format, and the same tooling. The only meaningful differences from Ethereum mainnet are the chain ID, the sequencer-driven block times, and the fact that some data (like L1 gas accounting) is exposed through L2-specific methods.

When a public RPC URL is the right fit

A public endpoint is the fastest way to get unblocked. It needs no API key, no signup, and no billing relationship, which makes it a good default for the first hour of a project. But it is shared infrastructure, so it comes with tradeoffs you should understand before you ship.

Use a public Base RPC URL when:

  • You are prototyping, writing a tutorial, or running a one-off script.
  • You need to read balances, call view functions, or estimate gas at low volume.
  • You are testing wallet network configuration or a faucet flow on Base Sepolia.
  • You want a fallback endpoint behind a primary provider.

Move to a managed or dedicated RPC plan when:

  • Your app sends a high volume of requests or bursts during peak hours.
  • You depend on eth_getLogs over wide block ranges, archive state, or trace methods.
  • You need WebSocket subscriptions for real-time events.
  • You need predictable throughput and a support path for production incidents.

OnFinality offers both shared RPC API access and dedicated nodes for Base, so you can start on the public endpoint and upgrade without changing your application code — only the URL changes. See RPC pricing for plan shapes and supported RPC networks for the full list.

Wiring the endpoint into common dev tools

The Base public RPC URL is a standard HTTP JSON-RPC endpoint, so it works anywhere an EVM RPC URL is accepted. Below are the patterns developers reach for most often.

curl and raw JSON-RPC

A quick sanity check that the endpoint is reachable and returning the expected chain ID:

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

You should get back "0x2105", which is 8453 in hex. If you get a different value, you are pointed at the wrong network.

viem

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

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

const block = await client.getBlockNumber()
console.log(block)

ethers v6

import { JsonRpcProvider } from 'ethers'

const provider = new JsonRpcProvider(
  'https://base.api.onfinality.io/public',
  { chainId: 8453, name: 'base' }
)

const fee = await provider.getFeeData()
console.log(fee)

Foundry

forge create src/MyContract.sol:MyContract \
  --rpc-url https://base.api.onfinality.io/public \
  --private-key $PRIVATE_KEY

Or set it once in foundry.toml:

[rpc_endpoints]
base = "https://base.api.onfinality.io/public"

Hardhat

// hardhat.config.js
module.exports = {
  networks: {
    base: {
      url: 'https://base.api.onfinality.io/public',
      chainId: 8453,
    },
    baseSepolia: {
      url: 'https://base-sepolia.api.onfinality.io/public',
      chainId: 84532,
    },
  },
}

Wallet network configuration

Most wallets accept a custom network object. The fields map directly to the table at the top of this page:

{
  "chainId": "0x2105",
  "chainName": "Base",
  "nativeCurrency": { "name": "Ether", "symbol": "ETH", "decimals": 18 },
  "rpcUrls": ["https://base.api.onfinality.io/public"],
  "blockExplorerUrls": ["https://basescan.org"]
}

If you are testing, swap in the Sepolia values and chain ID 0x14a34 (84532).

Base Sepolia: faucet, testnet settings, and debugging

Base Sepolia is the testnet most teams use before mainnet deploys. It mirrors mainnet settings except for the chain ID and explorer. You will need test ETH from a Base Sepolia faucet before you can deploy or send transactions.

Common testnet gotchas:

  • Wrong chain ID. If your tool reports a chain ID mismatch, check whether you are using 8453 (mainnet) where you meant 84532 (Sepolia).
  • No test ETH. Transactions fail with insufficient funds even though the endpoint is healthy. Grab test ETH from a faucet first.
  • Stale nonce. If you sent a transaction that never confirmed, the next one may fail with a nonce error. Reset the account nonce in your wallet or use a fresh key.
  • Explorer mismatch. Sepolia transactions appear on sepolia.basescan.org, not basescan.org. If you cannot find a transaction, you are probably on the wrong explorer.

For a dedicated testnet endpoint, see the Base Sepolia network page.

Public vs managed vs dedicated: what changes

Public endpoints and paid plans speak the same JSON-RPC protocol, so migration is usually a URL swap. What changes is the operational envelope around that URL.

DimensionPublic endpointManaged RPC APIDedicated node
API key requiredNoYesYes
ThroughputShared, best-effortPlan-basedReserved for you
Archive / trace methodsLimitedPlan-dependentConfigurable
WebSocket supportNot guaranteedOften availableConfigurable
Support pathCommunityProvider supportProvider support
Best forPrototypes, scriptsProduction appsHigh-volume or custom workloads

OnFinality provides managed RPC API access and dedicated nodes for Base and many other networks. If you are evaluating providers more broadly, the RPC provider selection guide walks through the criteria that matter for production.

Failure modes and how to debug them

When a Base RPC call fails, the error usually points to one of a handful of causes. The table below maps symptoms to likely fixes.

SymptomLikely causeFix
429 Too Many RequestsShared endpoint rate limitBack off, batch calls, or move to a managed plan
method not foundMethod not enabled on public endpointUse a provider that supports archive/trace methods
Timeout on eth_getLogsRange too wide for shared infraNarrow the block range or use a dedicated node
nonce too lowStuck or duplicated transactionReset nonce or use a fresh account
WebSocket disconnectPublic endpoints may not guarantee WSUse a provider with WebSocket support
Chain ID mismatchWrong endpoint for the networkConfirm 8453 vs 84532

A simple monitoring probe can tell you whether the endpoint is healthy before you blame your code:

curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" \
  -X POST https://base.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

Run this on a schedule and alert on non-200 responses or rising latency. It is a cheap way to catch endpoint problems before your users do.

Choosing between Base mainnet and Sepolia

Use mainnet when you are interacting with real value, real users, or production contracts. Use Sepolia when you are developing, testing upgrades, or running CI. Keep the two configurations separate in your codebase — for example, an environment variable that switches the RPC URL and chain ID together — so you never accidentally point a test script at mainnet.

A practical pattern is to define both networks in your config and select by environment:

const NETWORKS = {
  mainnet: { url: 'https://base.api.onfinality.io/public', chainId: 8453 },
  sepolia: { url: 'https://base-sepolia.api.onfinality.io/public', chainId: 84532 },
}

const net = NETWORKS[process.env.BASE_NETWORK || 'sepolia']

This keeps the endpoint, chain ID, and explorer aligned and makes the mainnet/testnet boundary explicit.

Key Takeaways

  • The Base public RPC URL is https://base.api.onfinality.io/public for mainnet (chain ID 8453) and https://base-sepolia.api.onfinality.io/public for Sepolia (chain ID 84532).
  • Public endpoints are ideal for prototyping, scripts, and low-volume reads, but they are shared and best-effort.
  • Base uses standard EVM JSON-RPC, so the same endpoint works in viem, ethers, Foundry, Hardhat, and wallet configs.
  • The most common failures are rate limits, missing archive/trace methods, WebSocket gaps, and chain ID mismatches.
  • When you outgrow the public endpoint, you can move to managed RPC or dedicated nodes without changing application code.
  • Check RPC pricing and supported networks before you commit to a plan.

Frequently Asked Questions

What is the Base public RPC URL?

OnFinality publishes a public Base mainnet endpoint at https://base.api.onfinality.io/public. It is a shared HTTP JSON-RPC endpoint that requires no API key.

What is the Base chain ID?

Base mainnet uses chain ID 8453. Base Sepolia uses chain ID 84532.

Is the Base public RPC URL good for production?

It can work for low-volume production traffic, but shared endpoints are best-effort. For predictable throughput, archive or trace methods, or WebSocket subscriptions, use a managed or dedicated plan.

Does the Base public RPC support WebSocket?

Public endpoints typically expose HTTP only. If your app relies on WebSocket subscriptions, choose a provider that offers WebSocket transport.

How do I switch from a public endpoint to a dedicated node?

In most cases you change the RPC URL in your config or environment variable. The JSON-RPC interface stays the same, so application code does not need to change.

Where can I find Base Sepolia testnet settings?

See the Base Sepolia network page for the testnet RPC URL, chain ID, and explorer.

Next steps

Start with the public endpoint to unblock development, then plan your production path. If you expect sustained traffic, wide log queries, or real-time subscriptions, compare RPC pricing and review supported RPC networks to see where OnFinality can host your Base workload. For a broader evaluation framework, read the RPC provider selection guide.

RPC 知识库

相关 RPC 内容

RPC 提供商选择Solana

在Solana质押集成中应关注哪些API

在Solana上集成质押需要使用能暴露账户数据、投票账户以及委托和提取等质押操作的API。合适的提供商应提供对 `getStakeActivation`、`getVoteAccounts` 和交易提交端点的可靠访问。本文涵盖了关键RPC方法以及选择质押dApp的API提供商时需要考虑的因素。...

网络 RPCOptimism

Optimism RPC:如何连接OP主网并选择最佳端点

# Optimism RPC:如何连接OP主网并选择最佳端点 Optimism是以太坊领先的Layer 2扩容解决方案,采用Optimistic Rollups技术,在继承以太坊安全性的同时提供低成本、快速的交易。要与OP主网交互——无论是发送交易、查询链上数据还是构建dApp——您需要一个Opti...

网络 RPCHyperliquid

选择 Hyperliquid RPC 提供商时应注意什么?

最佳的 Hyperliquid RPC 提供商能为交易机器人、分析系统和 HyperEVM 应用提供低延迟访问、可靠的端点行为、清晰的请求可见性,以及在共享 RPC 不再匹配工作负载时通往专用基础设施的路径。 如果你的应用依赖快速读取、交易状态检查、后端自动化或高流量市场工作流,那么提供商的选择就成...

区块链基础设施Bittensor

Bittensor 矿工设置:从钱包到注册 UID

设置 Bittensor 矿工意味着准备一个 coldkey/hotkey 钱包,为其充值 TAO,在子网上注册 UID,然后针对可靠的 Finney RPC 端点运行子网的矿工进程。RPC 层至关重要,因为注册、质押检查和元图同步都依赖于一致的链访问。 本指南将引导您完成实际设置路径、容易让人困惑...

网络 RPCKava

Kava API 端点:开发者需要了解的内容

Kava 结合了 Cosmos SDK 和以太坊虚拟机 (EVM) 兼容性,提供多种 API 接口:Tendermint RPC、EVM JSON-RPC、REST API 和 WebSocket 端点。本文解释了可用的端点类型、如何连接以及为生产环境 dApp 选择 Kava API 提供者时需评...

网络 RPCEfinity

Polygon 节点 RPC:端点、链设置和提供商选择

Polygon 节点 RPC 端点允许应用程序使用标准 JSON-RPC 接口在 Polygon 网络上读写数据。本页涵盖主网和 Amoy 测试网的链设置、如何使用常见工具连接,以及在选择公共、共享和专用 RPC 提供商时需要考虑的因素。...

永远不用担心基础设施

OnFinality 消除了 DevOps 的繁重工作,让您能够更聪明、更快地构建。

开始