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:
| Network | RPC URL (OnFinality) | WebSocket URL | Explorer |
|---|---|---|---|
| Mainnet | https://solana.api.onfinality.io/public |
wss://solana.api.onfinality.io/public-ws |
explorer.solana.com |
| Devnet | See Solana Devnet | See Solana Devnet | explorer.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
getTransactionwith 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:
| Factor | What to Check | Why It Matters |
|---|---|---|
| Uptime | Provider's status page | Downtime means your app fails |
| Rate limits | Requests per second, daily quotas | Avoid throttling under load |
| WebSocket | Subscription support | Needed for real-time features |
| Archive data | Historical access | Required for analytics or audits |
| Support | SLA, response time | Critical for production issues |
| Pricing | Transparent, predictable | Avoid 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 blockwss. 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.
Related resources
Originally published at OnFinality.
Top comments (0)