Complete GuideUpdated March 2026

What is Stellar RPC? Complete Guide to the Stellar RPC API Service

Everything developers need to know about the Stellar RPC API service, from core concepts to production-ready implementation patterns.

The Stellar RPC API service is the primary interface for accessing real-time blockchain data on the Stellar network. As a purpose-built Stellar blockchain data API, it provides developers with JSON-RPC 2.0 endpoints for querying ledger state, simulating transactions, reading smart contract storage, and streaming events. Whether you're building payment applications, DeFi protocols, or Stellar smart contract interactions, the Stellar RPC is the foundational data layer your application needs. This guide covers everything from basic concepts to advanced production patterns used by the Stellar API for developers community.

In This Guide

  • 1. What is Stellar RPC?
  • 2. Core RPC Methods
  • 3. Smart Contract Queries
  • 4. Transaction Simulation
  • 5. Event Streaming
  • 6. Production Best Practices

Understanding the Stellar RPC API Service

The Stellar RPC (formerly known as Soroban RPC) was rebranded in 2026 to reflect its expanded role as the unified real-time data access layer for the entire Stellar network. Unlike the Horizon API, which focuses on historical data and deep indexing, the Stellar RPC is optimized for real-time state queries and transaction processing.

The Stellar RPC API service uses the JSON-RPC 2.0 protocol, making it compatible with standard HTTP clients in any programming language. Every request follows the same structure:

curl -X POST https://rpc.lumenquery.io \
  -H "Content-Type: application/json" \
  -H "X-API-Key: lq_your_key" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getHealth"
  }'

Core RPC Methods for Stellar Blockchain Data

The Stellar blockchain data API exposes several core methods that every developer should know. Here's a complete reference:

MethodPurposeUse Case
getHealthServer statusHealth checks, monitoring
getLatestLedgerCurrent ledgerDashboard displays
getLedgerEntriesRead stateContract storage queries
simulateTransactionTest transactionsFee estimation, debugging
sendTransactionSubmit transactionsPayments, contract calls
getTransactionTransaction statusConfirmation polling
getEventsContract eventsEvent monitoring
getFeeStatsFee statisticsTransaction pricing

You can see these methods in action on our Stellar Network Analytics Dashboard, which uses getLatestLedger and Horizon endpoints to display live network metrics.

Querying Smart Contracts with the Stellar Smart Contract API

Soroban smart contracts store their state on-ledger, and the Stellar smart contract API methods let you read this data directly. The getLedgerEntries method is the primary tool for querying contract storage.

LumenQuery's Smart Contract Explorer uses these RPC methods under the hood to decode and display contract state. For a hands-on tutorial, see our guide on Soroban JSON RPC Explained.

TypeScript
import { Server } from '@stellar/stellar-sdk/rpc';

const rpc = new Server('https://rpc.lumenquery.io');

// Read contract storage entry
const entries = await rpc.getLedgerEntries(
  contractStorageKey(contractId, 'balance', userAddress)
);

console.log('Contract state:', entries);

Transaction Simulation: The Stellar Transaction Query API

The Stellar transaction query API includes simulateTransaction, which is essential for any application that submits transactions. It previews the result, estimates resource usage, and calculates fees—all without spending XLM. This is the same pattern used in LumenQuery's contract deployment feature.

// Simulate before submitting
const simResult = await rpc.simulateTransaction(tx);

if (simResult.error) {
  console.error('Simulation failed:', simResult.error);
} else {
  console.log('Estimated fee:', simResult.minResourceFee);
  console.log('CPU instructions:', simResult.cost?.cpuInsns);
  // Safe to sign and submit
}

Event Streaming and Real-Time Data

The getEvents method lets you query historical events emitted by smart contracts. Combined with polling, you can build real-time monitoring dashboards—like our Live Transaction Viewer which streams decoded transactions as they happen.

For detailed event streaming documentation, see the Soroban Smart Contracts Explorer docs.

Stellar RPC vs Horizon: When to Use Which

Understanding when to use the Stellar RPC vs the Horizon API is critical. For a deep dive, read our Horizon vs RPC vs Indexers comparison. The short version:

Use Stellar RPC for:

  • - Real-time ledger state
  • - Transaction simulation
  • - Smart contract storage
  • - Event queries
  • - Fee estimation

Use Horizon for:

  • - Transaction history
  • - Account balances
  • - Payment streams
  • - Offer books & trades
  • - Asset metadata

Production Best Practices for Stellar API Developers

As a Stellar API for developers platform, LumenQuery has processed millions of RPC requests. Here are the patterns that work best in production:

1. Always simulate before submitting

Simulation catches errors, estimates fees, and prevents failed transactions from costing you XLM.

2. Cache responses with appropriate TTLs

Ledger data is immutable once closed (~5s). Cache aggressively for read-heavy applications.

3. Handle rate limits gracefully

Implement exponential backoff on 429 responses. See our API docs for rate limit tiers.

4. Use managed infrastructure

Running your own RPC node requires significant ops overhead. Compare Stellar API providers to find the best fit.

Getting Started with Stellar RPC

Ready to start building? LumenQuery provides managed access to the Stellar RPC API service with free tier included:

Step 1: Create a free LumenQuery account

Step 2: Get your API key from the Dashboard

Step 3: Follow our Stellar API Tutorial for step-by-step instructions

Step 4: Explore live data with the Natural Language Query Interface