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

Solana Node API: How to Connect, Configure, and Debug RPC Calls

Summary

The Solana node API is a JSON-RPC interface that lets applications read network state, send transactions, and subscribe to live updates. This guide covers cluster endpoints, request formats, commitment levels, and common failure modes so you can connect reliably to Solana mainnet or devnet.

Quick decision guide: which Solana endpoint should you use?

Before you write any code, decide which Solana cluster and access model fit your workload. The answer depends on whether you are building a production app, running a QA pipeline, or just prototyping locally.

WorkloadRecommended endpointWhy
Local developmenthttp://localhost:8899 (solana-test-validator)Fast iteration, clear rate limits, full control
Prototyping on devnetPublic devnet endpoint or managed devnet RPCFree SOL from faucet, shared infrastructure is fine for low traffic
Production mainnet appManaged RPC provider or dedicated nodePublic endpoints are rate-limited and not reliable for production
High-throughput or heavy methods (getProgramAccounts)Dedicated node or managed provider with dedicated capacityAvoids 429s and provides consistent performance

If you are just starting, use a managed RPC provider like OnFinality's Solana API to get a stable endpoint without operating your own node. For production, evaluate dedicated node options to avoid shared rate limits.

What is the Solana node API?

The Solana node API is a JSON-RPC 2.0 interface that wraps validator internals. It lets you read account state, send transactions, simulate execution, and subscribe to live updates via WebSocket. Most requests are HTTP POSTs with a JSON body, and responses are JSON objects.

Unlike some other chains, Solana's API is not Ethereum-compatible. You use methods like getAccountInfo, getBalance, sendTransaction, and getLatestBlockhash instead of eth_getBalance or eth_sendRawTransaction. This means your tooling and SDKs must be Solana-aware.

Solana clusters and public endpoints

Solana has three public clusters: mainnet, devnet, and testnet. Each has a public endpoint, but these are shared infrastructure and not intended for production traffic. The official docs warn that public endpoints may return 429 (rate limit) or 403 (blocked) when overused.

ClusterPublic endpointUse case
Mainnethttps://api.mainnet.solana.comProduction network with real SOL
Devnethttps://api.devnet.solana.comDeveloper testing, free SOL from faucet
Testnethttps://api.testnet.solana.comValidator testing

For production, you should use a managed RPC provider or run your own node. OnFinality provides a public Solana endpoint at https://solana.api.onfinality.io/public and a WebSocket endpoint at wss://solana.api.onfinality.io/public-ws. These are suitable for development and light production use, but for heavy workloads consider a dedicated node.

Making your first Solana RPC call

Solana RPC uses JSON-RPC 2.0. Here is a basic curl example to get the current slot:

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

The response looks like:

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

Most methods require parameters. For example, to get an account balance:

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

Replace the address with a real Solana public key.

Understanding commitment levels

Solana RPC methods accept a commitment parameter that controls how finalized a block must be before the node returns data. This is critical for consistency in your application.

CommitmentDescriptionUse case
processedThe node's most recent processed block. Can be rolled back.Real-time monitoring, but not safe for financial transactions
confirmedA block voted on by a supermajority of stake.Most applications use this as a balance between speed and safety
finalizedThe block is finalized with maximum lockout.High-value transactions where reversibility is unacceptable

For example, to get a balance with confirmed commitment:

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

Using WebSocket subscriptions

For live updates, Solana offers WebSocket subscriptions. You can subscribe to account changes, program updates, slot changes, and more. Here is an example using wscat:

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

Then send a subscription request:

{"jsonrpc":"2.0","id":1,"method":"accountSubscribe","params":["GgPpTKg78vmzgvPmNsDnN7hKs4q5WzJfPmZ3gY7hKJpX",{"commitment":"confirmed"}]}

You will receive a subscription ID, and then notifications as the account changes.

Common Solana RPC methods you'll use

Here are the most frequently used HTTP methods:

CategoryMethods
AccountsgetAccountInfo, getBalance, getMultipleAccounts
TransactionssendTransaction, simulateTransaction, getTransaction, getSignatureStatuses
BlocksgetBlock, getBlocks, getBlockHeight
ProgramgetProgramAccounts
ClustergetSlot, getEpochInfo, getHealth, getVersion
TokensgetTokenAccountBalance, getTokenSupply

For a full list, see the Solana RPC HTTP Methods reference.

Debugging common Solana RPC errors

When your calls fail, the error message usually tells you what to fix. Here are common issues:

ErrorLikely causeFix
429 Too Many RequestsYou exceeded the rate limit on a shared endpointUse a managed provider with higher limits or a dedicated node
403 ForbiddenThe endpoint blocked your IP or traffic patternCheck your request volume and consider a private endpoint
-32602 Invalid paramsMissing or malformed parametersVerify the method signature and parameter order
-32005 Node is unhealthyThe node is behind or syncingWait and retry, or switch to a healthy endpoint
Transaction simulation failedThe transaction would fail on-chainUse simulateTransaction to debug before sending

For transaction failures, always simulate first:

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

Building with JavaScript: using @solana/web3.js

The most common way to interact with Solana is the @solana/web3.js library. Here is a minimal example:

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

const connection = new Connection('https://solana.api.onfinality.io/public', 'confirmed');
const address = new PublicKey('GgPpTKg78vmzgvPmNsDnN7hKs4q5WzJfPmZ3gY7hKJpX');

const balance = await connection.getBalance(address);
console.log('Balance:', balance / 1e9, 'SOL');

For WebSocket subscriptions in JS, use connection.onAccountChange:

connection.onAccountChange(address, (accountInfo) => {
  console.log('Account changed:', accountInfo);
});

When to use a dedicated Solana node

If your application relies on heavy methods like getProgramAccounts (which can be expensive) or needs consistent low latency, a shared public endpoint may not be enough. Dedicated nodes give you:

  • clear rate limits from other users
  • Consistent performance for heavy queries
  • Full control over node configuration
  • Access to archive data if needed

OnFinality offers dedicated Solana nodes that you can deploy in minutes. You can also compare Solana RPC providers to understand the tradeoffs.

Key Takeaways

  • Solana's node API is JSON-RPC 2.0 over HTTP and WebSocket, with Solana-specific methods.
  • Public endpoints are fine for development but not for production traffic.
  • Commitment levels (processed, confirmed, finalized) control data consistency.
  • Use simulateTransaction to debug transaction failures before sending.
  • For production, consider a managed RPC provider or dedicated node to avoid rate limits and ensure reliability.

Frequently Asked Questions

What is the difference between Solana RPC and Solana node API?

They refer to the same thing: the JSON-RPC interface that lets you interact with a Solana node. The terms are used interchangeably.

Can I use Ethereum RPC methods on Solana?

No. Solana uses its own set of methods. You need Solana-specific SDKs and tools.

How do I get free SOL for devnet?

Use the Solana faucet at https://faucet.solana.com to request devnet SOL.

What is the best way to avoid 429 errors?

Use a managed RPC provider with higher rate limits or a dedicated node. Public endpoints are shared and easily rate-limited.

Does OnFinality support Solana WebSocket?

Yes, OnFinality provides a WebSocket endpoint at wss://solana.api.onfinality.io/public-ws for subscriptions.

For more details on supported networks and pricing, see supported RPC networks and RPC pricing.

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