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

Solana Endpoint: How to Connect to Solana RPC for Production Apps

Summary

A Solana endpoint is the URL your dApp or backend uses to send JSON-RPC requests to the Solana network. Choosing the right endpoint affects latency, reliability, and how well your app scales under load. This guide explains what a Solana endpoint is, how to configure one, and how to evaluate providers for production use.

Quick Recommendation: Which Solana Endpoint Should You Use?

If you are building a production dApp or backend service on Solana, you need an endpoint that can handle sustained traffic without rate-limit surprises. Public endpoints are fine for prototyping, but they often throttle requests and may not support WebSocket subscriptions reliably. For production, consider a managed RPC provider like OnFinality that offers dedicated nodes and shared endpoints with clear usage limits. Check the RPC pricing and supported networks pages to see what fits your workload.

What Is a Solana Endpoint?

A Solana endpoint is a URL that accepts JSON-RPC requests over HTTP or WebSocket. It is the entry point for reading chain data, submitting transactions, and subscribing to account or program updates. Solana's JSON-RPC API is distinct from Ethereum's, so you use methods like getBalance, getRecentBlockhash, and sendTransaction instead of eth_getBalance.

For example, the official OnFinality public endpoint for Solana mainnet is https://solana.api.onfinality.io/public, with a WebSocket endpoint at wss://solana.api.onfinality.io/public-ws. You can use these for development, but for production you should evaluate dedicated or shared private endpoints.

Solana Endpoint Configuration: Mainnet and Devnet

When you connect to Solana, you need to specify the network. The mainnet endpoint is for real assets, while devnet is for testing. Here is a quick reference:

NetworkRPC URL (OnFinality)WebSocket URLExplorer
Mainnethttps://solana.api.onfinality.io/publicwss://solana.api.onfinality.io/public-wsexplorer.solana.com
DevnetSee Solana DevnetSee Solana Devnetexplorer.solana.com

For devnet, you can get SOL from a faucet to test transactions. The OnFinality devnet page provides the endpoint and faucet details.

How to Connect to Solana RPC: Code Examples

Here is a basic curl request to get the current slot (latest block height) from the mainnet endpoint:

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

To get a balance for a wallet address:

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

For JavaScript, you can use the @solana/web3.js library:

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

const connection = new Connection('https://solana.api.onfinality.io/public', 'confirmed');
const address = new PublicKey('GgBq...');
const balance = await connection.getBalance(address);
console.log('Balance:', balance / 1e9, 'SOL');

For WebSocket subscriptions, use the wss endpoint:

const connection = new Connection('wss://solana.api.onfinality.io/public-ws', 'confirmed');
const subscriptionId = connection.onAccountChange(address, (accountInfo) => {
  console.log('Account changed:', accountInfo);
});

Solana Endpoint vs. Solana RPC Provider: What's the Difference?

An endpoint is just a URL. A provider is the infrastructure behind it—nodes, load balancers, monitoring, and support. When you use a public endpoint, you rely on the provider's shared infrastructure. For production, you need to consider:

  • Rate limits: Public endpoints often have strict limits. Check the provider's documentation.
  • Reliability: A single node can go down. Providers with multiple nodes offer better uptime.
  • WebSocket support: Essential for real-time subscriptions.
  • Archive data: Needed for historical queries like getTransaction with a specific slot.

OnFinality offers both shared and dedicated Solana nodes. Dedicated nodes give you isolated resources and predictable performance. See Dedicated Node for details.

How to Choose a Solana Endpoint Provider for Production

When evaluating providers, compare these factors:

FactorWhat to CheckWhy It Matters
UptimeProvider's status pageDowntime means your app fails
Rate limitsRequests per second, daily quotasAvoid throttling under load
WebSocketSubscription supportNeeded for real-time features
Archive dataHistorical accessRequired for analytics or audits
SupportSLA, response timeCritical for production issues
PricingTransparent, predictableAvoid surprise bills

OnFinality provides clear pricing on the RPC pricing page and lists supported networks on the networks page.

Common Solana Endpoint Errors and How to Fix Them

Here are typical issues developers face:

  • 429 Too Many Requests: You hit the rate limit. Use a private endpoint or reduce request frequency.
  • Connection refused: The endpoint is down or the URL is wrong. Check the network and try again.
  • WebSocket connection failed: Your firewall may block wss. Ensure your environment allows WebSocket connections.
  • Slot skipped: The node is behind. Use a provider with better infrastructure.

Solana Endpoint Security and Best Practices

  • Never expose your API key in client-side code. Use a backend proxy.
  • Use HTTPS/WSS to encrypt traffic.
  • Set timeouts on requests to avoid hanging.
  • Monitor your endpoint with health checks.

Key Takeaways

  • A Solana endpoint is the URL for JSON-RPC requests.
  • Public endpoints are for development; production needs a reliable provider.
  • OnFinality offers public and dedicated Solana endpoints.
  • Compare providers on uptime, rate limits, WebSocket, archive data, and support.

Frequently Asked Questions

What is the official Solana endpoint? The official public endpoint for Solana mainnet is https://solana.api.onfinality.io/public. For devnet, see the Solana Devnet page.

How do I get a Solana endpoint for free? You can use the public endpoint for development. For production, consider a paid plan with better limits.

What is the difference between HTTP and WebSocket endpoints? HTTP is for one-off requests; WebSocket is for real-time subscriptions.

Can I use a Solana endpoint for NFT minting? Yes, you can send transactions and query metadata, but you need a reliable endpoint to handle the load.

How do I choose between shared and dedicated Solana nodes? Shared nodes are cost-effective for low traffic; dedicated nodes provide isolated resources for high throughput. See Dedicated Node.

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