Summary
A public Sepolia RPC endpoint is a free, shared JSON-RPC URL that lets you interact with the Ethereum Sepolia testnet without running your own node. It's ideal for quick prototyping, learning, and low-volume testing, but shared endpoints can have rate limits and variable performance. For production-grade dapps or load testing, consider a dedicated or managed RPC service like OnFinality.
Quick decision guide: public endpoint vs managed RPC
Before you copy a Sepolia RPC URL into your dapp, decide what you're building. A public endpoint is a shared, free JSON-RPC server that anyone can use. It's perfect for:
- Learning Ethereum development or testing a smart contract locally
- Building a hackathon project or a prototype that doesn't need high reliability
- Running occasional scripts or one-off queries
But if you're building a dapp that others will use, or you need to run load tests, a public endpoint can become a bottleneck. Shared endpoints often have rate limits, can throttle heavy usage, and may go down without notice. In those cases, you'll want a managed RPC service like OnFinality that provides dedicated or shared infrastructure with better reliability and support.
Rule of thumb: use a public endpoint for development and testing, but switch to a managed RPC before you deploy to production or run serious load tests.
Sepolia chain settings at a glance
Sepolia is Ethereum's primary testnet for application development. It's a proof-of-stake network that closely mirrors Ethereum mainnet, making it ideal for testing smart contracts and dapps. Here are the key chain settings you'll need to configure your wallet or dapp:
| Setting | Value |
|---|---|
| Network Name | Ethereum Sepolia |
| Chain ID | 11155111 (0xaa36a7) |
| Native Currency | Sepolia ETH (ETH) |
| Block Explorer | https://sepolia.etherscan.io |
| Public RPC Endpoint | https://eth-sepolia.api.onfinality.io/public |
| WebSocket Endpoint | Not available on public endpoint |
These settings are consistent with the Sepolia network page on OnFinality. Always verify the chain ID and explorer URL when adding a network to your wallet to avoid phishing or misconfiguration.
How to connect to Sepolia with a public RPC
You can use the public endpoint with any Ethereum-compatible tool. Here's how to connect using ethers.js (v6) in a Node.js environment:
const { ethers } = require('ethers');
const provider = new ethers.JsonRpcProvider('https://eth-sepolia.api.onfinality.io/public');
async function getBlockNumber() {
const blockNumber = await provider.getBlockNumber();
console.log('Current Sepolia block:', blockNumber);
}
getBlockNumber();
If you're using viem, the setup is similar:
import { createPublicClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const client = createPublicClient({
chain: sepolia,
transport: http('https://eth-sepolia.api.onfinality.io/public')
});
const blockNumber = await client.getBlockNumber();
console.log('Current Sepolia block:', blockNumber);
For a quick command-line test, you can use curl to call a JSON-RPC method:
curl https://eth-sepolia.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
The response will look something like:
{"jsonrpc":"2.0","id":1,"result":"0xaf9f5a"}
The result is the latest block number in hexadecimal. You can convert it to decimal using parseInt(result, 16).
Adding Sepolia to MetaMask or other wallets
If you're using a wallet like MetaMask, you can add Sepolia as a custom network. Here's the configuration you'll need:
- Network Name: Ethereum Sepolia
- New RPC URL:
https://eth-sepolia.api.onfinality.io/public - Chain ID: 11155111
- Currency Symbol: ETH
- Block Explorer URL:
https://sepolia.etherscan.io
You can also use the wallet_addEthereumChain RPC method to add the network programmatically from your dapp:
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0xaa36a7',
chainName: 'Ethereum Sepolia',
nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: ['https://eth-sepolia.api.onfinality.io/public'],
blockExplorerUrls: ['https://sepolia.etherscan.io']
}]
});
Getting Sepolia ETH from a faucet
To send transactions on Sepolia, you need test ETH. You can get free Sepolia ETH from public faucets. Some popular options include:
Faucets often require you to have a mainnet ETH balance or an Alchemy/Infura account. They also have daily limits to prevent abuse. If you're building a dapp that needs a steady supply of test ETH, consider running your own faucet or using a service that provides test tokens.
Common pitfalls and troubleshooting
Even with a public endpoint, you might run into issues. Here are some common problems and how to fix them:
Rate limiting
Public endpoints often have rate limits. If you're making many requests in a short time, you might get 429 Too Many Requests errors. To avoid this:
- Add caching to your dapp to reduce redundant calls
- Use batch requests when possible
- Consider a managed RPC service for higher limits
Connection timeouts
If the endpoint is slow or down, you might see timeouts. Public endpoints can be unreliable. You can implement retry logic in your code:
async function fetchWithRetry(url, options, retries = 3) {
for (let i = 0; i < retries; i++) {
try {
const response = await fetch(url, options);
return await response.json();
} catch (error) {
if (i === retries - 1) throw error;
await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
}
}
}
Incorrect chain ID
If you're connecting to the wrong network, you'll get errors. Always double-check that the chain ID is 11155111 and that the RPC URL points to Sepolia, not mainnet or another testnet.
WebSocket support
Public endpoints often don't support WebSocket connections. If you need real-time updates (e.g., for a trading bot), you'll need a provider that offers WebSocket endpoints. OnFinality's dedicated nodes can provide WebSocket support for Sepolia.
When to move beyond a public endpoint
Public endpoints are great for development, but they have limitations. Here's a comparison to help you decide when to upgrade:
| Factor | Public Endpoint | Managed RPC (e.g., OnFinality) |
|---|---|---|
| Cost | Free | Free tier available, paid plans for higher usage |
| Rate Limits | Often strict | Higher limits, configurable |
| Reliability | Variable, no SLA | Better uptime, support |
| WebSocket | Usually not available | Available on dedicated nodes |
| Archive Data | Limited | Available on request |
| Custom Methods | No | Yes (e.g., trace, debug) |
If you're building a production dapp, running load tests, or need WebSocket support, consider a managed RPC service. OnFinality offers RPC pricing that scales with your needs, and you can find supported networks on our networks page.
Key Takeaways
- A public Sepolia RPC endpoint is a free, shared JSON-RPC URL for interacting with the Sepolia testnet.
- Use it for development, testing, and learning; switch to a managed RPC for production or heavy usage.
- The Sepolia chain ID is
11155111, and the native currency is Sepolia ETH. - You can connect using ethers.js, viem, or curl with the public endpoint.
- Public endpoints may have rate limits and lack WebSocket support; consider a dedicated node for those needs.
Frequently Asked Questions
What is the public Sepolia RPC endpoint?
The public Sepolia RPC endpoint is https://eth-sepolia.api.onfinality.io/public. It's a free, shared endpoint that allows you to interact with the Ethereum Sepolia testnet.
Can I use a public Sepolia RPC for production?
It's not recommended. Public endpoints are shared and may have rate limits or downtime. For production dapps, use a managed RPC service with better reliability and support.
How do I get Sepolia ETH?
You can get free Sepolia ETH from public faucets like Alchemy, Infura, or Google Cloud. These faucets usually require an account and have daily limits.
Does the public Sepolia RPC support WebSocket?
The public endpoint typically does not support WebSocket. If you need real-time updates, consider a dedicated node that offers WebSocket support.
What is the chain ID for Sepolia?
The chain ID for Ethereum Sepolia is 11155111 (hex 0xaa36a7).