Skip to content

laudzakusuma/CERBERUS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cerberus Watchdog: On-Chain AI Threat Detection

License: MIT U2U Network Built for VietBUILD Built for BI-OJK Hackathon

Cerberus Watchdog adalah sistem AI otonom yang memantau U2U Network secara real-time untuk mendeteksi dan menandai transaksi berbahaya sebelum dieksekusi. Ancaman yang terdeteksi dicatat secara on-chain untuk menciptakan lapisan reputasi yang terdesentralisasi dan abadi.

Fitur Utama

  • AI-Powered Detection: Deteksi ancaman menggunakan algoritma machine learning
  • Real-time Monitoring: Monitoring mempool U2U Network secara real-time
  • On-chain Recording: Pencatatan ancaman permanent di blockchain
  • Advanced Analytics: Dashboard dan analytics untuk threat intelligence
  • Multi-threat Categories: Deteksi 10+ kategori ancaman berbeda

Arsitektur

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   U2U Network   │    │  AI Sentinel    │    │ Smart Contract  │
│   (Mempool)     │───▶│   (Analysis)    │───▶│   (Recording)   │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                │
                                ▼
                       ┌─────────────────┐
                       │   Frontend      │
                       │  (Dashboard)    │
                       └─────────────────┘

Quick Start

Prerequisites

  • Node.js v18+
  • Python 3.9+
  • MetaMask dengan U2U Testnet
  • U2U testnet tokens

Installation

  1. Clone repository
git clone https://github.com/yourusername/cerberus-watchdog.git
cd cerberus-watchdog
  1. Install dependencies
# Install workspace dependencies
pnpm install

# Setup AI Sentinel
cd services/ai-sentinel
python -m venv venv
source venv/bin/activate  # Windows: .\venv\Scripts\Activate.ps1
pip install flask

# Setup Monitor
cd ../mempool-monitor
npm install

# Setup Frontend
cd ../../apps/frontend
npm install
  1. Deploy Smart Contract
cd contracts
npx hardhat run scripts/deploy.ts --network u2u_testnet
  1. Configure Environment
# Copy .env.example to .env dan isi dengan values Anda
cp .env.example .env
  1. Start Services
# Terminal 1: AI Sentinel
cd services/ai-sentinel
python app.py

# Terminal 2: Monitor
cd services/mempool-monitor
node monitor.js

# Terminal 3: Frontend
cd apps/frontend
npm run dev

Configuration

Environment Variables

# U2U Network
U2U_RPC_HTTP=https://rpc-nebulas-testnet.uniultra.xyz
U2U_RPC_WSS=wss://rpc-nebulas-testnet.uniultra.xyz

# Smart Contract
CONTRACT_ADDRESS=your_deployed_contract_address

# Monitor
MONITOR_PRIVATE_KEY=your_wallet_private_key
AI_API_URL=http://127.0.0.1:5001/predict

# Frontend
NEXT_PUBLIC_CONTRACT_ADDRESS=your_deployed_contract_address
NEXT_PUBLIC_U2U_RPC_HTTP=https://rpc-nebulas-testnet.uniultra.xyz

Tech Stack

Smart Contracts

  • Solidity 0.8.28
  • Hardhat untuk development & deployment
  • OpenZeppelin untuk security standards

AI & Backend

  • Python Flask untuk AI API
  • Rule-based ML untuk threat detection
  • Node.js + Ethers.js untuk blockchain monitoring

Frontend

  • Next.js (React) untuk web interface
  • Styled-Components untuk modern UI
  • Real-time WebSocket untuk live updates

Threat Categories

Cerberus dapat mendeteksi berbagai jenis ancaman:

  1. RUG_PULL - Penarikan likuiditas mendadak
  2. FLASH_LOAN_ATTACK - Serangan menggunakan flash loan
  3. FRONT_RUNNING - MEV dan sandwich attacks
  4. SMART_CONTRACT_EXPLOIT - Eksploitasi vulnerability kontrak
  5. PHISHING_CONTRACT - Kontrak phishing palsu
  6. PRICE_MANIPULATION - Manipulasi harga token
  7. HONEY_POT - Trap contracts
  8. GOVERNANCE_ATTACK - Serangan pada governance
  9. MEV_ABUSE - Penyalahgunaan MEV

Demo

Live Detection Example

Analyzing: 0xbd9623e0... | Value: 1.0000 U2U
Danger: 100.0 | Category: FRONT_RUNNING | Malicious: true
THREAT DETECTED! Reporting to blockchain...
Report sent! Tx: 0x0fc59d18...
Confirmed on block: 59465798

Smart Contract Events

event ThreatReported(
    uint256 indexed alertId,
    bytes32 indexed txHash,
    address indexed flaggedAddress,
    ThreatLevel level,
    ThreatCategory category,
    uint256 confidenceScore,
    address reporter,
    uint256 timestamp
);

Deployed Contracts

Contributing

  1. Fork repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Hackathon

Built for VietBUILD Hackathon - demonstrating innovative blockchain security solutions on U2U Network.

Contact


⚠️ Disclaimer: This is a proof-of-concept built for hackathon purposes. Use in production environments requires additional security audits and testing.

CERBERUS

511bbbf98f4bd352074e35e017d23afc642eba37

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors