Repository navigation
DIN Indexer
🚧 This wiki describes DevNet 2.0, soon to be launched. It follows the contracts and
dinclion thedevelopbranch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: #102.
⚡ Status: In progress, not on
developyet. A Graph Protocol subgraph (schema, event handlers, and a local Graph node via docker-compose), including the first CLI integration, lives in PR #29 and PR #72 onfeat/din-indexer; it still needs re-wiring to the current contracts before it can merge. This page describes its design intent per the project roadmap (phase P4) and the indexer design doc; details may change.
The DIN Indexer is the planned off-chain read layer for the DIN network: a service (a Graph Protocol subgraph, or a lighter equivalent) that ingests the event streams of the Platform Contracts — DinCoordinator, DinToken, DinValidatorStake, DINModelRegistry, and in DevNet 2.0 also DinFeeRouter, DinTreasury and DinEmission — and turns them into queryable entities.
The division of labour it establishes:
- On-chain stays the canonical coordination and settlement layer: authorization, approvals, staking, slashing, state transitions, and the events that record them.
- The indexer owns everything read-heavy: filtering, sorting, pagination, historical views, and cross-contract joins — model request queues, validator slash histories, fee-change timelines, activity feeds.
Today the DIN CLI reads all on-chain state live over RPC, and in several places it enumerates items by looping over on-chain counters with one contract call per item (for example, listing pending model registration requests). That works on a small devnet but scales poorly: query cost grows linearly with network history, and every richer view (dashboards, histories, per-owner filters) would otherwise push storage-heavy enumeration structures into the contracts themselves — paying permanent gas and audit complexity for what is fundamentally a read-layer concern.
An indexer solves this the way mature protocols do:
- contracts stay minimal and events-first;
- the CLI (and later the DIN Daemon) query indexed entities instead of looping over RPC;
- dashboards, analytics, and governance views become possible without any contract changes.
The indexer also feeds the daemon: dind's planned on-chain event listening (reacting to GI state changes, registration windows, slash events) builds on the same event schema the indexer defines.
Platform Contracts (on-chain, canonical state)
│ events
▼
DIN Indexer (planned — subgraph / event-poller + query API)
│ queries
├──────────────┬─────────────────┐
▼ ▼ ▼
DIN CLI DIN Daemon dashboards &
(list/filter (event-driven analytics
views) job triggers) (future)
First integration target: replacing the CLI's pending-request enumeration loop with a single indexer query. Indexing of the per-model Task Contracts (which are deployed dynamically by model owners) requires a materially harder pattern and is deferred to a later phase.
Per the roadmap, the indexer is a P4 work-package series — design (approach choice and entity schema), implementation (event mappings and the first CLI integration), then test-suite integration — targeted for Oct–Nov 2026. The events it needs, including the task-level events, now exist on develop; the remaining gap is re-wiring the existing subgraph work to the current ABIs and merging it. Publishing to a hosted Graph endpoint is tracked separately (issue #174); for the devnet, hosting is user-side.
- Indexer design doc — the indexer-first architecture rationale: what stays on-chain, what moves off-chain
- Roadmap — P4 phase: indexer work packages
- Tracking issue #24 — Start DIN-Indexer
- Platform Contracts — the contracts whose events get indexed
- DIN Daemon — the planned consumer of the indexer's event schema
- Platform Contracts
- Task Contracts
- DIN CLI
- DIN SDK (in progress)
- DIN Daemon (in progress)
- DIN Indexer (in progress)
- DIN DAO (deferred)
- IPFS Layer
- DIN Node
- Worker Node