Summary
Stellar RPC refers to the remote procedure call interface that allows applications to interact with the Stellar blockchain. Unlike Ethereum, Stellar uses a different API called Horizon, which provides RESTful endpoints for querying the ledger, submitting transactions, and managing accounts. For developers, finding a reliable Stellar RPC provider is key to building production dApps without running full nodes. OnFinality offers Stellar RPC endpoints that abstract infrastructure complexity, giving you scalable access to the Stellar network.
When choosing a Stellar RPC provider, consider factors like rate limits, uptime, and support for Horizon-specific features like streaming endpoints. OnFinality provides both shared and dedicated Stellar nodes, with transparent pricing and multi-region availability, making it a strong choice for developers scaling their Stellar projects.
Stellar RPC Decision Checklist
Before integrating Stellar RPC into your project, evaluate the following points:
- Horizon vs. Core API: Stellar's primary RPC interface is Horizon, a RESTful API. Ensure your provider offers full Horizon coverage, including streaming endpoints.
- Rate limits: Check free tier limits and whether paid plans scale with your transaction volume.
- Network support: Confirm availability for both Stellar Mainnet and Testnet (including the SDF testnet).
- Node diversity: Running a single Stellar Core node can be a single point of failure. Use a provider that offers load-balanced endpoints.
- Latency and region: If your dApp is global, choose a provider with multi-region endpoints to reduce latency.
- Dev tooling: Some providers offer Horizon-specific debugging features like transaction simulation and fee estimation.
What Is Stellar RPC?
Stellar RPC refers to the mechanism by which external applications communicate with the Stellar blockchain. Unlike Ethereum's JSON-RPC, Stellar relies on an API layer called Horizon, which exposes RESTful endpoints for reading ledger state, submitting transactions, and managing accounts. Horizon acts as a bridge between client applications and the Stellar Core network.
If you are building a wallet, decentralized exchange, or payment app on Stellar, you will interact primarily through Horizon. Running your own Horizon instance requires operating a Stellar Core node and additional infrastructure — which many teams prefer to outsource to a managed RPC provider like OnFinality.
Stellar RPC Endpoints and Network Settings
Stellar provides two primary networks: Mainnet and Testnet. The Testnet is ideal for development and testing, while Mainnet handles real assets.
| Network | Horizon URL | Network Passphrase |
|---|---|---|
| Mainnet | https://horizon.stellar.org | Public Global Stellar Network ; September 2015 |
| Testnet | https://horizon-testnet.stellar.org | Test SDF Network ; September 2015 |
When using a managed provider like OnFinality, you will receive a custom endpoint that may include load balancing and caching. For example, an OnFinality Stellar endpoint might look like:
https://stellar.onfinality.io/api/v1/horizon
Always verify the exact endpoint from your provider's dashboard.
How to Use Stellar RPC with JavaScript
To interact with Stellar via Horizon, you typically use the stellar-sdk JavaScript library. Here is a basic example of fetching account details:
const StellarSdk = require('stellar-sdk');
// Use your provider's Horizon URL
const server = new StellarSdk.Server('https://stellar.onfinality.io/api/v1/horizon');
async function getAccount(publicKey) {
try {
const account = await server.loadAccount(publicKey);
console.log('Balances:', account.balances);
} catch (e) {
console.error('Error loading account:', e);
}
}
getAccount('G...');
For submitting a transaction:
const StellarSdk = require('stellar-sdk');
const server = new StellarSdk.Server('https://stellar.onfinality.io/api/v1/horizon');
async function submitTx() {
const account = await server.loadAccount('G...');
const transaction = new StellarSdk.TransactionBuilder(account, {
fee: StellarSdk.BASE_FEE,
networkPassphrase: StellarSdk.Networks.PUBLIC
})
.addOperation(StellarSdk.Operation.payment({
destination: 'G...',
asset: StellarSdk.Asset.native(),
amount: '10'
}))
.setTimeout(30)
.build();
// Sign with your secret key (not shown for security)
// Send to network
const result = await server.submitTransaction(transaction);
console.log('Transaction hash:', result.hash);
}
Stellar Faucet for Testnet
To test your dApp on the Stellar Testnet, you need free test lumens (XLM). The Stellar Development Foundation (SDF) provides a faucet:
- Friendbot API:
https://friendbot.stellar.org/?addr=YOUR_PUBLIC_KEY
Example curl request:
curl "https://friendbot.stellar.org/?addr=G..."
This will fund the account with 10,000 test XLM. Managed RPC providers may also offer their own faucet endpoints for their testnet nodes—check your provider's documentation.
Choosing a Stellar RPC Provider
While running your own Horizon + Stellar Core node is possible, most teams prefer a managed RPC provider to avoid operational overhead. Here's a comparison table to evaluate providers:
| Criterion | What to check | Why it matters |
|---|---|---|
| Uptime SLA | Published uptime guarantees and compensation policies | Ensures your dApp remains available; missing SLAs indicate risk |
| Rate limits | Requests per second (RPS) and daily/monthly caps | High-traffic apps need scalable limits |
| Endpoint diversity | Support for both Mainnet and Testnet, plus custom endpoints | Simplifies development and production parity |
| Horizon feature set | Full Horizon endpoints (payments, trades, account details) | Missing endpoints break app functionality |
| Geo-distribution | Global load balancing or regional options | Reduces latency for users worldwide |
| Streaming support | Server-sent events (SSE) for real-time updates | Essential for payment tracking and order books |
| Debugging tools | Transaction simulation, fee estimation endpoints | Speeds up development and error resolution |
OnFinality, for example, supports Stellar with dedicated nodes and shared endpoints, offering customizable rate limits and multi-region infrastructure. You can review the full list of supported networks on our networks page and pricing.
Common Pitfalls and Debugging
- Incorrect network passphrase: Using Mainnet passphrase on Testnet (or vice versa) causes transaction failures. Always double-check.
- Account not funded: On Testnet, you must fund accounts via Friendbot before using them.
- Horizon sync delay: Newly submitted transactions may take a few seconds to appear. Use streaming endpoints for real-time feedback.
- Rate limiting: Free tiers often have low RPS. Monitor your usage and upgrade if needed.
Debugging tip: Use Horizon's transaction submission endpoint to inspect error codes. For example, a 400 response with op_underfunded means the source account lacks XLM.
Key Takeaways
- Stellar RPC is powered by Horizon, a RESTful API that provides access to the Stellar network.
- For production dApps, use a managed RPC provider to handle node operations, load balancing, and uptime.
- Evaluate providers based on endpoint coverage, rate limits, geographic distribution, and support for streaming.
- Always test on Stellar Testnet using Friendbot before deploying to Mainnet.
- OnFinality offers Stellar RPC endpoints as part of a broader multi-chain RPC service with transparent pricing.
Frequently Asked Questions
Can I use Ethereum JSON-RPC to interact with Stellar?
No. Stellar uses the Horizon REST API, not Ethereum's JSON-RPC. You must use Horizon endpoints and the stellar-sdk or raw REST calls.
Does OnFinality support Stellar Testnet? Yes, OnFinality provides endpoints for both Stellar Mainnet and Testnet. Check the network details page for exact URLs.
How do I get free XLM for testing? Use the SDF Friendbot or your provider's own faucet. OnFinality does not currently offer a faucet but supports the public Friendbot.
What are the rate limits for free Stellar RPC? Free tiers typically allow a few requests per second. For higher limits, consider a dedicated node plan. See our pricing page for details.
Can I run a dedicated Stellar node with OnFinality? Yes, OnFinality offers dedicated Stellar nodes with custom configurations and priority support.