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

What is an Ethereum RPC endpoint and how do you choose the right one?

摘要

An Ethereum RPC endpoint is the URL your dapp, wallet, or backend uses to talk to an Ethereum node via JSON-RPC. Public endpoints are free but rate-limited, while managed and dedicated endpoints offer higher limits, archive data, and WebSocket support. This guide explains how RPC works, how to pick an endpoint for production, and how to configure it in common tools.

When you search for "rpc eth", you are likely trying to connect a wallet, dapp, or backend service to the Ethereum network. The first result is often ChainList, which lists RPC URLs and chain settings. But choosing an RPC endpoint is more than copying a URL. This guide explains what an Ethereum RPC endpoint is, how to evaluate providers, and how to configure the endpoint in common tools.

Quick recommendation: match the endpoint to your workload

Before diving into details, here is a quick way to decide which type of Ethereum RPC endpoint fits your use case:

WorkloadRecommended endpoint typeWhy
Prototyping, hackathon, or wallet demoPublic endpointFree, no signup, good enough for light traffic
Production dapp with moderate trafficManaged shared endpointHigher rate limits, better reliability, often includes WebSocket
High-throughput or data-heavy app (indexers, bots)Dedicated nodeIsolated resources, archive data, custom limits
Trading or latency-sensitive appDedicated node with WebSocketLow latency, real-time subscriptions, no noisy neighbors

If you are building a production app, a public endpoint is rarely sufficient. You need a provider that offers SLAs, archive data, and support. OnFinality provides managed RPC endpoints and dedicated nodes for Ethereum and many other networks. Check the RPC pricing page for details.

What is an Ethereum RPC endpoint?

Ethereum nodes expose a JSON-RPC API over HTTP or WebSocket. An RPC endpoint is simply the URL where that API is available. For example, the OnFinality public Ethereum endpoint is https://eth.api.onfinality.io/public. When you send a request to this URL, you are asking an Ethereum node to execute a method like eth_blockNumber or eth_getBalance.

JSON-RPC is a stateless protocol: each request is independent and contains a method name, parameters, and an ID. The node returns a JSON response with the result or an error. This is the foundation of all Ethereum tooling, from wallets like MetaMask to libraries like ethers.js and viem.

Ethereum chain settings at a glance

When configuring a wallet or dapp, you need the chain ID, native currency, and RPC URL. Here are the settings for Ethereum mainnet and Sepolia testnet:

NetworkChain IDNative CurrencyRPC URLExplorer
Ethereum Mainnet1ETHhttps://eth.api.onfinality.io/publicEtherscan
Sepolia11155111Sepolia ETHhttps://eth-sepolia.api.onfinality.io/publicSepolia Etherscan

These settings are used in wallet configuration, dapp network switching, and backend setup. Always verify the chain ID matches the network you intend to use; a mismatch can cause transactions to be sent to the wrong chain.

How to configure an Ethereum RPC endpoint in a wallet

Most wallets allow you to add a custom network. In MetaMask, for example, you can go to Settings > Networks > Add Network and enter the chain ID, RPC URL, and symbol. Here is a typical configuration for Ethereum mainnet:

{
  "chainId": "0x1",
  "chainName": "Ethereum Mainnet",
  "nativeCurrency": {
    "name": "Ether",
    "symbol": "ETH",
    "decimals": 18
  },
  "rpcUrls": ["https://eth.api.onfinality.io/public"],
  "blockExplorerUrls": ["https://etherscan.io"]
}

Note that the chain ID is in hexadecimal (0x1 for mainnet). Many wallet configuration errors come from using the decimal chain ID (1) instead of the hex format.

Using the Ethereum RPC endpoint in code

In a JavaScript dapp, you can use ethers.js or viem to connect to an Ethereum RPC endpoint. Here is an example with ethers.js:

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

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

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

getBlockNumber();

With viem, the setup is similar:

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

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

const blockNumber = await client.getBlockNumber();
console.log("Current block:", blockNumber);

For WebSocket subscriptions, use a wss:// endpoint. OnFinality supports WebSocket on Ethereum mainnet; contact support or check the network page for the exact URL.

Public vs. managed vs. dedicated Ethereum RPC

There are three main ways to access Ethereum RPC:

  • Public endpoints: Free, no authentication, but shared across all users. They are fine for development and light usage, but they often have rate limits and can be unreliable under load.
  • Managed shared endpoints: Provided by RPC providers like OnFinality. They offer higher rate limits, better uptime, and often include features like archive data and WebSocket. You pay per request or per month.
  • Dedicated nodes: You get a private node instance with dedicated resources. This is the most reliable and performant option, but also the most expensive. It is ideal for high-throughput applications, indexers, and trading bots.

When comparing providers, consider the following criteria:

CriterionWhat to checkWhy it matters
Rate limitsRequests per second (RPS) and daily/monthly capsPrevents throttling during traffic spikes
Archive dataDoes the provider support eth_getLogs on historical blocks?Needed for indexers and analytics
WebSocket supportIs wss:// available?Required for real-time subscriptions
Trace methodsDoes it support trace_* or debug_*?Needed for debugging and advanced analysis
Geographic distributionWhere are the nodes located?Affects latency for global users
Uptime SLAWhat is the reliability expectations?Determines reliability for production

OnFinality offers both shared RPC and dedicated nodes for Ethereum. You can start with a free tier and scale as your project grows.

Common Ethereum RPC methods and how to test them

