Rivellum

Rivellum Portal

Download Wallet (Chrome)
Checking...
testnet

Indexer And Frontend Patterns Reference

Reference architecture for event-driven dapps on Rivellum.

Data Plane

PlaneSourceContract
Hot updates/events/streamlow-latency UI state transitions
Historical backfillGET /v1/events/querydeterministic catch-up
Receipt detailGET /v1/mist/receipts/:idper-call verification

Event Ingestion Pattern

const ws = new WebSocket('wss://rpc.rivellum.network/events/stream');
ws.onmessage = (msg) => enqueue(JSON.parse(msg.data));

Backfill window:

curl "https://rpc.rivellum.network/v1/events/query?from_batch=1000&limit=1000"

Indexer Storage Schema (Minimal)

TableKeyNotes
events(batch_height, event_id)immutable append
receiptsreceipt_idcanonical execution record
checkpointsconsumer_namelast processed batch/offset

Deterministic Reducer Rules

  1. Reducers are pure and idempotent.
  2. Event ordering uses batch height + intra-batch sequence.
  3. Reprocess from checkpoint must converge to same state.
  4. UI state derives from indexed events, not optimistic assumptions.

Recovery Pattern

  1. load checkpoint
  2. backfill via events/query from checkpoint+1
  3. switch to stream
  4. periodic reconciliation with receipt snapshots

Frontend Query Pattern

const events = await fetch(
  'https://rpc.rivellum.network/v1/events/query?topic=contract.called&from_batch=1234&limit=200'
).then(r => r.json());

Monitoring Signals

SignalMeaning
stream lagconsumer behind head
replay queue depthretry pressure
reducer mismatch countdeterministic bug risk
checkpoint stalenessdata-plane outage risk

Related References

  • /docs/dev/debugging-replay
  • /docs/dev/contract-lifecycle
  • /docs/dev/production-operations