Summary
Integrating staking on Solana requires APIs that expose account data, vote accounts, and stake operations like delegation and withdrawal. The right provider should offer reliable access to getStakeActivation, getVoteAccounts, and transaction submission endpoints. This article covers the key RPC methods and what to evaluate when choosing an API provider for staking dApps.
Solana staking integration decision checklist
Before choosing an API provider for staking integration, verify these aspects:
- Staking RPC method availability: Confirm the provider supports
getStakeActivation,getVoteAccounts,getInflationGovernor, andgetEpochInfoon the desired network (mainnet or devnet). - Transaction submission: You need reliable
sendTransactionwith preflight checks and commitment levels (e.g.,confirmed,finalized). - Archive data: To show historical stake rewards or account snapshots, archive node access is required.
- Rate limits on query-heavy endpoints:
getProgramAccounts(for all stake accounts) can be expensive; ensure the provider allows large responses or offers optimized endpoints. - WebSocket support: For real-time stake activation/deactivation events, you need
subscribeAccountorsubscribeProgram. - Dedicated node option: If your staking app scales, dedicated nodes avoid noisy neighbor effects and provide consistent latency.
What does staking integration involve on Solana?
Solana staking lets token holders delegate SOL to validators and earn rewards. Building a staking app—whether a wallet, dashboard, or validator portal—requires reading on-chain stake accounts, delegating, deactivating, and withdrawing. Each operation uses specific JSON-RPC methods.
A typical staking workflow:
- Query the list of validators and their vote accounts.
- Look up a user's stake accounts (delegated, inactive, withdrawing).
- Submit a
delegateinstruction via a staking program. - Monitor stake activation status.
- Submit
deactivateandwithdrawinstructions. - Display historical rewards and current APR.
Every step depends on reliable RPC access. One failed call can break the UX.
Essential RPC methods for staking
getStakeActivation
Returns the activation state of a stake account (activating, active, deactivating). Essential for showing stake status on a dashboard.
getVoteAccounts
Lists all validators and their vote accounts, including commission, activated stake, and root slot. Used to populate validator selection UIs.
getInflationGovernor
Returns current inflation parameters (rate, foundation share). Needed to estimate rewards.
getEpochInfo
Current epoch, slot, and progress. Required for reward calculations and timing delegation.
getProgramAccounts (Stake Program)
Fetches all stake accounts belonging to a user or program. The Stake program ID is Stake11111111111111111111111111111111111111111. Use with filters for efficiency.
sendTransaction / simulateTransaction
Submit delegation, deactivation, and withdrawal instructions. Simulate first to avoid failures.
getBalance / getTokenAccountBalance
Check user's SOL balance before staking, check reward token balances (if any).
API provider evaluation criteria for staking
Not all Solana API providers treat staking endpoints equally. Use the table below to compare:
| Criterion | What to check | Why it matters |
|---|---|---|
| Staking RPC support | Does the provider expose getStakeActivation, getVoteAccounts, etc.? | Some providers limit advanced methods or require higher tiers. |
| Rate limits on expensive queries | getProgramAccounts with filters may be throttled. | Without generous limits, staking dashboards can't load user accounts quickly. |
| Archive node access | Availability of historical slot/account data. | Needed to show reward history and past stake snapshots. |
| Dedicated node option | Can you provision a private Solana node? | For high-throughput staking portals, dedicated nodes reduce latency variance. |
| WebSocket subscription support | accountSubscribe, programSubscribe. | Enables real-time UI updates on stake activation events. |
| Network coverage | Support for mainnet-beta, devnet, testnet. | Testnet/devnet are crucial for development. |
| Commitment levels | Options for confirmed, finalized, processed. | Staking needs confirmed for latency and finalized for safety. |
Example: Query stake activation with curl
curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getStakeActivation",
"params": [
"GvqEj1gQiHKLmLhT66bG1Uxy3KTZnVJbK75vK9L6pTCS"
]
}
'
Response:
{
"jsonrpc": "2.0",
"result": {
"state": "activating",
"active": 0,
"inactive": 5000000000,
"activating": 5000000000
},
"id": 1
}
If using a provider like OnFinality, replace the URL with your API endpoint and add your API key in the header.
Common pitfalls in staking API integration
- Missing archive data: Many providers only keep recent slot history. If your app needs to show stake rewards from months ago, you need archive node access. OnFinality offers archive data for Solana; check supported networks for details.
getProgramAccountsperformance: Scanning all stake accounts for a user can be slow or hit rate limits. Use thedataSizefilter and includefiltersfor the delegator key. Alternatively, use a dedicated indexer.- Ignoring commitment: Submitting transactions with
processedmay miss errors; staking operations requireconfirmedorfinalizedto ensure finality. - Not planning for congestion: During high network activity, transaction landing is harder. Use priority fees and retry logic. Dedicated nodes can help by providing exclusive access.
Choosing between shared and dedicated nodes for staking
If you're building a production staking app (e.g., a wallet with built-in staking), shared RPC with a good provider may suffice. But as user counts grow, consider dedicated nodes:
- Shared: Cost-effective, good for low-volume dashboards. Risk of rate limiting under traffic spikes.
- Dedicated: Predictable latency, no contention, full control over resources. Ideal for high-frequency staking operations.
OnFinality provides both shared RPC and dedicated node options for Solana, allowing you to scale as needed.
Key Takeaways
- Staking integration on Solana relies on a handful of core RPC methods:
getStakeActivation,getVoteAccounts,getInflationGovernor, andgetProgramAccounts. - Evaluate providers on their support for these methods, rate limits, archive data, and WebSocket availability.
- Use a checklist to compare: infrastructure diversity, archival access, and dedicated node options matter for production.
- Always test on devnet/testnet first. Confirm the provider supports Solana devnet—check our network list.
- For large-scale staking apps, dedicated nodes eliminate noisy neighbor issues and provide consistent performance.
Frequently Asked Questions
Q: Does every Solana RPC provider support getStakeActivation?
A: Most full node providers do, but some lightweight API services may not. Always verify on the provider's documentation page.
Q: Can I use a public RPC endpoint for staking?
A: Public endpoints are rate-limited and unreliable for production. They are fine for testing but not for user-facing staking features.
Q: What is the best way to fetch all stake accounts for a user?
A: Use getProgramAccounts with a filter on the delegator's public key. Some providers offer optimized endpoints; check their documentation.
Q: How do I monitor stake activation in real time?
A: Use WebSocket accountSubscribe on the stake account address. You'll receive notifications when the activation state changes.
Q: Does OnFinality support Solana staking RPC methods?
A: Yes. OnFinality provides full Solana RPC support with access to all standard methods. See Solana network page for details.