DEV Community

OnFinality
OnFinality

Posted on Originally published at onfinality.io

Arbitrum Public RPC: Endpoints, Settings, and Provider Guide

Quick Recommendation: Which Arbitrum RPC Should You Use?

If you are prototyping or building a wallet, the official Arbitrum public RPC (https://arb1.arbitrum.io/rpc) is a fine starting point. For production dApps, however, you should evaluate managed RPC providers that offer higher rate limits, WebSocket support, and dedicated infrastructure. OnFinality provides a public Arbitrum endpoint at https://arbitrum.api.onfinality.io/public and dedicated node options for teams that need consistent performance. Check the Arbitrum network page for current details and the RPC pricing page for plan comparisons.

Arbitrum Public RPC Endpoints at a Glance

Arbitrum operates several chains, each with its own public RPC endpoint. The table below summarizes the official endpoints and chain IDs.

Network RPC URL Chain ID Explorer
Arbitrum One https://arb1.arbitrum.io/rpc 42161 Arbiscan
Arbitrum Nova https://nova.arbitrum.io/rpc 42170 Blockscout
Arbitrum Sepolia https://sepolia-rollup.arbitrum.io/rpc 421614 Sepolia Arbiscan

Note: The official Arbitrum public RPCs do not support WebSocket connections. For WebSocket support, you need a third-party provider.

Chain Settings for Wallet Configuration

When adding Arbitrum to a wallet or configuring a dApp, you need the correct chain parameters. Below are the settings for Arbitrum One and Arbitrum Sepolia.

Arbitrum One

  • Network Name: Arbitrum One
  • RPC URL: https://arbitrum.api.onfinality.io/public (or official https://arb1.arbitrum.io/rpc)
  • Chain ID: 42161
  • Currency Symbol: ETH
  • Block Explorer: https://arbiscan.io

Arbitrum Sepolia (Testnet)

  • Network Name: Arbitrum Sepolia
  • RPC URL: https://arbitrum-sepolia.api.onfinality.io/public (or official https://sepolia-rollup.arbitrum.io/rpc)
  • Chain ID: 421614
  • Currency Symbol: ETH
  • Block Explorer: https://sepolia.arbiscan.io

How to Add Arbitrum to MetaMask

To add Arbitrum One to MetaMask manually:

  1. Open MetaMask and click the network selector at the top.
  2. Click Add Network.
  3. Enter the following details:
    • Network Name: Arbitrum One
    • New RPC URL: https://arbitrum.api.onfinality.io/public
    • Chain ID: 42161
    • Currency Symbol: ETH
    • Block Explorer URL: https://arbiscan.io
  4. Click Save.

You can also use ChainList to add Arbitrum with one click.

Making JSON-RPC Calls to Arbitrum

Once you have an endpoint, you can interact with Arbitrum using standard Ethereum JSON-RPC methods. Here is a curl example to get the latest block number:

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

Expected response:

{"jsonrpc":"2.0","id":1,"result":"0x1d8a5f2"}
Enter fullscreen mode Exit fullscreen mode

Using Arbitrum RPC with ethers.js

For JavaScript developers, here is how to connect to Arbitrum using ethers.js:

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

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

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

getBlockNumber();
Enter fullscreen mode Exit fullscreen mode

Public vs. Managed RPC: What to Consider

Public RPC endpoints are free and convenient, but they come with limitations that can affect production apps. Here is a comparison to help you decide.

Factor Public RPC Managed RPC (e.g., OnFinality)
Rate limits Often low, shared Higher, configurable
Reliability Best-effort SLA-backed (verify current terms)
WebSocket support Not on official endpoints Often available
Archive data Usually not Often available
Dedicated infrastructure No Yes, with dedicated nodes
Support Community Professional support

For a deeper dive into provider selection, see our guide on choosing an RPC provider.

Common Pitfalls and Troubleshooting

Rate Limiting

Public endpoints often throttle requests. If you see 429 or 403 errors, consider upgrading to a managed provider or implementing retry logic.

WebSocket Not Supported

If you need real-time updates, the official Arbitrum public RPC does not support WebSocket. Use a provider that offers wss:// endpoints, such as OnFinality's dedicated nodes.

Chain ID Mismatch

Ensure your wallet or dApp uses the correct chain ID (42161 for Arbitrum One, 421614 for Sepolia). A mismatch will cause transaction failures.

Transaction Stuck

If transactions are stuck, check the nonce and gas price. Use eth_getTransactionByHash to inspect the transaction status.

Monitoring and Fallback Patterns

For production apps, implement monitoring and fallback to multiple RPC endpoints. Here is a simple health check script:

curl -s -X POST https://arbitrum.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq .result
Enter fullscreen mode Exit fullscreen mode

If the response is empty, switch to a fallback endpoint. Use a load balancer or a library like ethers that supports multiple providers.

Key Takeaways

  • Arbitrum One and Sepolia have official public RPC endpoints, but they lack WebSocket support.
  • For production, evaluate managed providers like OnFinality for higher reliability and features.
  • Always use the correct chain ID and network settings to avoid errors.
  • Implement monitoring and fallback to ensure high availability.

Frequently Asked Questions

What is the public RPC URL for Arbitrum One?

The official public RPC URL is https://arb1.arbitrum.io/rpc. OnFinality also provides a public endpoint at https://arbitrum.api.onfinality.io/public.

Does Arbitrum public RPC support WebSocket?

No, the official Arbitrum public RPC endpoints do not support WebSocket. You need a third-party provider for WebSocket connections.

What is the chain ID for Arbitrum One?

The chain ID is 42161.

How do I get an Arbitrum Sepolia testnet RPC?

The official testnet RPC is https://sepolia-rollup.arbitrum.io/rpc. OnFinality offers https://arbitrum-sepolia.api.onfinality.io/public.

Is it safe to use public RPC for production?

Public RPCs are not recommended for production due to rate limits and reliability concerns. Consider a managed provider like OnFinality for production workloads.

Where can I find more Arbitrum RPC providers?

Check the supported networks page for a list of networks and providers, or visit the Arbitrum docs for their official list.

Related resources

Originally published at OnFinality.

Top comments (0)