Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 2.02 KB

File metadata and controls

28 lines (20 loc) · 2.02 KB

Project Structure Guide

This guide provides a map of the Decentralized Oracle Network (DON) codebase, highlighting the major files that house the primary functions and logic.

🏗️ On-Chain Layer (Solidity)

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.

📡 Off-Chain Data Ingestion (Go)

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.

🤝 Aggregation & Consensus (Go)

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 OracleRegistry contract.

🚀 API Gateway (Node.js)

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.

📊 Monitoring & UI (SvelteKit)

The dashboard provides a visual overview of the network.


Key Architectural Decisions

To understand why the project is structured this way, refer to the Architectural Decisions & Tradeoffs section in the main README.