Switchboard Solana/SVM Feeds Skill
Purpose
Integrate Switchboard on-demand feeds into Solana/SVM transactions and programs:
Compose transactions that verify/update and then consume feed values correctly
Implement on-chain verification patterns (Anchor/Rust) when your program consumes feeds
Support “cranking” patterns to keep canonical quote accounts warm (push-like behavior)
This skill is about integration correctness, not designing new feed definitions (handled by switchboard-feed-design).
Preconditions
OperatorPolicyexists (network, RPC allowlist, autonomy/spend limits).
Inputs to Collect
network: mainnet-beta / devnet / customrpcUrl(optional override)crossbarUrl(public or self-hosted)feedIdlist (32-byte0x...hex)consumer program ID / instruction shape (if integrating)
validation targets: max staleness (slots), max deviation, min responses
Solana/SVM Integration Invariants
Consumer instruction must occur after Switchboard verification/update instructions in the same transaction.
Use deterministic/canonical accounts; do not accept arbitrary “quote accounts” without canonical checks.
Variable overrides are secrets-only (never selectors/URLs/paths/IDs/multipliers).
Playbook
1) Resolve queue and canonical accounts
Load the correct oracle queue for the network (default unless user specifies).
Derive or verify canonical quote storage addresses as required by the SDK/program pattern.
If your program accepts a quote account, enforce that it is canonical for the queue + feedId.
2) Update + consume in one transaction (TypeScript skeleton)
Goal: fetch Switchboard-managed update instructions, then call the consumer instruction.
Indexing rule:
If you insert pre-instructions (compute budget, setup ixs), you must adjust
instructionIdx.
3) On-chain verification (Rust/Anchor pattern)
Use the on-demand verifier and enforce staleness:
Also enforce, when applicable:
canonical quote address constraints
deviation checks vs stored “last good” value for high-risk logic
4) Cranking pattern (push-like / heartbeat imitation)
Use this when you want other transactions/users to read the most recently cranked value from the canonical quote account without providing updates every time.
Tradeoffs:
Pros: readers can do cheaper reads; UI dashboards can stay warm.
Cons: loses atomic update+use guarantees; must enforce staleness at read-time.
Minimal crank loop: send a transaction that contains only the managed update instructions.
Operational guidance:
Run cranks from a dedicated wallet with explicit spend limits.
Monitor failures and staleness; treat missed cranks as “feed stale” for consumers.
Outputs
Produce a SolanaFeedIntegrationPlan including:
network + RPC/Crossbar URL
feedId(s) and queue resolution method
exact instruction ordering (list)
consumer instruction shape (accounts/args) if integrating
optional safety policy (staleness/deviation/signatures) if requested
crank plan (if requested): cadence, cost bounds, monitoring
Troubleshooting Checklist
Signature verification index mismatch → re-check
instructionIdxvs final tx instruction orderMissing sysvars → include SlotHashes + Instructions sysvars in accounts
Non-canonical quote account → derive canonical address; reject non-canonical inputs
Compute limits → add compute budget ixs; reduce feeds/oracles per tx
References
https://docs.switchboard.xyz/docs-by-chain/solana-svm
https://docs.switchboard.xyz/docs-by-chain/solana-svm/price-feeds
https://docs.switchboard.xyz/tooling/crossbar
Last updated