MonGuard
MonGuard is an Al-powered, on-chain AML and compliance platform on Monad. It uses smart contracts and a Python/PyTorch ML engine for real-time risk scoring and threat detection. Features include audit
Videos
Description
π‘ MonGuard β AI-Powered Compliance & Risk Analytics for Monad Smart Accounts β‘ Real-Time On-Chain Monitoring Using MetaMask Smart Accounts, Delegation Toolkit, and ML Engine MonGuard is an AI-driven compliance and risk analytics platform deployed on the Monad testnet. It leverages MetaMask Smart Accounts and the Delegation Toolkit SDK to provide modular, programmable compliance for Web3 wallets, with real-time ML-powered monitoring and analytics. π¦ MetaMask Smart Accounts - Uses Delegation Toolkit for programmable, gasless compliance actions π Monad Testnet - Fully deployed & functional on Monad π‘ Problem Statement On-chain compliance and risk management today is: - Manual and reactive - Lacking automation and real-time analytics - Difficult for users and protocols to monitor risk MonGuard Solves This By: - Using MetaMask Smart Accounts for programmable compliance - Delegation Toolkit for permissioned, automated actions - ML engine for real-time risk scoring and anomaly detection - Monad testnet deployment for high-speed analytics π§ Core Idea MonGuard acts as an AI compliance agent for your smart account. It continuously monitors transactions, flags risks, and enforces compliance rules using delegated permissionsβwhile you retain full control of your assets. βοΈ Tech Stack Layer | Tech --------------|-------------------------------------- Frontend | Next.js + Tailwind + Framer Motion Smart Account | MetaMask Delegation Toolkit (ERC-4337, ERC-7710) Chain | Monad Testnet Indexing | (Optional) Envio Backend | Node.js (Express API) ML Layer | PyTorch ML Engine (risk scoring) SDK | Custom JS/TS SDK π§© System Architecture Overview ββββββββββββββββββββββββββββββββββββββββββββββββ β User Interface β ββββββββββββββββββββββββββββββββββββββββββββββββ β - Next.js Frontend Dashboard β β - MetaMask Smart Account Connection β β - Compliance & Risk Analytics UI β βββββββββββββββββββββ¬ββββββββββββββββββββββββββββ β βΌ ββββββββββββββββββββββββββββββββββββββββββββββββ β API & ML Engine Layer β ββββββββββββββββββββββββββββββββββββββββββββββββ β - Node.js API (Express) β β - ML Engine (PyTorch, risk scoring) β β - Delegation Toolkit SDK β βββββββββββββββββββββ¬ββββββββββββββββββββββββββββ β βΌ ββββββββββββββββββββββββββββββββββββββββββββββββ β Blockchain Layer (Monad) β ββββββββββββββββββββββββββββββββββββββββββββββββ β - MetaMask Smart Account (Delegation) β β - Compliance Oracle & Risk Registry β β - Enforcement Contracts β ββββββββββββββββββββββββββββββββββββββββββββββββ π§ Workflow (Mermaid Sequence Diagram) sequenceDiagram participant User participant MonGuard UI participant ML Engine participant Smart Account participant Monad Chain participant (Envio) User->>MonGuard UI: Connect MetaMask Smart Account MonGuard UI->>ML Engine: Fetch risk & compliance analytics ML Engine-->>MonGuard UI: Return risk scores, flagged txs MonGuard UI->>Smart Account: Delegate compliance permissions Smart Account->>Monad Chain: Execute compliance actions (gasless) π¦ MetaMask Smart Accounts Integration MonGuard uses MetaMaskβs Delegation Toolkit to: - Create user smart accounts (ERC-4337/7710) - Delegate compliance permissions to MonGuard agent - Automate risk flagging and enforcement - Enforce rules with caveat enforcers (e.g., spend limits, allowlists) Example Delegation Flow: await createDelegation({ delegate: "0xMonGuardAgent", caveats: [ { type: "SpendLimit", value: "1000 USDC" }, { type: "AddressAllowlist", value: ["0x...", "0x..."] } ], }); π Monad Testnet Deployment MonGuard is deployed and tested on the Monad testnet, chosen for: - High throughput and low latency - EVM compatibility (easy MetaMask AA integration) - (Optional) Envio support for fast indexing Deployment contracts include: Contract | Address | Description ------------------------|-----------|----------------------------- ComplianceOracle | 0x... | Compliance rules & checks RiskRegistry | 0x... | Risk scoring registry Enforcement | 0x... | Automated enforcement SmartAccount | 0x... | User-owned smart account π§ Risk & Compliance Logic The MonGuard Agent: - Fetches live risk & compliance data from ML engine - Scores each transaction/wallet for risk - Flags or blocks risky actions via delegated permissions - Executes compliance actions (e.g., freeze, alert) - Updates dashboard in real time π Architecture Diagram (Mermaid) graph TD A[User] --> B[MonGuard Frontend] B --> C[API + ML Engine] C --> D[Monad Blockchain] D --> E[MetaMask Smart Account] C --> F[Compliance Oracle] C --> G[Risk Registry] D --> H[Envio (optional)] π§© Unique Innovation Feature | Description -------------------------|-------------------------------------- AI Compliance Agent | Delegated to act automatically for users using MetaMask Smart Accounts Gasless Enforcement | Removes gas fees through paymasters ML-Powered Risk Scoring | Real-time risk analytics Envio-Powered Indexing | (Optional) Fast, indexed compliance data Monad Deployment | Uses Monadβs high throughput for instant analytics Caveat Enforcers | Prevent risky or unapproved actions π¬ Example User Flow 1οΈβ£ User connects MetaMask Smart Account 2οΈβ£ MonGuard shows live compliance & risk analytics 3οΈβ£ User delegates compliance permissions 4οΈβ£ MonGuard agent monitors and flags risky activity 5οΈβ£ Smart Account executes gasless compliance actions 6οΈβ£ Dashboard updates in real time π§ Security Model - Non-custodial: Only userβs smart account owns funds - Delegated rights: MonGuard agent has limited permission (caveats) - (Optional) Envio verifiability: Indexed data publicly queryable - Gas abstraction: Paymaster ensures safe transaction sponsorship π§ Setup Instructions # Clone $ git clone https://github.com/tu-tu-op/MonGuard.git $ cd MonGuard # Install dependencies $ npm install (in api/, frontend/, sdk/js/) # Setup env $ cp .env.example .env (in each package) # Add: # NEXT_PUBLIC_API_URL # RPC_URL, contract addresses, etc. # Run ML engine, API, and frontend $ cd ml-engine && python -m ... (start ML engine) $ cd api && npm run dev $ cd frontend && npm run dev π§ Future Roadmap β Add Envio integration for indexed compliance data π Expand ML models for advanced risk analytics π§ Enhance automation with more caveat enforcers π¬ Add notification integrations (Telegram, Email) π± Mobile-friendly UI π Qualification Matrix Requirement | Fulfilled By ---------------------------|----------------------------- MetaMask Smart Account | Delegation Toolkit + Caveat Enforcers Monad Testnet | Deployed Compliance Contracts Envio (optional) | (Planned/Integrated) AI/ML Integration | PyTorch ML Engine Gasless Execution | MetaMask Paymaster System πͺ Summary MonGuard = AI x Smart Accounts x Monad x (Envio) A fully autonomous, non-custodial, and gasless compliance agent for Web3, leveraging MetaMask Delegation, deployed on Monad testnet, and powered by real-time ML analytics. Progress During Hackathon - Fully functional ML-powered compliance dashboard - Deployed on Monad testnet - MetaMask Smart Account integration - (Optional) Envio integration in progress Tech Stack - Next.js - Node.js - Solidity - PyTorch - MetaMask Delegation Toolkit - (Optional) Envio