Sentinel Oracle
Sentinel Oracle is a privacy-preserving, AI-powered DeFi oracle system
Problem Statement
Sentinel Oracleis an AI-powered, privacy-preserving oracle system that makes DeFi safer by detecting anomalies in real-time price feeds and automatically executing protective actions. It's a complete solution that combines three cutting-edge technologies to solve a critical problem in decentralized finance.The Problem We SolveDeFi protocols depend on oracles for pricing data, but these oracles can be:Manipulatedthrough flash loan attacks or MEV strategiesDelayeddue to network congestionTemporarily incorrectdue to API failuresThis leads to cascading liquidations and millions in financial losses. Currently, there's no way to automatically detect and respond to anomalous price data while preserving user privacy.Our SolutionSentinel Oracle continuously monitors asset prices throughPyth Network's Pull Oracles, usesAI-powered anomaly detection(via ASI Alliance) to identify suspicious patterns, and executesprivacy-preserving automated protectionsthrough Lit Protocol's Vincent framework.Example Flow:BTC price drops 10% in 2 minutes ⚠️AI agent detects anomaly (z-score > 2.5) 🤖Lit Protocol decrypts user's private trigger conditions 🔓Vincent executes stop-loss automatically ⚡User's position is protected 🛡️Key FeaturesReal-Time Price MonitoringFetches live price data from Pyth Network via Hermes APIUpdates on-chain every 5 seconds using Pull Oracle methodSupports multiple assets (currently BTC/USD, easily expandable)AI-Powered Anomaly DetectionUses statistical analysis (z-score) to detect unusual price movementsSliding window approach with 30-sample historyMeTTa reasoning engine provides explainable AI decisionsConfigurable thresholdsPrivacy-Preserving AutomationUser trigger conditions encrypted with Lit ProtocolThreshold encryption ensures privacy until executionVincent framework handles automated transaction executionNo one can see user's private strategies until conditions are metBeautiful DashboardLive price visualization with RechartsReal-time anomaly alertsAI agent chat interface (ASI:One simulation)User deposit and trigger managementSystem statistics and monitoringTechnical ArchitectureThe system consists of four main components:Smart Contract(SentinelOracle.sol) - Stores prices, manages deposits, handles anomaly flagsAI Agent(agent) - Monitors prices, detects anomalies, provides reasoningPrivacy Layer(lit_vincent/) - Encrypts triggers, executes automated actionsFrontend(frontend/) - User interface and real-time visualizationReal-World ImpactThis system could protect millions of dollars in DeFi positions by:Detecting oracle manipulation attempts before they cause damageAutomatically executing stop-losses during market anomaliesProviding transparency through AI reasoningMaintaining user privacy while enabling automation
Solution
How It’s Made – Sentinel OracleOverviewFull-stack DeFi intelligence system.IntegratesPyth Network(data),ASI/uAgents(AI reasoning), andLit Protocol(privacy & automation).Smart Contracts (Solidity + Hardhat)Built using Solidity 0.8.20, Hardhat, and Pyth SDK.Implementsdual price layers:Fresh Pyth data for accuracy.Cached data for fast AI access.Uses dynamic asset mapping (keccak256(asset)→ Pyth feed ID).Optimized for low gas and easy extensibility.AI Agent (Python + uAgents)Developed with Python, Flask, Web3.py, NumPy, and uAgents.Usesz-score anomaly detectionover a sliding price window.Incorporates aMeTTa-inspired reasoning enginefor explainable insights.Includes30-second cooldownto prevent redundant anomaly alerts.Privacy & Automation (Lit Protocol + Vincent)Uses Lit Protocol SDK v3 and Vincent framework on Datil testnet.Encrypts user triggers off-chain; stores only hash on-chain for gas savings.Implements aStopLossAbilitythat decrypts and executes automated actions.Usesaccess control conditionstied to on-chain states for secure automation.Frontend (Next.js + Ethers.js)Built with Next.js 14, React 18, Tailwind CSS, Recharts, and Ethers.js v6.5-second smart polling for real-time updates.Multi-asset dashboard with z-score–based color indicators for anomaly visualization.Integration FlowData pipeline: Hermes API → Smart Contract → AI Agent → Flask API → Frontend → Lit/Vincent Execution.End-to-end latency: ~15–30 seconds per detection cycle.Key HighlightsDynamic asset mapping without contract redeployment.Hybrid on-chain/off-chain price layers.Gas-optimized (hash-only) on-chain data storage.Mock data fallback ensures system resilience.Python–JS bridge for cross-language data flow.PerformanceUpdate interval: every 5 seconds.Uptime: ~99.9% during testing.Gas cost: ~$3–8 per full cycle.Adaptive 30-sample AI window for stability and responsiveness.Why It’s SpecialCombinesaccurate data,explainable AI, andprivacy-preserving automation.Creates an oracle that is intelligent, efficient, and transparent—ideal for secure real-time DeFi operations.
Hackathon
ETHOnline 2025
2025
Contributors
- yourdevkalki
17 contributions