CryptoGuard is an advanced blockchain forensics and regulatory technology platform designed to detect and prevent money laundering in digital wallets. Built with AI/ML models and a modern web interface, it combines real-time transaction analysis with interactive visualization tools for AML compliance and risk assessment.
| π€ ML Models | π Data Points | β‘ Processing Speed | π― Accuracy |
|---|---|---|---|
| 5 Ensemble | Millions+ | Real-time | High |
| CatBoost, XGBoost, LightGBM | Blockchain Transactions | < 1 second | 85-95% |
- Overview
- Features
- Project Structure
- Technology Stack
- Quick Start
- Installation
- Configuration
- Usage
- Architecture
- API Documentation
- Development
- License
CryptoGuard leverages multiple machine learning models (CatBoost, LightGBM, XGBoost, Random Forest, Logistic Regression) to analyze blockchain transactions and identify suspicious wallet activities associated with money laundering. The platform provides:
- π Real-time Analysis: Process blockchain transactions and flag suspicious patterns
- π Visual Intelligence: Interactive graphs and 3D topology visualizations
- π― Risk Scoring: AI-powered risk assessment with explainable predictions
- π Case Management: Administrative tools for investigating and managing cases
- β Regulatory Compliance: Support for KYC (Know Your Customer) and AML requirements
- π€ Multi-Model ML Pipeline: Ensemble of 5 trained machine learning models
- CatBoost, LightGBM, XGBoost, Random Forest, Logistic Regression
- β‘ Real-time Transaction Analysis: Process blockchain transactions and wallet behaviors
- π Blockchain Integration: Direct access to on-chain data via BigQuery and Web3 APIs
- π Data Processing Pipeline: ETL pipeline for raw blockchain data
- π API-First Architecture: RESTful API for predictions and analysis
- π‘ Model Explainability: Gemini-powered explanations for predictions
- π Scalable Processing: Handles large-scale blockchain data efficiently
- π¦ User Authentication: MetaMask wallet-based authentication for users
- π¨βπΌ Admin Dashboard: Secure admin portal with email/password authentication
- π Interactive Visualizations:
- π Real-time transaction graphs (force-directed)
- π¨ 3D money laundering topology visualization
- π Peeling chains analysis
- π§ GNN-based detection overlays
- π Case Management: Create, track, and manage AML investigation cases
- π± Responsive Design: Mobile-friendly UI with Tailwind CSS
- π― Risk Scoring: Visual risk indicators and detailed reports
CryptoGuard/
βββ backend/ # Python ML backend service
β βββ app.py # Flask/FastAPI application entry point
β βββ requirements.txt # Python dependencies
β βββ README.md # Backend documentation
β β
β βββ data-pipeline/ # ETL pipeline for blockchain data
β β βββ processor/ # TypeScript data processor
β β β βββ src/ # Transaction fetching and processing scripts
β β β βββ lib/ # Database and utility modules
β β β βββ setup/ # Setup guides for database
β β βββ data/ # SQL queries and data files
β β
β βββ models/ # Trained ML models (joblib format)
β β βββ CatBoost.joblib
β β βββ LightGBM.joblib
β β βββ LogisticRegression.joblib
β β βββ RandomForest.joblib
β β βββ XGBoost.joblib
β β
β βββ utils/ # Utility modules
β β βββ data_process.py # Data preprocessing utilities
β β βββ data_info.py # Data analysis utilities
β β βββ catboost_model.py # CatBoost model wrapper
β β βββ lightgbm_model.py # LightGBM model wrapper
β β βββ xgboost_model.py # XGBoost model wrapper
β β βββ random_forest.py # Random Forest model wrapper
β β βββ logistic_regression.py # Logistic Regression model wrapper
β β βββ crypto_graph_analyzer.py # Transaction graph analysis
β β βββ gemini_explainer.py # AI-powered prediction explanations
β β
β βββ data/ # Datasets
β β βββ raw.csv # Raw blockchain transaction data
β β βββ processed.csv # Preprocessed training data
β β
β βββ catboost_info/ # CatBoost training logs
β
βββ frontend/ # Next.js web application
β βββ src/
β β βββ app/ # App Router pages
β β β βββ page.tsx # Landing page
β β β βββ admin/ # Admin routes
β β β β βββ overview/ # Dashboard overview
β β β β βββ cases/ # Case management
β β β β βββ case/ # Individual case view
β β β β βββ visualization/ # Advanced visualizations
β β β β βββ gnn-detection/ # GNN detection interface
β β β β βββ peeling-chains/ # Peeling chains analysis
β β β β βββ gather-scatter/ # Gather-scatter visualization
β β β βββ user/ # User routes
β β βββ api/ # API routes
β β β βββ auth/ # Authentication endpoints
β β βββ components/ # Reusable UI components
β β β βββ ui/ # Base UI primitives
β β β βββ visualizations/ # Visualization components
β β βββ lib/ # Utility libraries
β β β βββ auth.ts # Authentication logic
β β β βββ wallet-service.ts # Web3/MetaMask integration
β β β βββ auth-context.tsx # Auth React context
β β β βββ api/ # API client utilities
β β β βββ utils.ts # General utilities
β β βββ providers/ # React providers
β β βββ styles/ # Global stylesheets
β βββ package.json
β βββ tsconfig.json
β βββ next.config.mjs
β βββ README.md # Frontend documentation
β
βββ .gitignore # Global git ignore
βββ README.md # THIS FILE - Root documentation
βββ LICENSE # MIT License
βββ ARCHITECTURE.md # System architecture documentation
βββ SETUP.md # Detailed setup instructions
βββ package.json # Monorepo root configuration
| Component | Technology | Purpose |
|---|---|---|
| Runtime | Python 3.9+ | Core backend language |
| Web Framework | Flask/FastAPI | HTTP API server |
| ML/AI | CatBoost, LightGBM, XGBoost, scikit-learn | Model training and prediction |
| Data Processing | Pandas, NumPy | Data manipulation and analysis |
| Blockchain Data | BigQuery, Web3.py | On-chain data access |
| Explanations | Google Gemini API | AI-powered result explanations |
| Serialization | joblib, pickle | Model persistence |
| Component | Technology | Purpose |
|---|---|---|
| Framework | Next.js 14 (App Router) | React-based web application |
| Styling | Tailwind CSS 4 | Utility-first CSS framework |
| UI Components | Radix UI | Unstyled, accessible components |
| Authentication | jose (JWT) | Token management |
| Web3 | ethers.js | MetaMask and blockchain interaction |
| Visualization | Three.js, react-force-graph | 3D and graph visualizations |
| Animations | Framer Motion | Smooth UI animations |
| Language | TypeScript | Type-safe frontend code |
| Component | Technology | Purpose |
|---|---|---|
| Language | TypeScript | Type-safe data processing |
| Database | PostgreSQL | Data storage |
| API | Dune Analytics, BigQuery | Blockchain data sources |
| Runtime | Node.js | Script execution |
- Node.js 18+ (for frontend)
- Python 3.9+ (for backend)
- npm or yarn (for package management)
- MetaMask browser extension (for user login)
- Git (for version control)
# Clone the repository
git clone https://github.com/yourusername/CryptoGuard.git
cd CryptoGuard
# Install dependencies for both frontend and backend
npm installcd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install Python dependencies
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env # Create from template if exists
cd ..cd frontend
# Install Node dependencies
npm install
# Configure environment variables
cp .env.example .env.local # Create from template if exists
cd ..# Terminal 1: Start backend
cd backend
python app.py
# Terminal 2: Start frontend
cd frontend
npm run devVisit http://localhost:3000 in your browser.
cd backend
# Create Python virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtRequirements:
- Python 3.8+
- pip package manager
- Virtual environment tool (venv)
cd frontend
# Install Node dependencies
npm install
# or
yarn install
# Verify installation
npm --version # Should be 9+
node --version # Should be 18+Requirements:
- Node.js 18+
- npm 9+ or yarn 3+
Create a .env file in the backend/ directory:
# Flask/FastAPI Configuration
FLASK_ENV=development
API_PORT=5000
# Machine Learning Models
MODEL_PATH=./models
SCALER_PATH=./models/scaler.pkl
# Blockchain Data Sources
BIGQUERY_PROJECT_ID=your-project-id
BIGQUERY_DATASET=your-dataset
# Gemini API (for explanations)
GEMINI_API_KEY=your-gemini-api-key
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/cryptoguard
# Logging
LOG_LEVEL=INFOCreate a .env.local file in the frontend/ directory:
# Authentication
JWT_SECRET=your-super-secret-key-change-this-in-production
# Admin Credentials
ADMIN_EMAIL=admin@cryptoguard.io
ADMIN_PASSWORD=your-secure-password-change-this
# Backend API
NEXT_PUBLIC_API_URL=http://localhost:5000
# Network Configuration
NEXT_PUBLIC_NETWORK_ID=1 # 1 for Ethereum mainnet, 5 for Goerli testnetImportant: Never commit .env or .env.local files to version control!
cd backend
# Run the main application
python app.py
# Make API request to predict for a wallet
curl -X POST http://localhost:5000/predict \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "0x1234...",
"transaction_history": [...]
}'- Visit
http://localhost:3000 - Click "Connect Wallet" (MetaMask required)
- Sign the authentication message
- Access user dashboard with transaction analysis
- Visit
http://localhost:3000/auth/admin - Enter configured admin credentials
- Access admin dashboard for case management and detailed analysis
CryptoGuard follows a monorepo architecture with clear separation of concerns:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Browser β
β (MetaMask Wallet Integration, Web3 Support) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (Next.js 14) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
β β User Routes β βAdmin Dashboardβ β Visualizations β β
β β (MetaMask) β β (JWT Auth) β β(Three.js, D3.js)β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
HTTP/REST API
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (Python API) β
β ββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββ β
β β Data Ingress β β ML Models β β Analysis β β
β β (Validation) β β (5 Models) β β & Scoring β β
β ββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββ β
β β β β
β βββββββββββββββββββ¬βββββββββββββββββββββββ β
β β β
β ββββββββββββββββββ΄ββββββββββββββββββ β
β βΌ βΌ β
β ββββββββββββββββββ ββββββββββββββββββββββββ β
β β Explainability β β Graph Analysis β β
β β (Gemini API) β β (Crypto Analyzer) β β
β ββββββββββββββββββ ββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββΌββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββ βββββββββββ ββββββββββββ
β BigQueryβ β Postgresβ β Redis β
β(Blockchain Data) β(Metadata) β(Cache) β
βββββββββββ βββββββββββ ββββββββββββ
- User Input β Frontend captures wallet address or case parameters
- API Request β Sent to backend with validation
- Data Processing β Backend loads features and preprocessing
- ML Prediction β Ensemble of 5 models generates scores
- Explainability β Gemini API explains prediction reasoning
- Visualization β Results rendered in interactive graphs
- Storage β Case data persisted to PostgreSQL
For detailed architecture documentation, see ARCHITECTURE.md
POST /api/auth/wallet/nonce
Content-Type: application/json
{
"walletAddress": "0x1234567890abcdef..."
}
Response:
{
"nonce": "12345",
"message": "Sign this message to authenticate..."
}
POST /api/auth/wallet/verify
Content-Type: application/json
{
"walletAddress": "0x1234567890abcdef...",
"signature": "0x..."
}
Response:
{
"token": "eyJhbGc...",
"user": {
"walletAddress": "0x1234567890abcdef...",
"isAdmin": false
}
}
POST /api/auth/admin/login
Content-Type: application/json
{
"email": "admin@cryptoguard.io",
"password": "password"
}
Response:
{
"token": "eyJhbGc...",
"user": {
"email": "admin@cryptoguard.io",
"isAdmin": true
}
}
POST /analyze
Content-Type: application/json
Authorization: Bearer {token}
{
"walletAddress": "0x1234567890abcdef...",
"includeExplanation": true
}
Response:
{
"riskScore": 0.87,
"category": "high_risk",
"modelScores": {
"catboost": 0.89,
"lightgbm": 0.85,
"xgboost": 0.88,
"randomforest": 0.86,
"logisticregression": 0.82
},
"explanation": "This wallet shows patterns consistent with...",
"flaggedFeatures": [...]
}
For complete API documentation, see API.md (to be created)
# Terminal 1: Backend (Flask Development Server)
cd backend
python app.py
# π Runs on http://localhost:5000
# Terminal 2: Frontend (Next.js Development Server)
cd frontend
npm run dev
# π Runs on http://localhost:3000Backend Debugging:
# Run with Python debugger
python -m pdb app.py
# Or use VS Code with Python extension
# π Add breakpoints and use Debug launcher (F5)Frontend Debugging:
# Use Next.js built-in debugging
# VSCode: Select "Next.js: debug server-side" launcher
# Or use browser DevTools
# π F12 β Sources tab β Set breakpoints# Backend tests (when test suite is added)
cd backend
pytest tests/ -v
# Frontend tests
cd frontend
npm run test
# or
npm run test:watch- Backend: Follow PEP 8 with
blackandflake8 - Frontend: Follow ESLint rules in
.eslintrc.json
| Feature | CryptoGuard | Traditional AML Tools |
|---|---|---|
| ML Models | π’ 5 Ensemble Models | π‘ Single Model/Rules |
| Real-time Analysis | π’ Instant Predictions | π΄ Batch Processing |
| Blockchain Native | π’ Direct On-Chain Data | π‘ Third-party APIs |
| Explainability | π’ AI-Powered Insights | π΄ Black Box |
| Visualization | π’ Interactive 3D/Graphs | π‘ Static Reports |
| Open Source | π’ Fully Open | π΄ Proprietary |
| Cost | π’ Free | π΄ Expensive Licenses |
This project is licensed under the MIT License - see the LICENSE file for details.
- π Blockchain Security Community for insights and best practices
- π Open Source Contributors of all dependencies used
- π§ ML Research Community for model architectures and techniques
- π Ethereum Foundation for Web3 infrastructure
For questions, issues, or suggestions:
- π Bug Reports: Open an issue
- π‘ Feature Requests: Create a discussion
- π§ Email: contact@cryptoguard.io
- π¬ Community: Join our discussions
- Multi-model ML pipeline
- MetaMask authentication
- Interactive visualizations
- Case management system
- Enhanced GNN-based detection models
- Real-time blockchain monitoring
- Advanced risk scoring algorithms
- API rate limiting and quota management
- Multi-chain support (Polygon, BSC, Arbitrum)
- Mobile application (iOS/Android)
- Regulatory reporting features
- Webhook support for external systems
- Machine learning model retraining pipeline
Built with β€οΈ by the CryptoGuard Team
π Making Blockchain Safer, One Transaction at a Time
Last Updated: February 2026
Version: 1.0.0