Skip to content

SIDDHANTCOOKIE/ChainSentinals

 
 

Repository files navigation

📌 Overview

Chain Sentinel is a next-gen AI-powered security framework for Web3 networks. It proactively monitors blockchain activity, detects potential fraud or intrusion using AI models, and uses Reactive Smart Contracts (RSCs) to automatically initiate countermeasures like blacklisting wallets.

Think of it as a smart, real-time cybersecurity agent for the decentralized world.


✨ Key Features

  • 🤖 AI-Powered Threat Detection
    Detects suspicious transaction behavior using machine learning.

  • ⛓️ Reactive Smart Contracts (RSCs)
    Automatically responds to high-risk activity on-chain by taking predefined security actions.

  • 🕵️‍♂️ Wallet Risk Evaluation
    Flags and blacklists malicious wallets based on analysis.

  • 📡 Blockchain Event Logging
    Logs and monitors on-chain security events for traceability.

  • 🌐 FastAPI + Web3 Integration
    Efficient backend system using Python with Web3 support for Ethereum.


🧠 How It Works

  1. Monitor: Transactions are sent to the backend in real-time.
  2. Analyze: AI model evaluates risk score based on transaction behavior.
  3. Trigger: If risk > threshold, a Reactive Smart Contract is called.
  4. Act: Contract blacklists the wallet or logs the activity securely.
  5. Log: Event data is stored both on-chain and optionally off-chain.

🛠️ Tech Stack

Layer Tech
Backend API FastAPI, Python
Blockchain Layer Ethereum, Solidity, Web3.py
AI Engine Python ML Model / Inference API
Storage Firebase / MongoDB (Optional)
Smart Contracts RSC-based Solidity Contracts
DevOps Docker, GitHub Actions (Optional)

🗂️ Project Structure

ChainSentinel/ ├── backend/ │ ├── main.py # FastAPI main server │ ├── routes/ # All API endpoints │ ├── services/ # Blockchain & AI services │ ├── models/ # Pydantic models │ └── utils/ # Utility functions ├── contracts/ │ └── ReactiveSmartContract.sol ├── ai_model/ │ ├── model.pkl # Pretrained AI model │ └── inference.py # Prediction logic ├── tests/ │ └── test_endpoints.py ├── README.md └── requirements.txt

yaml Copy Edit


⚙️ Getting Started

✅ Prerequisites

  • Python 3.10+
  • Node.js + Hardhat or Truffle (for contract deployment)
  • Ganache (for local Ethereum testnet)
  • Infura/Alchemy API key (for mainnet/testnet)
  • MongoDB Atlas / Firebase setup (optional)

🔧 Backend Setup

git clone https://github.com/your-username/ChainSentinel.git
cd ChainSentinel/backend
python -m venv venv
source venv/bin/activate   # or .\venv\Scripts\activate on Windows
pip install -r requirements.txt
uvicorn main:app --reload

About

WEb3 ai cybersecurity app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.1%
  • Cython 3.3%
  • C++ 0.8%
  • C 0.8%
  • Fortran 0.0%
  • Meson 0.0%