Logo
RPC Assistant

What Is Solana Public RPC and When Should You Use It?

Resumen

Solana public RPC endpoints are free, open endpoints provided by the Solana Foundation or community members for developers to query the Solana blockchain without running a validator. They are suitable for light usage, testing, and prototyping, but come with rate limits, no SLA guarantees, and potential reliability issues for production applications. For serious development, consider a dedicated node or premium RPC service.

Solana Public RPC Decision Checklist

Before relying on a free public RPC endpoint for your Solana project, ask yourself these questions:

CriterionWhat to checkWhy it matters
Usage volumeHow many requests per second (RPS) does your app need?Public endpoints throttle aggressively, typically 100–1000 RPS per IP. Exceeding limits will cause 429 errors.
SLA requirementsDoes your application need reliability expectations?Public endpoints have no SLA. If the endpoint is down, your app breaks without recourse.
Data freshnessHow current must your on-chain data be?Public RPCs may have stale ledgers due to load balancing. Critical use cases require dedicated nodes.
SecurityCan you expose your API queries to a third-party service?Public endpoints potentially log traffic. For sensitive apps, a private RPC is safer.
Rate limitsWhat are the specific rate limits of the endpoint?Check the documentation: limits vary by provider, IP-based or token-based.
Development phaseAre you prototyping or building production?Public RPCs are great for quick tests, but not recommended for production or high-frequency trading.

What Is a Solana Public RPC?

A Solana public RPC (Remote Procedure Call) endpoint is a free HTTP or WebSocket endpoint that allows anyone to interact with the Solana blockchain without running a full node. These endpoints are hosted by the Solana Foundation (e.g., api.mainnet-beta.solana.com) or community contributors. They expose the standard Solana JSON-RPC API for submitting transactions, querying account balances, reading program state, and more.

Public RPCs are the easiest way to start building on Solana: no setup cost, no DevOps, just copy and paste a URL into your wallet or dApp. However, they are intentionally rate-limited and come with no guarantees.

Where to Find Public Solana RPC Endpoints

The most commonly used public Solana RPC endpoints are:

  • Mainnet Beta: https://api.mainnet-beta.solana.com
  • Testnet: https://api.testnet.solana.com
  • Devnet: https://api.devnet.solana.com

These endpoints are rate-limited to about 100 requests per 10 seconds (10 QPS) for non-WebSocket calls when using the default public access. Some community providers like GenesysGo (Shyft), Triton, and others offer freemium endpoints with higher limits but still limited compared to paid services.

Limitations of Public RPC Endpoints

Rate Limiting

Public RPCs are designed for light usage. The Solana Foundation's public endpoint, for instance, restricts each IP to 100 requests per 10-second window. If your app needs to constantly poll transaction status or stream account updates, you'll quickly hit these limits.

Reliability and Uptime

Public RPCs are best-effort infrastructure. They can go down without warning, especially during high-traffic events like NFT mints or token launches. There is no SLA; if the endpoint is unavailable, your application stops functioning.

Data Freshness

Due to load balancing across multiple nodes, public endpoints may return stale data. For example, a getBalance call might return an older balance if the backend node hasn't caught up with the latest slot. This latency is unacceptable for trading or real-time applications.

Security and Privacy

When you use a public RPC, your IP address and request patterns are visible to the endpoint provider. For privacy-sensitive applications (e.g., DEX routing, wallet activity), this is a concern. Private RPCs offer better privacy by eliminating shared infrastructure.

When to Use Public vs Private Solana RPC

Use CasePublic RPCPrivate / Dedicated RPC
Quick prototyping & testing✅ SuitableOverkill
Low-traffic personal wallet✅ PossibleNot needed
Production dApp with hundreds of users❌ RiskyRequired
High-frequency trading bots❌ UnreliableEssential
Production indexer or analytics❌ InsufficientNeeded (archive node)
Applications needing WebSocket streams⚠️ Limited connectionsUnlimited connections

How to Interact with a Solana Public RPC

Using curl to query the current block height:

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlot"
  }
'

Response:

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

Using the Solana JavaScript SDK:

const solanaWeb3 = require('@solana/web3.js');

const connection = new solanaWeb3.Connection(
  'https://api.mainnet-beta.solana.com',
  'confirmed'
);

async function getBalance(pubkey) {
  const balance = await connection.getBalance(new solanaWeb3.PublicKey(pubkey));
  console.log(`Balance: ${balance} lamports`);
}

getBalance('SomePublicKeyHere');

Common Issues with Public Solana RPCs

429 Too Many Requests

When you exceed the rate limit, the endpoint responds with HTTP 429. Back off with exponential retry. For production, switch to a private RPC provider like OnFinality that offers higher limits.

Stale or Stuck Transactions

Public RPCs may not propagate transactions efficiently. If your transaction remains "processed" forever, try resubmitting or use a dedicated endpoint with a higher priority fee.

WebSocket Disconnections

Public WebSocket endpoints (e.g., wss://api.mainnet-beta.solana.com) often have connection limits and may drop idle connections. For persistent streams, use a dedicated node.

Best Practices for Using Solana RPCs

  1. Start with public RPCs for development, but plan to migrate to a private RPC before launch.
  2. Implement client-side retry logic with exponential backoff to handle 429 errors.
  3. Monitor your request volume – many public endpoints return x-ratelimit-remaining headers.
  4. Use multiple public endpoints for redundancy, but be aware of rate limits per IP.
  5. For WebSocket subscriptions, keep the connection alive with periodic pings.
  6. Evaluate dedicated node providers early. OnFinality offers both shared and dedicated Solana nodes with predictable pricing, higher limits, and 24/7 support. See our RPC pricing and supported RPC networks.

Key Takeaways

  • Solana public RPC endpoints are free and easy to use for testing, but unsuitable for production.
  • They have strict rate limits, no SLA, and potential privacy concerns.
  • For any application with real users or real value, invest in a private RPC or dedicated node.
  • Use the decision checklist above to determine the right tier for your project.

Frequently Asked Questions

Q: Can I use public Solana RPC for a production dApp?
A: It is strongly discouraged. Public endpoints are rate-limited and unreliable. Production apps should use a private RPC provider or run their own node.

Q: What is the rate limit for api.mainnet-beta.solana.com?
A: The default public rate limit is 100 requests per 10 seconds per IP, but it can change. Some community endpoints offer higher limits with API keys.

Q: How do I get a Solana devnet test token?
A: Use the devnet faucet at https://faucet.solana.com or via the CLI: solana airdrop 1 <PUBKEY> --url https://api.devnet.solana.com.

Q: Is OnFinality's Solana RPC free?
A: OnFinality offers a free tier for shared RPC endpoints with higher limits than public endpoints. For production, see dedicated node options.

Base de conocimiento RPC

Detalles RPC relacionados

Nunca te preocupes por la infraestructura nuevamente

OnFinality elimina la carga pesada de DevOps para que puedas construir de forma más inteligente y rápida.

Comenzar