Concepts
Sequence Numbers
Use monotonic sequence values to reject stale or repeated oracle updates.
Every Doppler oracle stores a sequence before the payload. Updates must increase this value.
Rule
A valid update has:
new_sequence > current_sequenceIf the new sequence is less than or equal to the stored sequence, the program rejects the update as stale.
Choosing a Sequence
Common choices:
| Strategy | Use when |
|---|---|
| Unix timestamp | Your feed updates on wall-clock time and does not need multiple updates in the same second. |
| Clock slot | You want the feed sequence to be as atomic as possible. |
| Incremental counter | You control update ordering outside the chain. |
The only requirement is monotonicity for a given oracle account.
Consumer Guidance
Consumers should keep their own freshness rules. For example:
const oracle = await client.fetchOracle(oracleAddress, serializer);
if (!oracle) {
throw new Error("Oracle account not found");
}
if (oracle.sequence <= lastSeenSequence) {
throw new Error("Stale oracle value");
}Also consider rejecting values that are too old for your application. Doppler prevents replayed or out-of-order writes at the program level, but application-level freshness depends on how you interpret the sequence.