Skip to content

Connecting to Base

Connect to Base mainnet or the Sepolia testnet using public RPC endpoints, your own node, or a third-party provider.

ParameterValue
Network nameBase
Chain ID8453 (0x2105)
CurrencyETH
Block time2 seconds
Flashblock interval200ms
L1 settlementEthereum Mainnet
Explorerbasescan.org
ParameterValue
Network nameBase Sepolia
Chain ID84532 (0x14a34)
CurrencyETH (testnet)
Block time2 seconds
L1 settlementEthereum Sepolia
Explorersepolia.basescan.org

Base provides public RPC endpoints for general use:

NetworkHTTP EndpointWebSocket Endpoint
Mainnethttps://mainnet.base.orgwss://mainnet.base.org
Sepoliahttps://sepolia.base.orgwss://sepolia.base.org

A raw JSON-RPC POST request returns the latest block number as a hex string.

This is the lowest-common-denominator way to talk to Base — useful for sanity-checking that an endpoint is alive.

Terminal window
curl -X POST https://mainnet.base.org \
-H "Content-Type: application/json" \
-d '{
"method": "eth_blockNumber",
"params": [],
"id": 1,
"jsonrpc": "2.0"
}'

Foundry’s cast wraps every standard JSON-RPC method behind a clean CLI. Point it at any Base endpoint with --rpc-url.

Terminal window
cast block-number --rpc-url https://mainnet.base.org
cast balance 0xYourAddress --rpc-url https://mainnet.base.org
cast chain-id --rpc-url https://mainnet.base.org

JsonRpcProvider is the standard ethers entry point. It works against any Base endpoint — public, your own node, or a provider.

import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider("https://mainnet.base.org");
const blockNumber = await provider.getBlockNumber();
console.log("Current block:", blockNumber);
const balance = await provider.getBalance("0xYourAddress");
console.log("Balance:", balance.toString(), "wei");

viem ships chain definitions for both Base networks. createPublicClient selects the right RPC defaults automatically.

import { createPublicClient, http } from "viem";
import { base, baseSepolia } from "viem/chains";
const client = createPublicClient({
chain: base,
transport: http(),
});
const blockNumber = await client.getBlockNumber();
console.log("Current block:", blockNumber);
const testnetClient = createPublicClient({
chain: baseSepolia,
transport: http(),
});

To add Base to a wallet manually:

FieldMainnetSepolia
Network NameBaseBase Sepolia
RPC URLhttps://mainnet.base.orghttps://sepolia.base.org
Chain ID845384532
Currency SymbolETHETH
Block Explorer URLhttps://basescan.orghttps://sepolia.basescan.org

For production, running your own Base node gives full control over rate limits, latency, and data availability.

The fastest path is the pre-built Docker image:

Terminal window
docker pull ghcr.io/base/base-reth-node:latest
docker run -d \
--name base-node \
-p 8545:8545 \
-p 8546:8546 \
-p 30303:30303 \
-v base-data:/data \
ghcr.io/base/base-reth-node:latest \
--http \
--http.addr 0.0.0.0 \
--http.port 8545 \
--http.api eth,net,web3,txpool \
--ws \
--ws.addr 0.0.0.0 \
--ws.port 8546

For full instructions:

ModeDescriptionDisk usageSync time
FullExecutes all transactions from genesis.HighDays
SnapDownloads state snapshots, then follows chain tip.ModerateHours

Base nodes expose the standard Ethereum JSON-RPC interface. The following namespaces are available:

NamespaceDescription
ethCore Ethereum methods — blocks, transactions, state queries, gas estimation.
netNetwork information — peer count, version, listening status.
web3Utility methods — client version, SHA3.
txpoolTransaction pool inspection (see Transaction Pool).
debugDebug methods — trace transactions, get raw block data (enable with --http.api debug).
NamespaceDescription
baseBase-specific methods including metering (see Metering RPC).
MethodDescription
eth_blockNumberReturns the latest block number.
eth_getBlockByNumberReturns block data by number or tag.
eth_getBlockByHashReturns block data by hash.
eth_getTransactionByHashReturns a transaction by hash.
eth_getTransactionReceiptReturns a transaction receipt.
eth_getBalanceReturns account balance.
eth_getTransactionCountReturns account nonce.
eth_callExecutes a call without creating a transaction.
eth_estimateGasEstimates gas for a transaction.
eth_sendRawTransactionSubmits a signed transaction.
eth_getCodeReturns contract bytecode.
eth_getStorageAtReturns storage value at a given position.
eth_getLogsReturns logs matching a filter.
eth_chainIdReturns the chain ID.

The "pending" block tag is supported across applicable methods when flashblocks are enabled. See Flashblocks RPC for details on querying preconfirmed state.

IssueCauseSolution
429 Too Many RequestsRate limit exceeded on public endpoint.Reduce request frequency or run your own node.
Connection refused on port 8545Node HTTP RPC not enabled.Start the node with --http and --http.addr 0.0.0.0.
Empty response for eth_getLogsBlock range too large.Reduce the fromBlock/toBlock range (max ~2000 blocks per query).
Wrong chain IDConnected to wrong network.Verify the RPC URL matches the intended network.
nonce too lowTransaction nonce already used.Use "pending" tag with eth_getTransactionCount for the latest nonce.