Summary
A Solana explorer API lets you programmatically query on-chain data such as transactions, accounts, and blocks, powering custom explorers and analytics dashboards. This article explains the core RPC methods, how to choose between public and managed endpoints, and how to build a simple explorer query workflow.
Quick decision guide: public endpoint vs managed RPC
Before you write any code, decide which Solana RPC endpoint you will query. The public api.mainnet-beta.solana.com endpoint is rate-limited and has no SLA, so it is fine for occasional manual checks but not for production explorer features. If you are building a dashboard, indexer, or any tool that makes many requests, you need a managed RPC provider that offers higher throughput, WebSocket support, and dedicated capacity.
For production workloads, OnFinality provides a managed Solana RPC endpoint at https://solana.api.onfinality.io/public with WebSocket support at wss://solana.api.onfinality.io/public-ws. You can also provision a dedicated node for exclusive capacity. Check the RPC pricing page for plan details and the supported networks page for the full list.
If you are just exploring the chain manually, the Solana Explorer is the easiest way to inspect transactions and accounts without writing code. But if you want to build your own explorer or integrate on-chain data into your app, you need the RPC API.
What is a Solana explorer API?
A Solana explorer API is a set of JSON-RPC methods that let you retrieve on-chain data programmatically. Instead of clicking through a web explorer, you can query the same data—transactions, accounts, blocks, token balances—using HTTP or WebSocket requests. This is the foundation for custom explorers, analytics dashboards, portfolio trackers, and backend services.
The Solana RPC API exposes methods to read network state, send transactions, simulate execution, and subscribe to live updates. The most common methods for explorer-like functionality are:
getBlock– retrieve a block by slot number, including transactions and rewards.getTransaction– fetch a transaction by signature, with parsed or raw JSON.getAccountInfo– get the data, lamports, and owner of an account.getBalance– get the SOL balance of an address.getTokenAccountsByOwner– list token accounts owned by an address.getSignaturesForAddress– get recent transaction signatures for an address.getLatestBlockhash– get the current blockhash for transaction construction.
These methods map directly to what you see in a block explorer. For example, when you open a transaction on Solscan, the explorer is calling getTransaction behind the scenes.
Key RPC methods for building an explorer
Let's look at the most useful methods with concrete examples. You can test these with curl or any HTTP client.
Get account info
To fetch the data of an account (e.g., a wallet or a program), use getAccountInfo. The response includes the account's lamport balance, owner program, and raw data.
curl https://solana.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"GgPpTKg78vmzgvPpNsKKBf5WJyNTfXCyhLNQ4TfFhNiT",
{"encoding": "jsonParsed"}
]
}'
Get recent transactions for an address
To list recent transaction signatures for an address, use getSignaturesForAddress. This is what explorer transaction history pages use.
curl https://solana.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getSignaturesForAddress",
"params": [
"GgPpTKg78vmzgvPpNsKKBf5WJyNTfXCyhLNQ4TfFhNiT",
{"limit": 5}
]
}'
Get transaction details
Once you have a signature, fetch the full transaction details with getTransaction. Use "encoding": "jsonParsed" to get human-readable instruction data.
curl https://solana.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"5Uu3mQyUH...",
{"encoding": "jsonParsed"}
]
}'
Get token balances
For token holdings, use getTokenAccountsByOwner. This returns all token accounts owned by an address, including the mint and balance.
curl https://solana.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountsByOwner",
"params": [
"GgPpTKg78vmzgvPpNsKKBf5WJyNTfXCyhLNQ4TfFhNiT",
{"programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},
{"encoding": "jsonParsed"}
]
}'
Using WebSocket for live updates
If you want real-time updates—for example, to monitor new transactions or account changes—use the WebSocket endpoint. Solana's accountSubscribe method lets you listen for changes to an account.
const ws = new WebSocket("wss://solana.api.onfinality.io/public-ws");
ws.onopen = () => {
ws.send(JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "accountSubscribe",
params: [
"GgPpTKg78vmzgvPpNsKKBf5WJyNTfXCyhLNQ4TfFhNiT",
{"encoding": "base64", "commitment": "finalized"}
]
}));
};
ws.onmessage = (event) => {
console.log(JSON.parse(event.data));
};
WebSocket connections are ideal for live dashboards, but they require a provider that supports persistent connections. Public endpoints often limit WebSocket usage, so a managed provider is recommended for production.
Comparing explorer data sources
When building an explorer, you have several options for getting on-chain data. The table below compares the main approaches.
| Data source | Best for | Limitations |
|---|---|---|
| Public RPC endpoint | Manual checks, prototyping | Rate-limited, no SLA, no WebSocket guarantee |
| Managed RPC provider | Production apps, moderate traffic | Requires API key or subscription |
| Dedicated node | High throughput, custom needs | Higher cost, operational overhead |
| Web explorer UI | Human browsing | Not programmable |
For most production explorer features, a managed RPC provider offers the best balance of reliability and cost. If you need full control over the node configuration or have very high query volumes, a dedicated node might be worth it.
Common pitfalls and how to avoid them
Building an explorer API integration can hit a few common issues. Here's what to watch for:
Rate limiting
Public endpoints throttle requests aggressively. If you send too many requests, you'll get 429 Too Many Requests errors. Use a managed provider with higher limits, and implement backoff in your client.
Commitment levels
Solana transactions are processed in stages: processed, confirmed, and finalized. If you query a transaction before it's finalized, you might get null or incomplete data. Always specify a commitment level in your requests, and for explorer displays, use finalized to avoid showing unconfirmed data.
Large responses
getTransaction with jsonParsed can return large payloads, especially for complex transactions. Consider using base64 encoding for raw data and parsing it client-side to reduce bandwidth.
WebSocket reconnection
WebSocket connections can drop. Implement reconnection logic with exponential backoff to maintain a reliable live feed.
Production readiness checklist
Before you launch an explorer or analytics tool, run through this checklist:
- Use a managed RPC provider with a dedicated endpoint for production.
- Set appropriate commitment levels (
confirmedorfinalized) in all queries. - Implement rate limiting and retry logic in your client.
- Use WebSocket subscriptions for real-time updates, with reconnection handling.
- Cache frequently accessed data (e.g., account info, block data) to reduce RPC load.
- Monitor your RPC usage and set up alerts for errors or latency.
Key Takeaways
- A Solana explorer API is the programmatic interface to on-chain data, using JSON-RPC methods like
getTransactionandgetAccountInfo. - Public endpoints are fine for testing but not for production; use a managed RPC provider like OnFinality for reliable access.
- WebSocket subscriptions enable real-time updates, but require a provider that supports persistent connections.
- Always specify commitment levels and handle rate limits to build a robust explorer.
Frequently Asked Questions
What is the difference between a block explorer and an explorer API?
A block explorer is a web application that displays on-chain data in a human-readable format. An explorer API is the underlying RPC interface that lets you query the same data programmatically. You can build your own explorer UI on top of the API.
Can I use the public Solana RPC endpoint for production?
The public endpoint is rate-limited and has no SLA, so it's not recommended for production. Use a managed RPC provider or a dedicated node for reliable access.
How do I get transaction history for an address?
Use the getSignaturesForAddress method to get recent transaction signatures, then getTransaction to fetch details for each signature. Note that this method only returns recent history (up to ~10 minutes or a few thousand transactions), so for full history you need an indexer or archive node.
What is a commitment level in Solana RPC?
Commitment level determines how confirmed a transaction or account state must be before the RPC returns it. processed means the transaction was received, confirmed means it was included in a block, and finalized means the block is confirmed by the cluster. For explorer displays, use finalized to avoid showing unconfirmed data.
Does OnFinality support WebSocket for Solana?
Yes, OnFinality provides a WebSocket endpoint for Solana at wss://solana.api.onfinality.io/public-ws. Check the Solana network page for details.