Logo
RPC Assistant

What to look for in APIs for Solana staking integration

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, and getEpochInfo on the desired network (mainnet or devnet).
  • Transaction submission: You need reliable sendTransaction with 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 subscribeAccount or subscribeProgram.
  • 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:

  1. Query the list of validators and their vote accounts.
  2. Look up a user's stake accounts (delegated, inactive, withdrawing).
  3. Submit a delegate instruction via a staking program.
  4. Monitor stake activation status.
  5. Submit deactivate and withdraw instructions.
  6. 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:

CriterionWhat to checkWhy it matters
Staking RPC supportDoes the provider expose getStakeActivation, getVoteAccounts, etc.?Some providers limit advanced methods or require higher tiers.
Rate limits on expensive queriesgetProgramAccounts with filters may be throttled.Without generous limits, staking dashboards can't load user accounts quickly.
Archive node accessAvailability of historical slot/account data.Needed to show reward history and past stake snapshots.
Dedicated node optionCan you provision a private Solana node?For high-throughput staking portals, dedicated nodes reduce latency variance.
WebSocket subscription supportaccountSubscribe, programSubscribe.Enables real-time UI updates on stake activation events.
Network coverageSupport for mainnet-beta, devnet, testnet.Testnet/devnet are crucial for development.
Commitment levelsOptions 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.
  • getProgramAccounts performance: Scanning all stake accounts for a user can be slow or hit rate limits. Use the dataSize filter and include filters for the delegator key. Alternatively, use a dedicated indexer.
  • Ignoring commitment: Submitting transactions with processed may miss errors; staking operations require confirmed or finalized to 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, and getProgramAccounts.
  • 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.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started