A hybrid AML detection framework combining Isolation Forest anomaly detection with rule-based risk scoring, secured by Ethereum blockchain for immutable audit trails.
Traditional Anti-Money Laundering (AML) systems rely on centralized, rule-based approaches that struggle with adaptability, transparency, and cross-institutional visibility. This project proposes a hybrid AML framework that addresses these limitations through:
- Isolation Forest — Unsupervised ML algorithm detecting novel anomalous transaction patterns without labeled data
- Rule-Based Risk Scoring — Captures known suspicious patterns (structuring, high-value transfers, rapid-fire transactions)
- Hybrid Scoring — Weighted combination
S = αA + βRthat outperforms either approach alone - Blockchain Ledger — Ethereum-based immutable storage ensuring tamper-proof audit trails
All transaction amounts are in Indian Rupees (₹), with thresholds aligned to Indian AML regulations (PMLA).
┌─────────────────────────────────────────────────────────────────┐
│ Frontend Dashboard │
│ (HTML/CSS/JS, Chart.js, Ethers.js) │
└────────────────────────┬────────────────────────────────────────┘
│ REST API
┌────────────────────────▼────────────────────────────────────────┐
│ Flask Backend (Orchestration) │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Isolation Forest │ │ Rule-Based │ │
│ │ (Anomaly Score) │ │ (Risk Score) │ │
│ └────────┬─────────┘ └────────┬─────────┘ │
│ │ Hybrid Scorer │ │
│ └──────┬───────────────┘ │
│ ▼ │
│ S = αA + βR → Classification │
└─────────────────┬───────────────────────────────────────────────┘
│ Web3.py
┌─────────────────▼───────────────────────────────────────────────┐
│ Ethereum Blockchain (Hardhat / Sepolia) │
│ AMLRegistry Smart Contract (Solidity) │
│ Immutable Transaction + Classification Storage │
└─────────────────────────────────────────────────────────────────┘
- Hybrid Detection — Combines ML anomaly detection + rule-based scoring
- 5 Laundering Patterns — Structuring, layering, round-tripping, large transfers, rapid-fire
- 50,000 Transaction Dataset — Seed-reproducible synthetic generator (INR-denominated)
- 4-Method Comparison — Isolation Forest vs. One-Class SVM vs. Rule-Based vs. Hybrid
- Ablation Study — α/β weight sweep to find optimal hybrid balance
- Publication-Quality Figures — ROC curves, PR curves, confusion matrices, per-pattern detection
- Smart Contracts — Solidity-based immutable audit trail on Ethereum
- State-of-the-Art Dashboard — Dark mode, glassmorphism, real-time charts
- Full Reproducibility — Single command generates all results
- Python 3.9+
- Node.js 18+ (LTS)
- Git
git clone <repo-url>
cd AML
# Python dependencies
pip install -r requirements.txt
# Node.js dependencies (Hardhat + Solidity)
npm installpython run_experiments.pyThis single command:
- Generates the synthetic dataset (50,000 transactions)
- Extracts behavioral features
- Trains Isolation Forest & One-Class SVM
- Computes rule-based and hybrid scores
- Runs ablation study
- Produces all figures and tables in
results/
# Terminal 1: Start local blockchain
npx hardhat node
# Terminal 2: Deploy contract
npm run deploy:localpython backend/app.pyOpen frontend/index.html in your browser, or serve it:
cd frontend && python -m http.server 8080Navigate to http://localhost:8080
- Copy
.env.exampleto.env - Add your Infura/Alchemy RPC URL and wallet private key
- Deploy:
npm run deploy:sepoliaAML/
├── contracts/ # Solidity smart contracts
│ └── AMLRegistry.sol
├── scripts/ # Deployment scripts
├── test/ # Smart contract tests
├── ml/ # Machine learning pipeline
│ ├── config.py # Centralized configuration
│ ├── data_generator.py # Synthetic dataset generator
│ ├── feature_engineering.py
│ ├── isolation_forest.py
│ ├── rule_engine.py
│ ├── hybrid_scorer.py
│ └── evaluate.py
├── backend/ # Flask API server
├── frontend/ # Web dashboard
├── notebooks/ # Jupyter notebooks for paper
├── results/ # Generated figures, tables, metrics
├── run_experiments.py # Master reproducibility script
└── README.md
After running python run_experiments.py, results are saved to:
| Output | Location |
|---|---|
| Figures (ROC, PR, confusion matrices) | results/figures/ |
| Comparison tables (CSV + LaTeX) | results/tables/ |
| All metrics (JSON) | results/metrics/ |
| Trained models | ml/models/ |
| Dataset | data/synthetic_transactions.csv |
| Layer | Technology |
|---|---|
| ML Pipeline | Python, Scikit-learn, Pandas, NumPy |
| Visualization | Matplotlib, Seaborn, Chart.js |
| Smart Contracts | Solidity 0.8.20 |
| Blockchain Dev | Hardhat, Ethers.js |
| Backend | Flask, Web3.py |
| Frontend | HTML5, CSS3, JavaScript |
| Testnet | Ethereum Sepolia |
This implementation directly supports the following paper sections:
- Methodology — Hybrid scoring formula, feature engineering, 5 laundering patterns
- Experiments — 4-method comparison, ablation study, per-pattern detection
- Results — Publication-quality figures and LaTeX tables
- Implementation — Full system architecture with blockchain integration
- H. Farrukh et al., "Blockchain-Based Fraud Detection: A Comparative Study," Electronics, vol. 14, 2025.
- A. K. Singh and R. Kumar, "Credit Card Fraud Detection Using Isolation Forest," SSRN, 2021.
- S. Sharma et al., "Anomaly Detection in Blockchain Using Machine Learning," ResearchGate, 2024.
- R. Patel et al., "Blockchain-Based Fraud Detection Enhanced with AI," IJRASET, 2023.
- Y. Zhang et al., "Blockchain-Based Anti-Money Laundering Using ML," Cryptography, vol. 9, 2024.
This project is for academic and research purposes.