InfrastructureCore

RPC — Remote Procedure Call

Understanding Solana's JSON-RPC interface, node types, and how to choose the right RPC provider.

Updated March 202518 min read

What is an RPC Node?

An RPC (Remote Procedure Call) node is a Solana validator or dedicated server that exposes the Solana JSON-RPC API. Applications interact with the Solana network exclusively through RPC nodes — they cannot connect to the peer-to-peer network directly. Every wallet, DEX, trading bot, and analytics platform depends on RPC nodes for reading blockchain state and submitting transactions.

The Solana JSON-RPC API follows the JSON-RPC 2.0 specification, accepting HTTP POST requests with JSON payloads. Most methods are also available via WebSocket subscriptions for real-time updates.

RPC Node Types

Not all RPC nodes are equal. The type of node significantly affects what data is accessible and at what latency:

Node TypeData AvailableLatencyUse Case
Standard RPCRecent blocks (~2 epochs)LowMost applications
Archival RPCFull history since genesisMediumHistorical queries, analytics
Dedicated RPCConfigurableLowestHigh-frequency trading, production
Validator RPCCurrent state + recentLowest possibleMEV, ultra-low latency

Core RPC Methods

The Solana RPC API provides over 40 methods. The most frequently used in production applications are:

Account and Balance Queries

rpc-examples.jsjavascript
const { Connection, PublicKey } = require('@solana/web3.js');
const connection = new Connection('https://api.mainnet-beta.solana.com');

// Get account balance
const balance = await connection.getBalance(
  new PublicKey('YourWalletAddress')
);
console.log(`Balance: ${balance / 1e9} SOL`);

// Get full account info
const accountInfo = await connection.getAccountInfo(
  new PublicKey('YourAccountAddress')
);

// Get multiple accounts in one call (more efficient)
const accounts = await connection.getMultipleAccountsInfo([
  new PublicKey('Address1'),
  new PublicKey('Address2'),
]);

Transaction Queries

javascript
// Get transaction by signature
const tx = await connection.getTransaction(
  'YourTransactionSignature',
  { maxSupportedTransactionVersion: 0 }
);

// Get signatures for an address (paginated)
const signatures = await connection.getSignaturesForAddress(
  new PublicKey('YourAddress'),
  { limit: 100 }
);

// Get recent block
const block = await connection.getBlock(slot, {
  maxSupportedTransactionVersion: 0,
  transactionDetails: 'full',
});

Sending Transactions

javascript
const { Transaction, SystemProgram, sendAndConfirmTransaction } = require('@solana/web3.js');

const transaction = new Transaction().add(
  SystemProgram.transfer({
    fromPubkey: sender.publicKey,
    toPubkey: recipient,
    lamports: 1000000, // 0.001 SOL
  })
);

// Get latest blockhash for transaction validity
const { blockhash, lastValidBlockHeight } = 
  await connection.getLatestBlockhash();
transaction.recentBlockhash = blockhash;
transaction.feePayer = sender.publicKey;

const signature = await sendAndConfirmTransaction(
  connection, transaction, [sender]
);

WebSocket Subscriptions

For real-time updates, Solana RPC nodes expose WebSocket endpoints. Subscriptions allow applications to receive push notifications instead of polling:

javascript
// Subscribe to account changes
const subscriptionId = connection.onAccountChange(
  new PublicKey('AccountToWatch'),
  (accountInfo, context) => {
    console.log('Account updated:', accountInfo.lamports);
  },
  'confirmed'
);

// Subscribe to new slots
const slotSubscription = connection.onSlotChange((slotInfo) => {
  console.log('New slot:', slotInfo.slot);
});

// Subscribe to logs for a program
const logsSubscription = connection.onLogs(
  new PublicKey('ProgramId'),
  (logs) => {
    console.log('Program logs:', logs.logs);
  }
);

Commitment Levels

Solana RPC methods accept a commitment parameter that determines which version of the blockchain state to query. Understanding commitment levels is critical for building reliable applications:

CommitmentDescriptionLatencyRecommended For
processedLatest slot seen by node (may be rolled back)~400msUI updates only
confirmedVoted on by supermajority (very unlikely to roll back)~800msMost applications
finalizedLocked in, cannot be rolled back~13sPayments, critical operations
⚠️
Using processed commitment for financial operations is dangerous. A transaction may appear successful but later be rolled back. Always use confirmed or finalized for operations involving real value.

Rate Limits and Performance

Public RPC endpoints (api.mainnet-beta.solana.com) have strict rate limits: 100 requests per 10 seconds per IP for most methods. Production applications require dedicated or premium RPC providers. Key performance metrics to evaluate when choosing a provider include:

  • Latency: Time from request to response (target: <50ms for most methods)
  • Throughput: Maximum requests per second
  • Uptime SLA: Guaranteed availability percentage
  • Geographic coverage: Proximity to your application servers
  • Archive depth: How far back historical queries can reach

Choosing an RPC Provider

For production applications, the choice of RPC provider significantly impacts user experience and application reliability. See the Infrastructure Providers Comparison page for a detailed analysis of available options, including HighTower and Supanode.