Connecting to Base
Connect to Base mainnet or the Sepolia testnet using public RPC endpoints, your own node, or a third-party provider.
Network parameters
Section titled “Network parameters”Base Mainnet
Section titled “Base Mainnet”| Parameter | Value |
|---|---|
| Network name | Base |
| Chain ID | 8453 (0x2105) |
| Currency | ETH |
| Block time | 2 seconds |
| Flashblock interval | 200ms |
| L1 settlement | Ethereum Mainnet |
| Explorer | basescan.org |
Base Sepolia (testnet)
Section titled “Base Sepolia (testnet)”| Parameter | Value |
|---|---|
| Network name | Base Sepolia |
| Chain ID | 84532 (0x14a34) |
| Currency | ETH (testnet) |
| Block time | 2 seconds |
| L1 settlement | Ethereum Sepolia |
| Explorer | sepolia.basescan.org |
Public RPC endpoints
Section titled “Public RPC endpoints”Base provides public RPC endpoints for general use:
| Network | HTTP Endpoint | WebSocket Endpoint |
|---|---|---|
| Mainnet | https://mainnet.base.org | wss://mainnet.base.org |
| Sepolia | https://sepolia.base.org | wss://sepolia.base.org |
Connecting with common tools
Section titled “Connecting with common tools”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.
curl -X POST https://mainnet.base.org \ -H "Content-Type: application/json" \ -d '{ "method": "eth_blockNumber", "params": [], "id": 1, "jsonrpc": "2.0" }'cast (Foundry)
Section titled “cast (Foundry)”Foundry’s cast wraps every standard JSON-RPC method behind a clean CLI. Point it at any Base endpoint with --rpc-url.
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.orgethers.js
Section titled “ethers.js”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(),});MetaMask / wallet configuration
Section titled “MetaMask / wallet configuration”To add Base to a wallet manually:
| Field | Mainnet | Sepolia |
|---|---|---|
| Network Name | Base | Base Sepolia |
| RPC URL | https://mainnet.base.org | https://sepolia.base.org |
| Chain ID | 8453 | 84532 |
| Currency Symbol | ETH | ETH |
| Block Explorer URL | https://basescan.org | https://sepolia.basescan.org |
Running your own node
Section titled “Running your own node”For production, running your own Base node gives full control over rate limits, latency, and data availability.
Quick start
Section titled “Quick start”The fastest path is the pre-built Docker image:
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 8546For full instructions:
- Building from source — compile the node binary.
- Running the node — configuration and startup.
- Docker — containerized deployment.
- Node deployment — production deployment guide.
Node sync modes
Section titled “Node sync modes”| Mode | Description | Disk usage | Sync time |
|---|---|---|---|
| Full | Executes all transactions from genesis. | High | Days |
| Snap | Downloads state snapshots, then follows chain tip. | Moderate | Hours |
JSON-RPC interface
Section titled “JSON-RPC interface”Base nodes expose the standard Ethereum JSON-RPC interface. The following namespaces are available:
Standard namespaces
Section titled “Standard namespaces”| Namespace | Description |
|---|---|
eth | Core Ethereum methods — blocks, transactions, state queries, gas estimation. |
net | Network information — peer count, version, listening status. |
web3 | Utility methods — client version, SHA3. |
txpool | Transaction pool inspection (see Transaction Pool). |
debug | Debug methods — trace transactions, get raw block data (enable with --http.api debug). |
Base-specific namespaces
Section titled “Base-specific namespaces”| Namespace | Description |
|---|---|
base | Base-specific methods including metering (see Metering RPC). |
Commonly used methods
Section titled “Commonly used methods”| Method | Description |
|---|---|
eth_blockNumber | Returns the latest block number. |
eth_getBlockByNumber | Returns block data by number or tag. |
eth_getBlockByHash | Returns block data by hash. |
eth_getTransactionByHash | Returns a transaction by hash. |
eth_getTransactionReceipt | Returns a transaction receipt. |
eth_getBalance | Returns account balance. |
eth_getTransactionCount | Returns account nonce. |
eth_call | Executes a call without creating a transaction. |
eth_estimateGas | Estimates gas for a transaction. |
eth_sendRawTransaction | Submits a signed transaction. |
eth_getCode | Returns contract bytecode. |
eth_getStorageAt | Returns storage value at a given position. |
eth_getLogs | Returns logs matching a filter. |
eth_chainId | Returns the chain ID. |
Flashblocks support
Section titled “Flashblocks support”The "pending" block tag is supported across applicable methods when flashblocks are enabled. See Flashblocks RPC for details on querying preconfirmed state.
Troubleshooting
Section titled “Troubleshooting”Common issues
Section titled “Common issues”| Issue | Cause | Solution |
|---|---|---|
429 Too Many Requests | Rate limit exceeded on public endpoint. | Reduce request frequency or run your own node. |
| Connection refused on port 8545 | Node HTTP RPC not enabled. | Start the node with --http and --http.addr 0.0.0.0. |
Empty response for eth_getLogs | Block range too large. | Reduce the fromBlock/toBlock range (max ~2000 blocks per query). |
| Wrong chain ID | Connected to wrong network. | Verify the RPC URL matches the intended network. |
nonce too low | Transaction nonce already used. | Use "pending" tag with eth_getTransactionCount for the latest nonce. |
Further reading
Section titled “Further reading”- Flashblocks RPC — query preconfirmed state with the
"pending"tag. - Transaction Pool — inspect and manage the txpool.
- Metering RPC — resource metering API.
- Node configuration — detailed node configuration options.
- Monitoring — observability and metrics.