Here are some frequently used Ethereum JSON-RPC methods:

  • eth_blockNumber: returns the latest block number
  • eth_getBalance: returns the balance of an address
  • eth_call: executes a read-only contract call
  • eth_sendRawTransaction: broadcasts a signed transaction
  • eth_getLogs: retrieves event logs (useful for indexing)
  • eth_subscribe: creates a WebSocket subscription (e.g., for new blocks)

You can test an RPC endpoint with a simple curl command:

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

The response should look like:

{"jsonrpc":"2.0","id":1,"result":"0x10d4f"}

The result is a hexadecimal block number. You can convert it to decimal to see the current block height.

Troubleshooting Ethereum RPC issues

Common problems when using Ethereum RPC endpoints include:

  • Rate limiting: You get HTTP 429 or "rate limit exceeded" errors. Solution: use a managed endpoint with higher limits or a dedicated node.
  • Timeout: Requests take too long or fail. Solution: check your network connection, try a different endpoint, or use a provider with better geographic coverage.
  • Incorrect chain ID: Transactions fail because the chain ID does not match. Solution: verify the chain ID in your configuration.
  • WebSocket disconnects: Subscriptions drop frequently. Solution: use a dedicated WebSocket endpoint and implement reconnection logic.

If you are using a public endpoint and experiencing issues, consider upgrading to a managed RPC or dedicated node. OnFinality provides reliable infrastructure for production workloads.

Key Takeaways

  • An Ethereum RPC endpoint is the URL for JSON-RPC requests to an Ethereum node.
  • Public endpoints are fine for development, but production apps need managed or dedicated options.
  • Always verify chain ID and use the correct RPC URL for the network (mainnet vs. testnet).
  • Test your endpoint with curl or a library like ethers.js before deploying.
  • Compare providers on rate limits, archive data, WebSocket, and uptime.

Frequently Asked Questions

What is the difference between HTTP and WebSocket RPC?

HTTP is request-response, suitable for one-off queries. WebSocket is a persistent connection that allows the server to push updates, ideal for real-time subscriptions like new blocks or pending transactions.

Can I use a public Ethereum RPC endpoint in production?

You can, but it is not recommended. Public endpoints are shared and rate-limited, which can cause downtime or throttling during traffic spikes. A managed or dedicated endpoint offers better reliability and support.

How do I get an Ethereum RPC API key?

With OnFinality, you can sign up and get an API key for managed endpoints. The key is used in the URL, like https://eth.api.onfinality.io/v2/<api-key>. Dedicated nodes do not require a key but are provisioned for your use.

What is an archive node?

An archive node stores the full state of the blockchain at every block, allowing queries like eth_getBalance at historical blocks. This is essential for indexers and analytics. OnFinality offers archive data on Ethereum; check the network page for details.

How do I choose between shared and dedicated RPC?

If your app has moderate traffic and you want a balance of cost and reliability, a shared managed endpoint is a good choice. If you need high throughput, low latency, or custom configuration, a dedicated node is better. Evaluate your workload and budget.

For more information, explore the supported networks and RPC pricing pages.

RPC 知识库

相关 RPC 内容

网络 RPCBittensor

什么是 Bittensor 子网 123,如何与之交互?

Bittensor 子网 123 是 Bittensor 生态系统中一个专门的子网络,旨在激励特定的机器学习或数据相关任务。本文解释了子网 123 的功能、它在 Bittensor 架构中的位置,以及开发者如何使用 RPC 端点连接它、注册矿工或验证者,并监控性能。...

网络 RPCBase

Base RPC 节点:端点、链设置和调试

Base 是一个基于 OP Stack 构建的以太坊 Layer 2 网络。要与 Base 交互,您需要一个 RPC 端点,让您的应用程序能够读取和写入链上数据。本页涵盖官方 Base RPC 端点、链设置、常见请求模式以及如何调试连接问题。...

网络 RPCArbitrum

如何检查 Arbitrum One 的正常运行时间,这对你的 dApp 意味着什么?

Arbitrum One 的正常运行时间在官方 Arbitrum 状态页面上进行跟踪,该页面报告排序器、批量发布器、验证器和数据源等核心组件的健康状况。对于 dApp 开发者来说,了解这一正常运行时间很重要,因为它影响交易最终性、数据可用性和 RPC 可靠性。本指南解释了如何阅读状态页面、哪些正常运...

RPC 故障排查Solana

Solana 端点问题:如何诊断和修复 RPC 故障

Solana 端点问题可能导致 dApp 和交易机器人停滞。本文介绍了常见的故障模式——超时、429、WebSocket 断开和槽位滞后——并展示了如何使用 curl 和监控来诊断它们。它还解释了何时公共端点是瓶颈,以及专用 RPC 节点如何稳定您的工作负载。...

网络 RPCBNB Chain

什么是BNB节点,什么时候应该运行一个?

BNB节点是存储BNB智能链状态并处理交易的客户端。运行一个节点可以让您直接访问链,但需要大量的硬件和维护。对于大多数应用程序,像OnFinality这样的托管RPC服务提供了一种更实用的方式来与BNB链交互,而无需承担运营开销。...

网络 RPCSolana

Solana RPC 端点:如何连接、配置和调试

Solana RPC 端点是您的 dApp 或验证器用来向 Solana 网络发送 JSON-RPC 请求的 URL。本页介绍主网和开发网端点、如何在代码中配置它们,以及如何调试常见的连接问题。对于生产环境的工作负载,OnFinality 提供的托管或专用 RPC 端点可提供可靠性和可扩展性。...

永远不用担心基础设施

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

开始