Using ENSNode's API
Indexing Status API
Section titled “Indexing Status API”Monitor an ENSNode’s indexing progress across multiple chains with the Indexing Status API. This endpoint provides a realtime indexing projection at the given moment. The projection includes a cross-chain indexing status snapshot that collects chain status snapshots for each indexed chain. At the moment, the cross-chain indexing status snapshot can be represented as an omnichain indexing status snapshot.
Endpoint: GET /api/indexing-status
Perfect for building monitoring dashboards, health checks, or determining whether your ENSNode has caught up with recent onchain activity.
Realtime Indexing Distance
Section titled “Realtime Indexing Distance”When monitoring indexing or performing time-sensitive operations, you may wish to verify that an ENSNode instance has indexed sufficient blocks to be within an acceptable distance from the current “tip” of all indexed chains.
The Indexing Status API supports a realtimeProjection.worstCaseDistance field
in response object that enables this verification.
How it works
Section titled “How it works”The realtimeProjection.worstCaseDistance field holds a duration value in
seconds, representing the max distance between the now and
the latest indexed block of each chain and the “tip” of all indexed chains.
This allows your client to programmatically determine whether the ENSNode instance is sufficiently synchronized for your use case before proceeding with operations that depend on the latest onchain data.
Simplified Monitoring API
Section titled “Simplified Monitoring API”For simplified monitoring, you may want to use GET /amirealtime endpoint,
which supports an optional maxWorstCaseDistance parameter (for which default
value is AMIREALTIME_DEFAULT_MAX_WORST_CASE_DISTANCE).
The maxWorstCaseDistance parameter accepts a duration value in seconds,
representing the max worst case distance from the current “tip” of all indexed chains.
When you include this parameter it influences the HTTP response code as follows:
- Success (200 OK): The latest indexed block of each chain is guaranteed within the requested distance from realtime.
- Service Unavailable (503): The latest indexed block of each chain is NOT guaranteed within the requested distance from realtime.