Logo
New RPC users get 35% off their first monthView the offer
RPC Assistant

Solana Public RPC Endpoints: Which One Should You Use?

Summary

Solana public RPC endpoints let you query the network without running your own validator. This article compares the default public endpoint with managed options like OnFinality, explains rate limits and reliability tradeoffs, and shows how to connect via HTTP and WebSocket for production apps.

Solana is one of the fastest blockchains, but its performance depends on the RPC endpoint you use. If you are building a dApp, a trading bot, or an indexer, the public endpoint you choose affects latency, reliability, and how many requests you can send.

This article explains what Solana public RPC endpoints are, compares the default endpoint with managed options, and helps you decide which one fits your workload.

Quick recommendation: when to use which endpoint

If you are prototyping or running a low-traffic script, the default public endpoint (api.mainnet-beta.solana.com) is fine. It is free and requires no setup.

But if your app is in production, handles user traffic, or needs consistent performance, you should use a managed RPC provider like OnFinality. Public endpoints are shared and often rate-limited, which can cause throttling or downtime during peak usage.

Here is a simple decision guide:

  • Learning or testing: Use the default public endpoint.
  • Building a production dApp: Use a managed endpoint with a service-level agreement and higher throughput.
  • Needing WebSocket subscriptions: Ensure the provider supports wss:// and offers reliable pub/sub.
  • High request volume: Consider a dedicated node to avoid shared rate limits.

For production, we recommend starting with OnFinality's Solana endpoint, which is designed for reliability and scalability.

What is a Solana public RPC endpoint?

A public RPC endpoint is a URL that lets you send JSON-RPC requests to the Solana network. It acts as a gateway between your application and the blockchain, allowing you to read account data, submit transactions, and subscribe to events.

Solana's official public endpoint is https://api.mainnet-beta.solana.com. It is operated by the Solana Foundation and is free to use. However, it is shared by many developers, so it has rate limits and can become slow during congestion.

Other public endpoints exist, but they often have similar limitations. For example, some community-run endpoints may offer higher limits but come with no guarantees.

Managed RPC providers, such as OnFinality, offer public endpoints that are more reliable and scalable. They typically provide higher rate limits, multiple regions, and better uptime.

Solana public RPC endpoints compared

The table below compares the default public endpoint with managed options. Note that exact limits and performance vary, so treat this as a general guide.

EndpointTypeRate limitsReliabilityBest for
https://api.mainnet-beta.solana.comOfficial publicLow (shared)VariablePrototyping, low traffic
OnFinality public endpointManaged publicHigher, configurableHighProduction apps, moderate traffic
OnFinality dedicated nodeDedicatedCustom, no shared limitsVery highHigh throughput, production apps

OnFinality's public endpoint is https://solana.api.onfinality.io/public (HTTP) and wss://solana.api.onfinality.io/public-ws (WebSocket). These endpoints are backed by a global infrastructure that balances load and provides failover.

How to connect to a Solana public RPC endpoint

Connecting to a Solana RPC endpoint is straightforward. You can use curl for quick tests or a JavaScript library like @solana/web3.js for building applications.

Using curl

To check the current slot (latest block height), send a JSON-RPC request:

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

You should receive a response like:

{"jsonrpc":"2.0","result":123456789,"id":1}

Using @solana/web3.js

Install the library and set up a connection:

import { Connection, clusterApiUrl } from '@solana/web3.js';

// Use a public endpoint
const endpoint = 'https://solana.api.onfinality.io/public';
const connection = new Connection(endpoint, 'confirmed');

async function getSlot() {
  const slot = await connection.getSlot();
  console.log('Current slot:', slot);
}

getSlot();

For WebSocket subscriptions, use the wss:// endpoint:

const wsEndpoint = 'wss://solana.api.onfinality.io/public-ws';
const connection = new Connection(wsEndpoint, 'confirmed');

Rate limits and reliability: what to expect

Public RPC endpoints are shared resources. The Solana Foundation's endpoint has rate limits that can be as low as 40 requests per second per IP, but these are not officially documented and can change. During network congestion, you may experience throttling or timeouts.

Managed providers like OnFinality offer more generous limits and better reliability. They use load balancing and multiple nodes to distribute traffic, reducing the risk of a single point of failure.

If your application requires consistent performance, consider a dedicated node. With a dedicated node, you get exclusive access to the infrastructure, eliminating shared rate limits and providing predictable performance.

WebSocket support and real-time data

Solana dApps often need real-time updates, such as account changes or new transactions. WebSocket subscriptions allow you to receive these updates without polling.

OnFinality's public endpoint supports WebSocket at wss://solana.api.onfinality.io/public-ws. You can subscribe to account changes, program logs, and slot updates.

Example subscription using @solana/web3.js:

const subscriptionId = connection.onAccountChange(
  publicKey,
  (accountInfo) => {
    console.log('Account changed:', accountInfo);
  },
  'confirmed'
);

When using public endpoints, be aware that WebSocket connections may be limited or unstable. Managed providers often offer more robust WebSocket infrastructure.

Common pitfalls with public endpoints

Even with a good endpoint, you may run into issues. Here are common pitfalls and how to avoid them:

  • Rate limiting: Public endpoints throttle requests. Use caching and batching to reduce the number of calls.
  • Timeouts: Long-running queries like getProgramAccounts can time out. Use pagination or filter on-chain.
  • Stale data: Ensure you use the correct commitment level (processed, confirmed, or finalized).
  • WebSocket disconnects: Public WebSocket endpoints may drop connections. Implement reconnection logic.

If you experience frequent issues, it may be time to switch to a managed provider.

When to move from public to managed RPC

If your app is growing, you will eventually outgrow public endpoints. Signs include:

  • Frequent 429 errors (rate limit exceeded)
  • High latency during peak hours
  • Downtime or connection resets
  • Need for archive data or advanced methods

Managed providers like OnFinality offer:

  • Higher rate limits and configurable plans
  • Global infrastructure with low latency
  • Dedicated nodes for maximum performance
  • Support for production issues

Check out RPC pricing to see plans that fit your needs.

Key Takeaways

  • Solana public RPC endpoints are free but shared, leading to rate limits and reliability issues.
  • For production apps, use a managed provider like OnFinality for better performance and support.
  • OnFinality offers HTTP and WebSocket endpoints: https://solana.api.onfinality.io/public and wss://solana.api.onfinality.io/public-ws.
  • WebSocket subscriptions are essential for real-time dApps; ensure your provider supports them.
  • Monitor your usage and switch to a dedicated node if you need consistent throughput.

Frequently Asked Questions

What is the default Solana public RPC endpoint?

The default public endpoint is https://api.mainnet-beta.solana.com, operated by the Solana Foundation. It is free but has rate limits.

Are Solana public RPC endpoints reliable for production?

Public endpoints are generally not recommended for production due to rate limits and potential downtime. Managed providers offer higher reliability.

How do I get a Solana public RPC endpoint?

You can use the default endpoint or sign up for a managed provider like OnFinality to get a dedicated public endpoint.

What is the difference between HTTP and WebSocket RPC?

HTTP is for request-response calls, while WebSocket allows real-time subscriptions. Use WebSocket for live updates.

Can I use OnFinality's Solana public endpoint for free?

OnFinality offers a free tier for public endpoints. Check RPC pricing for details.

How do I choose between public and dedicated RPC?

If you need high throughput and consistent performance, choose a dedicated node. For moderate traffic, a managed public endpoint may suffice.

For more information, visit the Solana network page and explore supported RPC networks.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started