About
## The problem it solves
# 🛡️ GraphSentinel: Problem Solved & Use Cases
Modern decentralized finance and blockchain networks process billions of dollars in daily transactions. While open and permissionless, this transparency exposes financial institutions, crypto exchanges, and Web3 protocols to complex, high-speed financial crimes—most notably **wash trading**, **sybil attacks**, and **structured money laundering**.
---
## 🛑 The Core Problem: Limitations of Legacy Monitoring
1. **Rule-Based Systems Miss Structural Fraud:** Traditional anti-money-laundering (AML) tools rely on static thresholds (e.g., flagging any transaction over $10,000). Modern bad actors bypass these simple rules by splitting funds across hundreds of intermediate wallets using circular patterns (wash trading) or time-lagged transfers.
2. **Single-Transaction Isolation:**
Standard database queries evaluate transactions in isolation. They fail to see the broader **network topology**—such as multi-hop wallet clusters, hidden controlling entities, or recurring liquidity loops.
3. **High Rate of False Positives & Manual Overhead:** Legacy monitoring tools flood compliance teams with thousands of low-risk alerts daily. Human analysts spend hours manually tracing block explorers to confirm whether a suspicious cluster is actually malicious.
4. **Slow Alert-to-Action Response Times:** Detecting an anomaly is useless if taking action takes hours. Delaying account lockouts or transaction holds allows illicit funds to be off-ramped through privacy mixers or decentralized exchanges.
---
## ⚡ How GraphSentinel Fixes It
GraphSentinel bridges advanced **Graph Neural Networks (GNN)**, **Convolutional Neural Networks (CNN)**, and **n8n Agentic AI** into a unified, self-acting compliance pipeline:
- **Topological Intelligence:** Evaluates not just the transaction, but the entire $N$-hop neighborhood structure to catch wash-trading rings and wallet clusters instantly.
- **Multi-Modal Detection:** Combines structural network analysis (GNN) with time-series volume dynamics (CNN) to detect both topological and temporal anomalies simultaneously.
- **Zero-Delay Agentic Orchestration:** Connects prediction models directly to an **n8n AI Layer** that interprets risk levels and executes containment actions in real-time without requiring human manual intervention for routine threats.
---
## 🎯 Practical Use Cases
### 1. Crypto Exchanges (CEXs) & OTC Desks * **Automated Fraud Containment:** Automatically freeze API access or delay withdrawals when a user's deposit is linked to a multi-hop wash trading network or a flagged wallet cluster. * **Reduce Compliance Operations Cost:** Filter out over 80% of benign high-frequency trading noise, allowing compliance officers to focus strictly on `HIGH`-risk alerts.
### 2. NFT Marketplaces & DeFi Protocols * **Wash Trading & Volume Inflation Prevention:** Identify artificial trading volume generated by single entities passing assets between self-controlled wallets to manipulate marketplace rankings or token rewards. * **Sybil & Airdrop Farming Defense:** Scan wallet interaction graphs to detect coordinated clusters designed to exploit liquidity pools or token distributions.
### 3. Web3 Analytics & Blockchain Security Firms * **Automated On-Chain Forensics:** Instantly retrieve direct (1-hop) and indirect (2-hop) cluster addresses associated with suspicious transactions for deeper investigation. * **Real-time Risk Feeds:** Push real-time JSON alert streams directly into Slack, Telegram, Jira, or custom SIEM dashboards via Webhooks.
---
## 🛡️ Key Benefits
| Feature | Legacy AML Tools | GraphSentinel + Agentic AI | | :--- | :--- | :--- | | **Detection Method** | Static rules & flat thresholds | Graph Topology (GNN) + Volume Time-Series (CNN) | | **Fraud Scope** | Single transaction analysis | $N$-hop wallet clusters & ring detection | | **Response Time** | Hours to days (manual review) | Sub-second automated workflow execution | | **Operational Impact** | High false positives, analyst fatigue | Automated triaging & direct integration into n8n |
## Challenges we ran into
### 1. Handling Extreme Class Imbalance in On-Chain Data * **Challenge:** The Elliptic dataset and real-world blockchain data are heavily imbalanced—licit transactions drastically outnumber illicit wash-trading nodes. Initial GNN models overfitted toward predicting the majority class, leading to high accuracy but poor recall on actual fraud networks. * **Solution:** We implemented weighted loss functions (`pos_weight`) in PyTorch Geometric and applied focal loss during GraphSAGE training. We also adjusted the classification threshold dynamically (settling at `0.85`) to optimize precision-recall trade-offs and eliminate false positives on legitimate high-frequency liquidity pools.
---
### 2. Extracting Structural Context (N-Hop Clusters) for the Agent * **Challenge:** Standard GNN node classification models only return a single floating-point probability score (e.g., `0.9425`). An isolated score wasn't enough for our n8n Agent to take context-aware compliance actions, as downstream workflows needed to know *which* wallet clusters were involved in the wash-trading ring. * **Solution:** We engineered a custom post-processing utility using PyTorch Geometric’s edge index tensors. For every flagged node, the script performs a 1-hop and 2-hop neighborhood traversal to extract the associated cluster addresses (`associated_cluster_addresses`) and neighbor metadata, bundling them directly into the JSON payload dispatched to n8n.
---
### 3. Asynchronous Model Ingestion & Schema Alignment in n8n * **Challenge:** Bridging PyTorch model outputs with the n8n Agentic layer presented schema mismatches. Large batch predictions generated nested arrays and raw PyTorch tensor data types (`int64`, `float32`) that caused JSON serialization errors and crashed n8n Webhook nodes. * **Solution:** We built a lightweight wrapper script in Python that explicitly parses PyTorch tensor outputs into native Python primitives (`float`, `int`, `list`). We structured the payload into a clean, deterministic schema containing explicit metadata (`transaction_id`, `gnnScore`, `predicted_class`, `risk_level`, `is_flagged`), ensuring flawless Webhook execution and asynchronous action routing in n8n.
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.









