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

Solana RPC Endpoint: How to Connect and Configure for Production

Summary

A Solana RPC endpoint is the URL your application uses to send JSON-RPC requests to the Solana network. This guide covers the mainnet and devnet endpoints, how to configure your wallet or dApp, and how to choose between public, shared, and dedicated RPC services.

Quick Answer: What Is a Solana RPC Endpoint?

A Solana RPC endpoint is a URL that accepts JSON-RPC requests for the Solana blockchain. Your wallet, dApp, or trading bot uses this endpoint to read on-chain data (like account balances or transaction status) and to submit signed transactions. The endpoint is the bridge between your application and the Solana network.

For example, the official OnFinality public endpoint for Solana mainnet is:

https://solana.api.onfinality.io/public

This endpoint supports both HTTP and WebSocket connections. The WebSocket URL is:

wss://solana.api.onfinality.io/public-ws

You can use these endpoints to start building immediately, but for production workloads you should evaluate managed or dedicated RPC services to ensure reliability and performance.

Decision Guide: Which Solana RPC Endpoint Should You Use?

Before you connect, decide which type of endpoint fits your use case:

  • Public endpoint: Free, but shared and rate-limited. Good for testing and light development.
  • Shared managed endpoint: Paid, but still shared across many users. Better for production apps with moderate traffic.
  • Dedicated node: A private Solana node provisioned for your project. Best for high-throughput applications, trading bots, or apps that need consistent performance.

If you are building a production dApp, a shared managed endpoint is often the right starting point. If you need low latency, high request volume, or custom configuration, consider a dedicated node. OnFinality offers both shared and dedicated options, and you can compare plans on the RPC pricing page.

Solana Mainnet and Devnet Endpoints

Solana has several clusters. The two most common are mainnet and devnet. Each has its own RPC endpoint and token (SOL for mainnet, devnet SOL for testing).

ClusterEndpoint (OnFinality)Use Case
Mainnethttps://solana.api.onfinality.io/publicProduction apps, real SOL
DevnetSee Solana Devnet network pageTesting, development, no real funds

For devnet, you can get free devnet SOL from a faucet to test your application. The OnFinality devnet endpoint is available on the Solana Devnet network page.

How to Configure Your Wallet or dApp

Most Solana libraries, like @solana/web3.js, let you set the RPC endpoint when creating a connection. Here is a basic example:

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

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

// Or use the devnet endpoint
// const devnetEndpoint = clusterApiUrl('devnet');
// const connection = new Connection(devnetEndpoint, 'confirmed');

For wallets like Phantom or Solflare, you can often change the RPC endpoint in the settings. Use the mainnet endpoint above for real transactions, or the devnet endpoint for testing.

Common RPC Methods and Examples

Solana's JSON-RPC API includes methods for querying accounts, blocks, and transactions. Here are a few common ones:

  • getBalance – Get the SOL balance of an account
  • getLatestBlockhash – Get the latest blockhash for transaction submission
  • sendTransaction – Submit a signed transaction
  • getTransaction – Fetch transaction details

Here is a curl example to get the latest blockhash:

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

For WebSocket subscriptions, you can use the wss://solana.api.onfinality.io/public-ws endpoint to listen for account changes or transaction confirmations.

How to Choose an RPC Provider for Solana

When comparing RPC providers, focus on these criteria:

  • Reliability: Look for providers with a track record of uptime. Avoid providers that don't publish status pages.
  • Performance: Latency and throughput matter, especially for trading or high-frequency applications.
  • Rate limits: Public endpoints often have strict rate limits. Check the provider's policy.
  • Support: Do they offer dedicated support? Is there a community?
  • Pricing: Compare costs for shared vs. dedicated nodes.

OnFinality offers a managed Solana RPC service with both shared and dedicated options. You can see the full list of supported networks on the supported networks page.

Troubleshooting Common Solana RPC Issues

If you encounter errors, here are common issues and fixes:

  • Rate limit exceeded: You are sending too many requests. Upgrade to a paid plan or implement caching.
  • Connection timeout: The endpoint may be down or your network is unstable. Check the provider's status page.
  • Invalid blockhash: The blockhash you used is too old. Fetch a fresh one before submitting a transaction.
  • WebSocket disconnects: Reconnect with exponential backoff.

For more advanced troubleshooting, consider using a dedicated node to avoid shared resource contention.

Key Takeaways

  • A Solana RPC endpoint is the URL your app uses to interact with the Solana network.
  • Public endpoints are fine for testing, but production apps should use managed or dedicated RPC services.
  • OnFinality provides a public mainnet endpoint at https://solana.api.onfinality.io/public and a WebSocket endpoint at wss://solana.api.onfinality.io/public-ws.
  • Use devnet for testing with free SOL, and mainnet for real transactions.
  • When choosing a provider, evaluate reliability, performance, rate limits, support, and pricing.

Frequently Asked Questions

What is the Solana RPC endpoint? The Solana RPC endpoint is the URL used to send JSON-RPC requests to the Solana network. OnFinality's public mainnet endpoint is https://solana.api.onfinality.io/public.

Is there a free Solana RPC endpoint? Yes, OnFinality offers a free public endpoint for Solana mainnet. However, it is rate-limited and not recommended for production.

How do I get a dedicated Solana RPC endpoint? You can provision a dedicated Solana node through OnFinality. Visit the dedicated node page for more information.

What is the difference between mainnet and devnet? Mainnet uses real SOL and is for production. Devnet uses free test SOL and is for development and testing.

Can I use WebSocket with Solana RPC? Yes, OnFinality provides a WebSocket endpoint at wss://solana.api.onfinality.io/public-ws for real-time subscriptions.

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