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 内容

RPC 提供商选择Base

哪些 RPC 提供商支持 Base RPC?

Base 是一个基于 OP Stack 构建的以太坊 Layer 2 网络,许多 RPC 提供商都为其提供端点。本文介绍了在选择 Base RPC 提供商时需要注意的事项,包括端点类型、可靠性和定价,并列出了值得考虑的几家主要提供商。...

RPC 提供商选择

即用即付区块链节点如何运作,何时应该使用它们?

即用即付区块链节点是按实际使用量计费而非固定月费的托管 RPC 端点。这种模式适合流量不均衡、多链实验或早期阶段产品的团队,因为它能使基础设施成本与需求保持一致。 在采用按使用量计费的计划之前,请将速率限制、超额定价、WebSocket 支持和归档数据访问与您的预期工作负载进行比较。使用真实流量样本...

RPC 提供商选择Stellar

如何为 Soroban 应用选择 Stellar RPC 提供商?

Stellar RPC 让你能够实时访问 Stellar 网络数据,用于 Soroban 智能合约、账户余额和交易提交。不同提供商在网络覆盖、归档支持、专用节点访问和定价方面有所差异,因此正确选择取决于你的应用工作负载。 本指南介绍了什么是 Stellar RPC、需要比较的功能,以及如何在做出承诺...

网络 RPCEfinity

Kaia 公共节点:端点、提供商和生产注意事项

Kaia 公共节点让您无需运行自己的端点节点即可与 Kaia 主网和 Kairos 测试网交互。本文介绍了官方公共端点、如何选择可靠的 RPC 提供商,以及生产工作负载的注意事项。...

网络 RPCPolygon

Polygon区块链API:方法、SDK和最佳实践

Polygon区块链API包括用于直接节点交互的JSON-RPC端点、用于支付的REST API(如Open Money Stack)以及客户端SDK(如Matic.js和ethers.js)。选择合适的API取决于你的用例——是需要底层链访问、稳定币支付还是智能合约交互。本文涵盖了可用的API类型...

网络 RPCpeaq

Peaq RPC:如何连接DePIN Layer 1

# Peaq RPC:如何连接DePIN Layer 1 Peaq 是一个基于 Substrate 构建的 Layer 1 区块链,作为 Polkadot 平行链运行,专为去中心化物理基础设施网络(DePIN)和机器经济设计。它提供双执行环境——兼容 EVM 的智能合约和 Substrate pal...

永远不用担心基础设施

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

开始