Skip to main content
A Solana Feed account is only as fresh as its submitter keeps it. This guide shows how to keep one current with the SDK: subscribe, request rounds, submit them, and scale to many sources. Reading a feed needs no subscription; producing one does.

1. Subscribe

The snippets on this page use sdk from Initialize. Skip this step if the wallet already has a subscription, for example from the backend quickstart: a second subscribe fails.
To renew for another 30 days later:
Both calls transfer the plan price in USDC. maxPriceUsdc is a safety bound: the transaction aborts if the on-chain price is higher than you approved.

2. Derive sourceId

Source identity is deterministic. No separate creation transaction is sent.
sourceId is the keccak256 hash of the canonical apiConfig. The Solana Feed account is keyed by (sourceId, signaturesRequired, submitter), and the first successful submit creates it if it does not exist. For numeric values that move between fetches, use tolerance mode.

3. Request and submit

requestAndSubmit runs these two calls:
If the round succeeds but the Solana submit fails, requestAndSubmit throws SubmitFailedError. The round is already paid for, so submit error.result again with sdk.solana.submitAttestation instead of requesting a new round.

Constraints

  • Subscription must be active.
  • Requested quorum must be within the subscription’s signer limit.
  • A consumer other than the owner must be an active delegate.
  • The gateway response must carry the sourceId derived from apiConfig; the SDK rejects a result that does not.
  • A submitted update must have a strictly newer timestamp than the one stored in the Feed account.

Fast repeated rounds

For repeated updates, cache registry selection config and nodes:

Several attestations in one transaction

sdk.solana.submitAttestations(attestations) submits several attestations of one feed (same sourceId and signaturesRequired, distinct timestamps) in one transaction, applied oldest first. The transaction is atomic. When the attestations do not fit, it throws BatchTooLargeError before sending; error.fits is how many do. See Batch submit.

Many sources at once

requestMany requests a list of sources and, by default, submits each attestation to Solana:
  • The registry inputs are read once and shared by every request.
  • Gateway concurrency is bounded. It halves when the gateway answers busy (HTTP 503 or 429) and grows back while requests succeed. Set the ceiling with concurrency.
  • spreadMs spreads request starts over a window by a hash of each sourceId. The default is 0, no spreading.
  • submit: false skips the Solana submit. submitConcurrency bounds submits in flight (default 8).
  • Results are returned in input order, and a source that fails does not stop the others. A failed submit keeps the signed attestation on the result and sets submitError.
Each request keeps the single-request retry policy described in the gateway client.

Next steps

Read a feed

Consume the feed from TypeScript or your own program.

Gateway client

Retries, private APIs and paywalled sources.

Subscriptions

Plans, quota and delegates.