Sentinel Oracle

Sentinel Oracle is a privacy-preserving, AI-powered DeFi oracle system

Sentinel Oracle

Created At

ETHOnline 2025

Project Description

Sentinel Oracle is 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 Solve

DeFi protocols depend on oracles for pricing data, but these oracles can be:

  • Manipulated through flash loan attacks or MEV strategies
  • Delayed due to network congestion
  • Temporarily incorrect due to API failures

This 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 Solution

Sentinel Oracle continuously monitors asset prices through Pyth Network's Pull Oracles, uses AI-powered anomaly detection (via ASI Alliance) to identify suspicious patterns, and executes privacy-preserving automated protections through Lit Protocol's Vincent framework.

Example Flow:

  1. BTC price drops 10% in 2 minutes ⚠️
  2. AI agent detects anomaly (z-score > 2.5) 🤖
  3. Lit Protocol decrypts user's private trigger conditions 🔓
  4. Vincent executes stop-loss automatically ⚡
  5. User's position is protected 🛡️

Key Features

Real-Time Price Monitoring

  • Fetches live price data from Pyth Network via Hermes API
  • Updates on-chain every 5 seconds using Pull Oracle method
  • Supports multiple assets (currently BTC/USD, easily expandable)

AI-Powered Anomaly Detection

  • Uses statistical analysis (z-score) to detect unusual price movements
  • Sliding window approach with 30-sample history
  • MeTTa reasoning engine provides explainable AI decisions
  • Configurable thresholds

Privacy-Preserving Automation

  • User trigger conditions encrypted with Lit Protocol
  • Threshold encryption ensures privacy until execution
  • Vincent framework handles automated transaction execution
  • No one can see user's private strategies until conditions are met

Beautiful Dashboard

  • Live price visualization with Recharts
  • Real-time anomaly alerts
  • AI agent chat interface (ASI:One simulation)
  • User deposit and trigger management
  • System statistics and monitoring

Technical Architecture

The system consists of four main components:

  1. Smart Contract (SentinelOracle.sol) - Stores prices, manages deposits, handles anomaly flags
  2. AI Agent (agent) - Monitors prices, detects anomalies, provides reasoning
  3. Privacy Layer (lit_vincent/) - Encrypts triggers, executes automated actions
  4. Frontend (frontend/) - User interface and real-time visualization

Real-World Impact

This system could protect millions of dollars in DeFi positions by:

  • Detecting oracle manipulation attempts before they cause damage
  • Automatically executing stop-losses during market anomalies
  • Providing transparency through AI reasoning
  • Maintaining user privacy while enabling automation

How it's Made

How It’s Made – Sentinel Oracle

Overview

  • Full-stack DeFi intelligence system.
  • Integrates Pyth Network (data), ASI/uAgents (AI reasoning), and Lit Protocol (privacy & automation).

Smart Contracts (Solidity + Hardhat)

  • Built using Solidity 0.8.20, Hardhat, and Pyth SDK.

  • Implements dual 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.
  • Uses z-score anomaly detection over a sliding price window.
  • Incorporates a MeTTa-inspired reasoning engine for explainable insights.
  • Includes 30-second cooldown to 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 a StopLossAbility that decrypts and executes automated actions.
  • Uses access control conditions tied 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 Flow

  • Data pipeline: Hermes API → Smart Contract → AI Agent → Flask API → Frontend → Lit/Vincent Execution.
  • End-to-end latency: ~15–30 seconds per detection cycle.

Key Highlights

  • Dynamic 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.

Performance

  • Update 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 Special

  • Combines accurate data, explainable AI, and privacy-preserving automation.
  • Creates an oracle that is intelligent, efficient, and transparent—ideal for secure real-time DeFi operations.
background image mobile

Join the mailing list

Get the latest news and updates