Skip to main content
Optimizing RPC usage can significantly improve performance, reduce costs, and enhance user experience. This guide covers proven techniques for efficient Solana RPC interactions.

Quick Start

Transaction Optimization

Optimize compute units, priority fees, and transaction sending

Data Retrieval

Efficient patterns for fetching account and program data

Real-time Monitoring

WebSocket subscriptions and streaming data optimization

Best Practices

Performance guidelines and resource management

Transaction Optimization

Compute Unit Management

1. Simulate to determine actual usage:
2. Set appropriate limits with margin:

Priority Fee Optimization

1. Get dynamic fee estimates:
2. Apply the priority fee:

Transaction Sending Best Practices

Data Retrieval Optimization

Enhanced Pagination Methods (V2)

For large-scale data queries, use the new V2 methods with cursor-based pagination:

⚡ Performance Boost

getProgramAccountsV2 and getTokenAccountsByOwnerV2 provide significant performance improvements for applications dealing with large datasets:
  • Configurable limits: 1-10,000 accounts per request
  • Cursor-based pagination: Prevents timeouts on large queries
  • Incremental updates: Use changedSinceSlot for real-time synchronization
  • Better memory usage: Stream data instead of loading everything at once
Example: Efficient program account querying
Incremental updates for real-time applications:

Data Retrieval Optimization

Efficient Account Queries

Token Balance Lookups

Transaction History

For full address history, use getTransactionsForAddress — a Helius-exclusive method that returns complete transaction data, including associated token account activity, in a single call:

Transfer History

When you only need token or SOL movement — payments, portfolio activity, balance reconciliation — use getTransfersByAddress (Helius-exclusive, requires a Developer plan or higher). It returns parsed, human-readable transfer objects with owners, mints, amounts, and decimals already resolved, so you skip transaction parsing entirely:
Rule of thumb: use getTransactionsForAddress when you need full transaction payloads or non-transfer activity, and getTransfersByAddress when you need clean transfer records for ledgers and payment tracking.

Real-time Monitoring

Account Subscriptions

Program Account Monitoring

Transaction Monitoring

Advanced Patterns

Smart Retry Logic

Memory-Efficient Processing

Connection Pooling

Performance Monitoring

Track RPC Usage

Best Practices

Commitment Levels

  • Use for: WebSocket subscriptions, real-time updates
  • Latency: ~400ms
  • Reliability: Good for most applications

Resource Management

Error Handling

Common Pitfalls to Avoid

Avoid these common mistakes:
  • Polling instead of using WebSocket subscriptions
  • Fetching full account data when only partial data is needed
  • Not using batch operations for multiple queries
  • Ignoring rate limits and not implementing proper retry logic
  • Using finalized commitment when confirmed is sufficient
  • Not closing subscriptions, leading to memory leaks
The optimization techniques in this guide reference the following WebSocket and RPC methods:

getTransactionsForAddress

Full transaction history with filtering, sorting, and token account support (Helius-exclusive)

getTransfersByAddress

Parsed token and SOL transfer history for payments and reconciliation (Helius-exclusive)

getTransaction

Retrieve full transaction details by signature

getProgramAccounts

Fetch all accounts owned by a program

getTokenAccountsByOwner

Get token accounts for a wallet

getMultipleAccountsInfo

Batch fetch multiple account details

getAccountInfo

Get information about a single account

accountSubscribe

Subscribe to account changes via WebSocket

programSubscribe

Subscribe to program account changes via WebSocket

logsSubscribe

Subscribe to transaction logs via WebSocket

Summary

By implementing these optimization techniques, you can achieve:
  • 60-90% reduction in API call volume
  • Significantly lower latency for real-time operations
  • Reduced bandwidth usage through targeted queries
  • Better error resilience with smart retry logic
  • Lower operational costs through efficient resource usage

Next Steps

Ready to implement these optimizations? Check out our Transaction Optimization Guide for transaction-specific best practices.