Summary
A public Solana RPC endpoint is a shared, no-signup URL that lets you read from and submit transactions to Solana mainnet without running your own validator or RPC node. It is ideal for learning, prototyping, hackathon demos, and low-volume scripts, but shared capacity means you should expect variable performance and rate limits under load.
This page explains how public Solana RPC works, how to connect with curl and JavaScript, the exact mainnet settings you need, and the point at which a managed or dedicated endpoint becomes the better choice for production apps.
A public Solana RPC endpoint is a shared, openly reachable URL that lets any client read Solana state and submit transactions without running a validator or RPC node. You paste the URL into your wallet, script, or dApp, and it answers JSON-RPC calls over HTTP or WebSocket. The trade-off is that you share that capacity with everyone else using the same URL.
This page covers how public Solana RPC actually behaves, the exact mainnet settings, working request examples, and the signals that tell you it is time to move to a managed or dedicated endpoint.
Is a public Solana RPC endpoint the right fit for your project?
Use this short guide before you commit to a public endpoint for anything beyond a quick test.
| Your situation | Public endpoint | Managed/shared endpoint | Dedicated node |
|---|---|---|---|
| Learning Solana, tutorials, hackathons | Good fit | Fine | Overkill |
| Wallet or dApp demo with a few users | Workable | Better | Overkill |
| Production app with real traffic | Risky | Recommended | Best for heavy or latency-sensitive loads |
Indexing, getProgramAccounts, backfills | Not suitable | Possible with limits | Recommended |
| Trading bots, WebSocket subscriptions | Not suitable | Possible | Recommended |
If you are still exploring, a public endpoint is the fastest way to start. If you are shipping to real users, plan the upgrade path early rather than after your first rate-limit incident.
How public Solana RPC differs from a private endpoint
Public endpoints are usually operated as a courtesy or as a funnel into a paid service. They are shared, they are rate-limited, and they are not designed for sustained throughput. A private or managed endpoint gives you a dedicated API key, higher request budgets, and a support path when something breaks.
The practical differences show up in three places:
- Throughput. Public endpoints throttle aggressive clients. Bursts of
getProgramAccountsor log subscriptions are the first things to get cut. - Consistency. Shared load means latency varies through the day. That is fine for a block explorer refresh, painful for a trading loop.
- Support. When a public endpoint returns errors, you usually have no channel to ask why. Managed providers give you status pages and a way to escalate.
Solana mainnet settings at a glance
If you are wiring Solana into a wallet, dApp, or script, these are the values you need. They match the OnFinality Solana network configuration.
| Setting | Value |
|---|---|
| Network | Solana Mainnet |
| Native currency | SOL (9 decimals) |
| HTTP RPC | https://solana.api.onfinality.io/public |
| WebSocket RPC | wss://solana.api.onfinality.io/public-ws |
| Block explorer | https://explorer.solana.com |
| Transports supported | HTTP, WebSocket |
For devnet work, use the Solana Devnet RPC page instead of pointing test code at mainnet.
Connecting with curl and JSON-RPC
Solana speaks JSON-RPC 2.0. The simplest sanity check is a getHealth call, which tells you whether the node is caught up and serving requests.
curl https://solana.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
}'
A healthy node returns {"jsonrpc":"2.0","result":"ok","id":1}. If you get a timeout or a 429, that is your first signal that the endpoint is under pressure.
To read a balance, use getBalance with a base58 public key:
curl https://solana.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": ["11111111111111111111111111111111"]
}'
The result is in lamports. Divide by 1,000,000,000 to get SOL.
Using a public Solana RPC from JavaScript
Most Solana apps use @solana/web3.js. Pointing it at a public endpoint is a one-line change, but you should still wrap calls so you can swap the URL later.
import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
const connection = new Connection(
"https://solana.api.onfinality.io/public",
"confirmed"
);
const wallet = new PublicKey("11111111111111111111111111111111");
const lamports = await connection.getBalance(wallet);
console.log("Balance:", lamports / LAMPORTS_PER_SOL, "SOL");
Keep the endpoint in an environment variable so you can move from a public URL to a managed or dedicated one without touching business logic.
WebSocket subscriptions on a shared endpoint
Solana's WebSocket API is where public endpoints struggle most. accountSubscribe, logsSubscribe, and slotSubscribe hold long-lived connections, and shared infrastructure tends to drop them under load.
const ws = new WebSocket("wss://solana.api.onfinality.io/public-ws");
ws.onopen = () => {
ws.send(JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "slotSubscribe"
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.method === "slotNotification") {
console.log("New slot:", msg.params.result.slot);
}
};
If you rely on subscriptions for a live UI or a bot, treat a public WebSocket as a development convenience, not a production transport. Plan for reconnects, backoff, and a fallback endpoint.
Where public Solana RPC starts to break down
These are the failure modes developers hit most often when they push a public endpoint too far.
| Symptom | Likely cause | What to do |
|---|---|---|
| HTTP 429 responses | Shared rate limit exceeded | Reduce request rate, batch calls, or move to a managed endpoint |
| WebSocket disconnects | Long-lived connections dropped under load | Add reconnect logic and consider a dedicated endpoint |
getProgramAccounts timeouts | Heavy scan on shared capacity | Use a filtered query or an indexer; avoid on public endpoints |
| Stale or lagging reads | Node behind the tip | Check getHealth and getSlot; fail over to another endpoint |
| Inconsistent latency | Noisy-neighbour load | Move latency-sensitive calls to a dedicated node |
When to move to managed or dedicated Solana RPC
A public endpoint is a starting point, not a destination. The move is usually triggered by one of these:
- You are shipping to real users and cannot afford 429s during a launch or airdrop.
- You run trading or liquidation logic where a dropped WebSocket costs money.
- You need archive history,
getProgramAccounts, or trace-style debugging that public endpoints do not serve. - You want a support channel and a status page you can point your on-call rotation at.
OnFinality provides Solana RPC as a managed API and as dedicated nodes when you need isolated capacity. You can review RPC pricing and the full list of supported RPC networks to plan the upgrade. The Solana network page has the current endpoint details.
A practical migration checklist
When you decide to leave the public endpoint, work through this in order:
- Externalise the endpoint. Move the URL into config or an environment variable.
- Add health checks. Probe
getHealthandgetSloton a schedule and log failures. - Instrument latency. Track p50 and p95 per method so you can compare providers fairly.
- Add a fallback. Keep a second endpoint and switch on repeated errors.
- Separate workloads. Send heavy reads to a different endpoint than your transaction submission path.
- Test under load. Replay realistic traffic before you cut over.
- Review the numbers. Compare error rates and latency before and after the switch.
Key Takeaways
- A public Solana RPC endpoint is a shared URL that is great for learning and prototyping but not built for sustained production traffic.
- Solana mainnet uses JSON-RPC over HTTP and WebSocket; the OnFinality public endpoints are
https://solana.api.onfinality.io/publicandwss://solana.api.onfinality.io/public-ws. - Rate limits, dropped WebSocket connections, and
getProgramAccountstimeouts are the most common public-endpoint failure modes. - Keep your endpoint in configuration so you can move to a managed or dedicated node without rewriting app logic.
- Review RPC pricing and supported RPC networks before you scale.
Frequently Asked Questions
Is a public Solana RPC endpoint free to use?
Public endpoints are typically free to call, but they are shared and rate-limited. Free access usually comes with lower throughput and no support guarantee, which is why production teams move to a managed or dedicated endpoint.
What is the public Solana RPC URL?
OnFinality exposes Solana mainnet at https://solana.api.onfinality.io/public for HTTP and wss://solana.api.onfinality.io/public-ws for WebSocket. Always confirm the current URL on the Solana network page.
Can I use a public Solana RPC for a trading bot?
It is not recommended. Bots depend on low-latency reads and stable WebSocket subscriptions, both of which are unreliable on shared public capacity. A dedicated node gives you isolated throughput and a predictable connection.
Why does my public Solana RPC return 429 errors?
A 429 means you have exceeded the shared rate limit. Reduce your request rate, batch calls where possible, and move latency-sensitive or high-volume methods to a managed or dedicated endpoint.
How do I switch from a public endpoint to a private one?
Keep the endpoint in an environment variable, add health and latency probes, then swap the URL for your managed or dedicated endpoint. Because Solana uses the same JSON-RPC interface, no application code needs to change beyond the connection string.
Does OnFinality offer Solana devnet RPC?
Yes. See the Solana Devnet RPC page for devnet endpoint details and use it for testing before you point code at mainnet.