This guide provides a map of the Decentralized Oracle Network (DON) codebase, highlighting the major files that house the primary functions and logic.
The on-chain layer handles registration, request tracking, and settlement.
- OracleRegistry.sol: The core smart contract. It manages node registration (staking), data request events, and the final fulfillment/settlement logic where rewards are distributed and malicious nodes are slashed.
Fetcher nodes are responsible for retrieving real-time data from external sources.
- fetcher.go: Contains the logic for fetching prices from multiple sources (Binance, Coinbase, etc.), calculating the local median, and signing the report.
The aggregator layer bridges the fetchers and the blockchain.
- aggregator/main.go: Houses the consensus logic. It collects reports from multiple fetcher nodes, calculates the network-wide median, determines honest vs. slashed nodes based on deviation, and submits the final transaction to the
OracleRegistrycontract.
The dispatcher acts as the entry point for clients.
- dispatcher/index.ts: The primary API server. It handles client requests (EIP-712 signed), triggers on-chain data requests, and provides a Server-Sent Events (SSE) stream for clients to subscribe to real-time fulfillment updates.
The dashboard provides a visual overview of the network.
- dashboard/src/routes/+page.svelte: The main frontend page for tracking active price feeds and node health.
To understand why the project is structured this way, refer to the Architectural Decisions & Tradeoffs section in the main README.