Summary
Ethereum RPC (Remote Procedure Call) is the standard protocol for interacting with the Ethereum blockchain. It allows applications to send transactions, query data, and invoke smart contracts via JSON-RPC methods. This guide covers Ethereum mainnet and testnet chain settings, public and private RPC endpoints, common methods, and troubleshooting tips to help developers integrate and debug Ethereum RPC effectively.
Key Takeaways
- Ethereum RPC uses JSON-RPC to interact with the blockchain; each Ethereum client implements the same specification.
- Mainnet chain ID is 1, native currency ETH; common testnets include Sepolia (11155111) and Holesky (17000).
- Public RPC endpoints are free but may have rate limits; private or dedicated nodes offer higher performance and reliability.
- Essential RPC methods include eth_call, eth_sendRawTransaction, eth_getBalance, and eth_getLogs.
- Common issues include rate limiting, nonce errors, and incorrect block parameter settings.
- Dedicated nodes are recommended for production dApps requiring consistent low latency and archive data access.
- Managed RPC services simplify operations with automatic failover, WebSocket support, and multiple endpoint options.
What Is Ethereum RPC?
Ethereum RPC (Remote Procedure Call) is the communication protocol that allows external applications—wallets, dApps, backend services—to interact with an Ethereum node. It uses the JSON-RPC standard, meaning requests are JSON objects with a method name and parameters, and responses are JSON with the result or error.
Every Ethereum execution client (Geth, Nethermind, Erigon, etc.) implements the same JSON-RPC API, making it easy to switch providers without changing application code. The API covers operations like reading block data, sending transactions, and executing smart contract functions.
OnFinality provides Ethereum RPC endpoints for both mainnet and testnets, accessible via simple API keys or public endpoints for development.
- Standard JSON-RPC 2.0 protocol
- Transport agnostic (HTTP, WebSocket, IPC)
- All Ethereum clients share the same API specification
- Essential for reading chain state and broadcasting transactions
Ethereum Mainnet and Testnet Chain Settings
To connect to Ethereum, you need the correct chain ID, RPC URL, and native currency symbol. Below are the key settings for the main network and commonly used testnets.
Testnets like Sepolia and Holesky are ideal for development and testing. They use the same RPC methods as mainnet but with free faucet ETH.
| Criterion | What to check | Why it matters |
|---|---|---|
| Network | Mainnet | Production environment for real assets |
| Chain ID | 1 (0x1) | Required for transaction signing and network identification |
| Currency | ETH | Gas fees and value transfer |
| Public RPC (HTTP) | https://eth.api.onfinality.io/public | Free endpoint for development and low-traffic apps |
| WebSocket | wss://eth.api.onfinality.io/public-ws | Real-time data for wallets and event listeners |
| Sepolia Testnet | Chain ID 11155111, RPC: https://sepolia.api.onfinality.io/public | Most popular testnet for dApp development |
| Holesky Testnet | Chain ID 17000, RPC: https://holesky.api.onfinality.io/public | Larger testnet for staking and protocol testing |
Public vs Private RPC Endpoints
Public RPC endpoints are free and easy to use, but they often have rate limits (e.g., requests per second) and may throttle heavy usage. They are suitable for prototyping, small-scale dApps, and wallet connections.
Private RPC endpoints require an API key and offer higher rate limits, dedicated throughput, and usually access to archive data. For production applications with many users or high transaction volumes, a private endpoint is recommended.
Some providers also offer dedicated nodes—a full node instance reserved for your project—giving you complete control over resources, custom configurations, and no rate limits. OnFinality supports both shared and dedicated options for Ethereum.
- Public: Free, no API key, rate limited, best for development
- Private: API key required, higher limits, archive access, reliable for production
- Dedicated: Isolated node, maximum performance and customization
Common Ethereum RPC Methods
For example, to get the latest balance of an address using curl: curl -X POST <RPC_URL> -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x...","latest"],"id":1}'
- Chain State: eth_blockNumber, eth_getBalance, eth_getStorageAt, eth_gasPrice
- Transaction: eth_sendRawTransaction, eth_getTransactionReceipt, eth_estimateGas
- Smart Contracts: eth_call, eth_getLogs, eth_getTransactionByHash
- Filters: eth_newBlockFilter, eth_newFilter, eth_getFilterChanges
- WebSocket: eth_subscribe (for real-time events)
Debugging Common Ethereum RPC Issues
Developers often encounter a few standard problems when working with Ethereum RPC. Understanding them helps in quick resolution.
- Rate Limiting: Hitting the RPC provider's request limit. Solution: upgrade to a paid plan or use a private endpoint.
- Nonce Too Low: Transaction nonce is less than the current account nonce. Always fetch the current nonce via eth_getTransactionCount before sending.
- Block Parameter: Using wrong block parameter (e.g., 'pending' vs 'latest') can cause unexpected results. For pending state, use 'pending' instead of 'latest'.
- Gas Estimation Failures: eth_estimateGas may fail if the transaction would revert. Use eth_call with the same parameters to debug.
- WebSocket Disconnection: Ensure proper reconnection logic and handle eth_subscribe failures gracefully.
Frequently Asked Questions
What is the Ethereum RPC URL for mainnet?
A public Ethereum mainnet RPC URL is https://eth.api.onfinality.io/public. For private access, sign up to get an API key.
What is the difference between eth_call and eth_sendRawTransaction?
eth_call simulates a transaction without broadcasting it to the network (read-only). eth_sendRawTransaction submits a signed transaction to the blockchain for execution.
How do I get Ethereum testnet ETH?
Use faucets like Sepolia Faucet or Holesky Faucet to request free test ETH for development.
Why am I getting 'nonce too low' error?
The nonce you provided is lower than the current transaction count for that account. Get the latest nonce via eth_getTransactionCount and increment correctly.
Can I use WebSocket for real-time Ethereum data?
Yes, use WebSocket endpoints like wss://eth.api.onfinality.io/public-ws and subscribe to new headers, logs, or pending transactions.