Netcup Server commited on
Commit ·
846b6be
1
Parent(s): fc49e4d
ops: commit netcup-specific docs, config, and M3 Bayesian reputation on netcup mainline
Browse files- app/catalog/reputation.py: T01 Bayesian version (was modified by running container)
- AGENTS.md, README.md, PORT_MAP.md, RMI_SYSTEM_MAP.md, SECURITY.md, STANDARDS.md: netcup ops docs
- docs/*: RAG, MCP, x402, ADR documentation
- x402-gateway/: gateway submodule reference
- pytest.ini, hf-model-card.md: ops config
This is the netcup production state. Going forward, all git operations happen on netcup.
- backend/AGENTS.md +76 -0
- backend/DARKROOM_ADMIN_V2.md +519 -0
- backend/EMAIL_SETUP.md +160 -0
- backend/PORT_MAP.md +85 -0
- backend/PRICING_ARCHITECTURE.md +186 -0
- backend/RAG_MODERNIZATION.md +161 -0
- backend/RAG_R2_SETUP.md +26 -0
- backend/README.md +308 -0
- backend/RMI_SYSTEM_MAP.md +281 -0
- backend/SECURITY.md +48 -0
- backend/SECURITY_STACK.md +98 -0
- backend/STANDARDS.md +196 -0
- backend/SUPABASE_ARCHITECTURE.md +90 -0
- backend/X402_ARCHITECTURE.md +233 -0
- backend/X_AUDIT_AND_STRATEGY.md +219 -0
- backend/_check_mcp.py +4 -0
- backend/app/api/v1/admin/alerts_webhook.py +215 -0
- backend/app/catalog/reputation.py +137 -77
- backend/app/homepage.py +120 -0
- backend/docs/15-final-improvements.md +124 -0
- backend/docs/ARCHITECTURE.md +219 -0
- backend/docs/FAQ.md +54 -0
- backend/docs/MCP-DIRECTORIES.md +119 -0
- backend/docs/MCP-FAQ.md +263 -0
- backend/docs/MCP-README.md +231 -0
- backend/docs/MCP-USER-GUIDE.md +328 -0
- backend/docs/TOOLS-REFERENCE.md +673 -0
- backend/docs/adr/001-003-core-architecture.md +108 -0
- backend/docs/dex_pool_manipulation.md +80 -0
- backend/docs/x402_API_REFERENCE.md +174 -0
- backend/docs/x402_FAQ.md +139 -0
- backend/hf-model-card.md +159 -0
- backend/pytest.ini +9 -0
- backend/test_news.py +16 -0
- backend/test_trending2.py +31 -0
- backend/tests/unit/test_governance_attack_detector.py +218 -0
- backend/x402-gateway/base +1 -0
- backend/x402-gateway/solana +1 -0
backend/AGENTS.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /root/backend/ — RMI CANONICAL BACKEND
|
| 2 |
+
|
| 3 |
+
## ⚠️ THIS IS THE ONE AND ONLY BACKEND
|
| 4 |
+
|
| 5 |
+
All other copies are dead. If you find code at `/srv/rugmuncher-backend/main.py`,
|
| 6 |
+
`/root/rmi/backend/`, or anywhere else — it's STALE. Work here ONLY.
|
| 7 |
+
|
| 8 |
+
## Architecture
|
| 9 |
+
|
| 10 |
+
```
|
| 11 |
+
/root/backend/
|
| 12 |
+
├── main.py # FastAPI app (5040 lines) — entry point
|
| 13 |
+
├── Dockerfile # Backend container build
|
| 14 |
+
├── Dockerfile.worker # Worker container build
|
| 15 |
+
├── requirements.txt # Python dependencies
|
| 16 |
+
├── .env.example # All required env vars documented
|
| 17 |
+
├── generate_env.py # Auto-generate .env from Hermes config
|
| 18 |
+
├── app/ # All application modules
|
| 19 |
+
│ ├── news_service.py # 15+ source news aggregator
|
| 20 |
+
│ ├── rag_service.py # Redis-based RAG vector store
|
| 21 |
+
│ ├── auth.py # Authentication
|
| 22 |
+
│ ├── payments.py # Payment processing
|
| 23 |
+
│ ├── content_syndicate.py # Multi-platform content publishing
|
| 24 |
+
│ └── ... (80+ modules)
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## How to Use
|
| 28 |
+
|
| 29 |
+
### Backend changes (Python):
|
| 30 |
+
```bash
|
| 31 |
+
# Edit files here. Volume mount means changes are LIVE:
|
| 32 |
+
docker restart rmi-backend
|
| 33 |
+
|
| 34 |
+
# Or for dependency changes, rebuild:
|
| 35 |
+
cd /srv/rugmuncher-backend
|
| 36 |
+
docker compose build backend --no-cache
|
| 37 |
+
docker compose up -d backend
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### Environment setup:
|
| 41 |
+
```bash
|
| 42 |
+
python3 generate_env.py --force
|
| 43 |
+
# Then edit .env to fill in missing values
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
### API documentation:
|
| 47 |
+
- Swagger: http://localhost:8000/docs
|
| 48 |
+
- Health: http://localhost:8000/health
|
| 49 |
+
|
| 50 |
+
## Docker Compose
|
| 51 |
+
|
| 52 |
+
Compose file: `/srv/rugmuncher-backend/docker-compose.yml`
|
| 53 |
+
Context: `context: /root/backend` (builds from here)
|
| 54 |
+
Mount: `/root/backend:/app` (live code, no rebuild needed)
|
| 55 |
+
|
| 56 |
+
All container names use hyphens: `rmi-backend`, `rmi-worker`, `rmi-n8n`, etc.
|
| 57 |
+
|
| 58 |
+
## Development Rules
|
| 59 |
+
|
| 60 |
+
1. **Never edit files outside this directory** for backend work
|
| 61 |
+
2. **Always `python3 generate_env.py`** after adding new env vars
|
| 62 |
+
3. **`.env` never committed** — use `.env.example` as template
|
| 63 |
+
4. **Test with `curl localhost:8000/health`** after changes
|
| 64 |
+
5. **Volume mount = live reload** — just restart the container
|
| 65 |
+
|
| 66 |
+
## Related Systems
|
| 67 |
+
|
| 68 |
+
| System | Location | Container |
|
| 69 |
+
|--------|----------|-----------|
|
| 70 |
+
| n8n workflows | /root/n8n-data/ | rmi-n8n |
|
| 71 |
+
| Orchestrator | /srv/rugmuncher-backend/orchestrator/ | rmi-orchestrator |
|
| 72 |
+
| Telegram bot | /srv/rugmuncher-backend/bots/telegram/ | rmi-telegram-bot |
|
| 73 |
+
| Frontend | /srv/rugmuncher-backend/rmi-frontend/ | Vercel/Cloudflare |
|
| 74 |
+
| Hermes AI | /root/.hermes/ | CLI process |
|
| 75 |
+
| Langfuse | /srv/langfuse/ | Separate compose |
|
| 76 |
+
| Redis | Composed | rmi-redis |
|
backend/DARKROOM_ADMIN_V2.md
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI Darkroom — Complete Backend Documentation
|
| 2 |
+
## RugMunch Intelligence Platform — Admin Backend v2
|
| 3 |
+
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
## Overview
|
| 7 |
+
|
| 8 |
+
The RMI Darkroom is a comprehensive, enterprise-grade admin backend for the RugMunch Intelligence crypto security platform. It provides full control over users, content, wallets, payments, security, analytics, and token deployment across multiple blockchains.
|
| 9 |
+
|
| 10 |
+
**Status:** Production-ready | **Version:** 2.0 | **Date:** May 31, 2026
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## Architecture
|
| 15 |
+
|
| 16 |
+
```
|
| 17 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 18 |
+
│ RMI Darkroom Backend │
|
| 19 |
+
├─────────────────────────────────────────────────────────────┤
|
| 20 |
+
│ Admin SPA (/admin) │ Darkroom UI (/darkroom) │
|
| 21 |
+
│ ├─ Dashboard │ ├─ Token Deployer │
|
| 22 |
+
│ ├─ User Management │ ├─ Airdrop Manager │
|
| 23 |
+
│ ├─ Security Center │ ├─ Multi-chain Launch │
|
| 24 |
+
│ ├─ Wallet Manager │ └─ Custom Snapshots │
|
| 25 |
+
│ ├─ Analytics │ │
|
| 26 |
+
│ ├─ Bulletin Board │ │
|
| 27 |
+
│ ├─ Financial │ │
|
| 28 |
+
│ └─ Configuration │ │
|
| 29 |
+
├─────────────────────────────────────────────────────────────┤
|
| 30 |
+
│ API Layer (757+ endpoints) │
|
| 31 |
+
│ ├─ /api/v1/admin/backend/* — Admin operations │
|
| 32 |
+
│ ├─ /api/v1/wallets/v2/* — Wallet management │
|
| 33 |
+
│ ├─ /api/v1/analytics/* — Real-time analytics │
|
| 34 |
+
│ ├─ /api/v1/admin/bulletin/* — Content management │
|
| 35 |
+
│ ├─ /api/v1/admin/tokens/* — Token deployment │
|
| 36 |
+
│ └─ /api/v1/bulletin/* — Public content │
|
| 37 |
+
├─────────────────────────────────────────────────────────────┤
|
| 38 |
+
│ Core Engines │
|
| 39 |
+
│ ├─ Admin Backend (RBAC, Audit, Sessions) │
|
| 40 |
+
│ ├─ Wallet Manager v2 (25+ chains, HD, Rotation) │
|
| 41 |
+
│ ├─ Security Defense (Bot Detection, WAF, DDoS) │
|
| 42 |
+
│ ├─ Analytics Engine (Real-time, Prometheus, Grafana) │
|
| 43 |
+
│ ├─ Bulletin Board (CMS, Moderation, SEO) │
|
| 44 |
+
│ ├─ Token Deployer (5 chains, Blacklist, Anti-bot) │
|
| 45 |
+
│ └─ Plugin System (Extensible architecture) │
|
| 46 |
+
├─────────────────────────────────────────────────────────────┤
|
| 47 |
+
│ Data Layer │
|
| 48 |
+
│ ├─ Redis — Sessions, rate limits, caching │
|
| 49 |
+
│ ├─ Supabase — Users, audit logs, wallet data │
|
| 50 |
+
│ ├─ File System — Vault, configs, backups │
|
| 51 |
+
│ └─ ClickHouse — Analytics time-series (optional) │
|
| 52 |
+
└─────────────────────────────────────────────────────────────┘
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## Key Features
|
| 58 |
+
|
| 59 |
+
### 1. Role-Based Access Control (RBAC)
|
| 60 |
+
- **5 roles:** superadmin, admin, moderator, viewer, support
|
| 61 |
+
- **Permission matrix** with 30+ granular permissions
|
| 62 |
+
- **IP allowlists** for admin access
|
| 63 |
+
- **Session management** with 8-hour timeout, max 3 concurrent
|
| 64 |
+
- **2FA support** (TOTP-ready)
|
| 65 |
+
|
| 66 |
+
### 2. Wallet Manager v2
|
| 67 |
+
- **25+ chains:** Bitcoin, Ethereum, Solana, TRON, Base, BSC, Polygon, Arbitrum, Optimism, Avalanche, Fantom, Gnosis, Dogecoin, Litecoin, and more
|
| 68 |
+
- **HD Wallets:** BIP39/BIP44/BIP49/BIP84 mnemonic support
|
| 69 |
+
- **Key Rotation:** Scheduled automatic rotation with notifications
|
| 70 |
+
- **Payment Integration:** x402 micropayments, subscription tiers
|
| 71 |
+
- **Balance Monitoring:** Real-time tracking across all chains
|
| 72 |
+
- **AES-256-GCM encryption** with Argon2id key derivation
|
| 73 |
+
- **Multi-signature ready** architecture
|
| 74 |
+
|
| 75 |
+
### 3. Security Defense System
|
| 76 |
+
- **Bot Detection:** Behavioral analysis, fingerprinting, heuristics
|
| 77 |
+
- **Anomaly Detection:** Statistical analysis on request patterns
|
| 78 |
+
- **Honeypot Endpoints:** 10 trap endpoints that auto-ban attackers
|
| 79 |
+
- **DDoS Protection:** Circuit breaker pattern, rate limiting
|
| 80 |
+
- **IP Reputation:** Integration-ready for AbuseIPDB
|
| 81 |
+
- **Geo-blocking:** Country-based access control
|
| 82 |
+
- **Request Fingerprinting:** Canvas, WebGL, font analysis
|
| 83 |
+
|
| 84 |
+
### 4. Analytics Engine
|
| 85 |
+
- **Real-time Metrics:** CPU, memory, requests, errors, latency
|
| 86 |
+
- **4 Default Dashboards:** System Health, Financial, Security, Users
|
| 87 |
+
- **Trend Detection:** Automatic anomaly detection with 3-sigma analysis
|
| 88 |
+
- **Prometheus Export:** Compatible with Prometheus/Grafana stack
|
| 89 |
+
- **WebSocket-ready:** Real-time streaming data
|
| 90 |
+
- **Custom Dashboards:** Configurable widget layouts
|
| 91 |
+
|
| 92 |
+
### 5. Bulletin Board / CMS
|
| 93 |
+
- **Post Management:** CRUD with versioning, scheduling, expiry
|
| 94 |
+
- **Categories:** news, alert, update, promo, system, community, announcement, tutorial
|
| 95 |
+
- **Targeting:** Audience segmentation (free, premium, pro, admins)
|
| 96 |
+
- **Moderation:** Draft/review/published/archived workflow
|
| 97 |
+
- **SEO:** Meta tags, OpenGraph, slug generation
|
| 98 |
+
- **Comments:** Threaded discussions with moderation
|
| 99 |
+
|
| 100 |
+
### 6. Token Deployer (Darkroom)
|
| 101 |
+
- **5 Chains:** Ethereum, Base, BSC, Solana, TRON
|
| 102 |
+
- **Features:** Blacklist, anti-bot, anti-sniper, team allocation, vesting
|
| 103 |
+
- **Airdrop System:** 1:1 exact-match airdrop, multi-chain snapshots
|
| 104 |
+
- **Custom Snapshots:** JSON, CSV, manual upload
|
| 105 |
+
- **Anti-gaming:** Sybil detection, multi-account filtering
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## API Endpoints Summary
|
| 110 |
+
|
| 111 |
+
| Category | Endpoints | Auth |
|
| 112 |
+
|----------|-----------|------|
|
| 113 |
+
| Admin Auth | 5 | Public/Session |
|
| 114 |
+
| Dashboard | 2 | dashboard.read |
|
| 115 |
+
| Users | 5 | users.read/write |
|
| 116 |
+
| Security | 8 | security.read/write |
|
| 117 |
+
| System | 5 | system.read/write |
|
| 118 |
+
| Content | 3 | content.read/write |
|
| 119 |
+
| Financial | 3 | financial.read |
|
| 120 |
+
| API Keys | 3 | api_keys.read/write |
|
| 121 |
+
| Admin Mgmt | 4 | superadmin only |
|
| 122 |
+
| Backups | 2 | superadmin only |
|
| 123 |
+
| Webhooks | 2 | webhooks.read/write |
|
| 124 |
+
| **Wallet Manager v2** | **19** | token_deploy.read/write |
|
| 125 |
+
| **Analytics** | **11** | analytics.read |
|
| 126 |
+
| **Bulletin Board** | **18** | content.read/write |
|
| 127 |
+
| **Token Deployer** | **24** | X-Admin-Key |
|
| 128 |
+
| **Public Bulletin** | **5** | None |
|
| 129 |
+
| **Total** | **757+** | Mixed |
|
| 130 |
+
|
| 131 |
+
---
|
| 132 |
+
|
| 133 |
+
## File Structure
|
| 134 |
+
|
| 135 |
+
```
|
| 136 |
+
/root/backend/
|
| 137 |
+
├── app/
|
| 138 |
+
│ ├── admin_backend.py # Core admin engine (RBAC, audit, sessions)
|
| 139 |
+
│ ├── wallet_manager_v2.py # Wallet management engine
|
| 140 |
+
│ ├── security_defense.py # Bot detection, WAF, DDoS protection
|
| 141 |
+
│ ├── analytics_engine.py # Real-time metrics and dashboards
|
| 142 |
+
│ ├── bulletin_board.py # CMS engine
|
| 143 |
+
│ ├── plugin_system.py # Plugin architecture
|
| 144 |
+
│ ├── token_deployer.py # Multi-chain token deployer
|
| 145 |
+
│ ├── multichain_airdrop.py # Airdrop engine
|
| 146 |
+
│ └── routers/
|
| 147 |
+
│ ├── admin_backend.py # Admin API (36 endpoints)
|
| 148 |
+
│ ├── wallet_manager_v2.py # Wallet API (19 endpoints)
|
| 149 |
+
│ ├── analytics.py # Analytics API (11 endpoints)
|
| 150 |
+
│ ├── bulletin_board.py # Bulletin API (18 endpoints)
|
| 151 |
+
│ ├── darkroom_tokens.py # Token deployer API
|
| 152 |
+
│ ├── darkroom_airdrop.py # Airdrop API
|
| 153 |
+
│ └── darkroom_multichain.py # Multi-chain API
|
| 154 |
+
├── static/
|
| 155 |
+
│ ├── admin.html # Admin SPA (52KB)
|
| 156 |
+
│ └── darkroom.html # Token deployer UI (43KB)
|
| 157 |
+
└── main.py # FastAPI app (757+ routes)
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
## Security Features
|
| 163 |
+
|
| 164 |
+
### Authentication
|
| 165 |
+
- bcrypt password hashing
|
| 166 |
+
- JWT session tokens with expiry
|
| 167 |
+
- Rate limiting on all endpoints
|
| 168 |
+
- IP blocking with auto-ban
|
| 169 |
+
- Failed login tracking (auto-ban after 5 attempts)
|
| 170 |
+
- Session invalidation on logout
|
| 171 |
+
- Concurrent session limits
|
| 172 |
+
|
| 173 |
+
### Authorization
|
| 174 |
+
- Role-based access control
|
| 175 |
+
- Permission matrix per endpoint
|
| 176 |
+
- Admin-only endpoints for sensitive operations
|
| 177 |
+
- Audit logging of all actions
|
| 178 |
+
- Before/after state tracking
|
| 179 |
+
|
| 180 |
+
### Data Protection
|
| 181 |
+
- AES-256-GCM encryption for wallet keys
|
| 182 |
+
- Argon2id key derivation
|
| 183 |
+
- File permissions (chmod 600) on vault files
|
| 184 |
+
- No private keys in memory longer than necessary
|
| 185 |
+
- Secure session storage in Redis
|
| 186 |
+
|
| 187 |
+
### Network Security
|
| 188 |
+
- Bot detection with behavioral analysis
|
| 189 |
+
- Honeypot endpoints (auto-ban on trigger)
|
| 190 |
+
- DDoS circuit breaker
|
| 191 |
+
- Request fingerprinting
|
| 192 |
+
- Anomaly detection on traffic patterns
|
| 193 |
+
- Geo-blocking capability
|
| 194 |
+
|
| 195 |
+
---
|
| 196 |
+
|
| 197 |
+
## Wallet Manager v2
|
| 198 |
+
|
| 199 |
+
### Supported Chains
|
| 200 |
+
|
| 201 |
+
| Chain | Family | Address Pattern | HD Path |
|
| 202 |
+
|-------|--------|----------------|---------|
|
| 203 |
+
| Bitcoin | Bitcoin | 1/3/bc1... | m/44'/0'/0'/0/0 |
|
| 204 |
+
| Bitcoin SegWit | Bitcoin | 3/bc1... | m/49'/0'/0'/0/0 |
|
| 205 |
+
| Bitcoin Native SegWit | Bitcoin | bc1... | m/84'/0'/0'/0/0 |
|
| 206 |
+
| Ethereum | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 207 |
+
| Base | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 208 |
+
| Polygon | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 209 |
+
| Arbitrum | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 210 |
+
| Optimism | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 211 |
+
| Avalanche | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 212 |
+
| BSC | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 213 |
+
| Fantom | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 214 |
+
| Gnosis | EVM | 0x... | m/44'/60'/0'/0/0 |
|
| 215 |
+
| Solana | Solana | Base58 | m/44'/501'/0'/0' |
|
| 216 |
+
| TRON | TRON | T... | m/44'/195'/0'/0/0 |
|
| 217 |
+
| Dogecoin | Secp256k1 | D... | m/44'/3'/0'/0/0 |
|
| 218 |
+
| Litecoin | Secp256k1 | L/M/ltc1... | m/44'/2'/0'/0/0 |
|
| 219 |
+
|
| 220 |
+
### Wallet Tiers
|
| 221 |
+
|
| 222 |
+
| Tier | Use Case | Security |
|
| 223 |
+
|------|----------|----------|
|
| 224 |
+
| hot | Active trading | Standard |
|
| 225 |
+
| warm | Regular operations | Enhanced |
|
| 226 |
+
| cold | Long-term storage | High |
|
| 227 |
+
| vault | Maximum security | Multi-sig ready |
|
| 228 |
+
|
| 229 |
+
### Payment Integration
|
| 230 |
+
|
| 231 |
+
- **x402:** Enable per-wallet with price in USD
|
| 232 |
+
- **Subscriptions:** Tier-based (free, basic, pro, enterprise)
|
| 233 |
+
- **Payment Types:** x402, subscription, one-time, marketplace, refund, withdrawal, deposit, fee, reward
|
| 234 |
+
|
| 235 |
+
---
|
| 236 |
+
|
| 237 |
+
## Analytics Dashboards
|
| 238 |
+
|
| 239 |
+
### System Health Dashboard
|
| 240 |
+
- CPU Usage (gauge + line chart)
|
| 241 |
+
- Memory Usage (gauge + line chart)
|
| 242 |
+
- Disk Usage (gauge)
|
| 243 |
+
- Requests/minute (counter)
|
| 244 |
+
- Response Latency (line chart)
|
| 245 |
+
- Error Rate (line chart)
|
| 246 |
+
|
| 247 |
+
### Financial Dashboard
|
| 248 |
+
- Total Revenue (counter)
|
| 249 |
+
- MRR (counter)
|
| 250 |
+
- ARPU (counter)
|
| 251 |
+
- Churn Rate (gauge)
|
| 252 |
+
- Revenue Trend (line chart)
|
| 253 |
+
- Payment Count (line chart)
|
| 254 |
+
|
| 255 |
+
### Security Dashboard
|
| 256 |
+
- Threats Blocked (counter)
|
| 257 |
+
- Bot Requests (counter)
|
| 258 |
+
- Attacks Detected (counter)
|
| 259 |
+
- Blocked IPs (counter)
|
| 260 |
+
- Threat Types (pie chart)
|
| 261 |
+
- Attack Timeline (line chart)
|
| 262 |
+
|
| 263 |
+
### User Analytics Dashboard
|
| 264 |
+
- DAU (counter)
|
| 265 |
+
- MAU (counter)
|
| 266 |
+
- New Users (counter)
|
| 267 |
+
- Retention Rate (gauge)
|
| 268 |
+
- User Growth (line chart)
|
| 269 |
+
- User Tiers (pie chart)
|
| 270 |
+
|
| 271 |
+
---
|
| 272 |
+
|
| 273 |
+
## Plugin System
|
| 274 |
+
|
| 275 |
+
### Plugin Types
|
| 276 |
+
- **connector** — Data sources (exchanges, APIs, oracles)
|
| 277 |
+
- **scanner** — Security scanners (contract, wallet, token)
|
| 278 |
+
- **analyzer** — Analysis engines (risk, sentiment, on-chain)
|
| 279 |
+
- **notifier** — Alert channels (email, telegram, webhook)
|
| 280 |
+
- **exporter** — Data export (CSV, PDF, API, webhook)
|
| 281 |
+
- **wallet** — Wallet integrations (hardware, custodial)
|
| 282 |
+
- **payment** — Payment processors (x402, stripe, crypto)
|
| 283 |
+
- **ml** — ML models (fraud detection, prediction)
|
| 284 |
+
- **security** — Security tools (WAF, firewall)
|
| 285 |
+
- **analytics** — Analytics integrations (Grafana, Prometheus)
|
| 286 |
+
|
| 287 |
+
### Built-in Plugins
|
| 288 |
+
- PrometheusExporter — Export metrics to Prometheus format
|
| 289 |
+
- WebhookNotifier — Send notifications to webhooks
|
| 290 |
+
- RedisCache — Redis caching and pub/sub connector
|
| 291 |
+
|
| 292 |
+
### Plugin Directory
|
| 293 |
+
```
|
| 294 |
+
/root/backend/plugins/
|
| 295 |
+
├── connector/
|
| 296 |
+
├── scanner/
|
| 297 |
+
├── analyzer/
|
| 298 |
+
├── notifier/
|
| 299 |
+
├── exporter/
|
| 300 |
+
├── wallet/
|
| 301 |
+
├── payment/
|
| 302 |
+
├── ml/
|
| 303 |
+
├── security/
|
| 304 |
+
└── analytics/
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
---
|
| 308 |
+
|
| 309 |
+
## Deployment
|
| 310 |
+
|
| 311 |
+
### Requirements
|
| 312 |
+
- Python 3.10+
|
| 313 |
+
- Redis 6.0+
|
| 314 |
+
- FastAPI + Uvicorn
|
| 315 |
+
- Optional: Supabase, ClickHouse, Prometheus, Grafana
|
| 316 |
+
|
| 317 |
+
### Environment Variables
|
| 318 |
+
```bash
|
| 319 |
+
# Core
|
| 320 |
+
JWT_SECRET=your-jwt-secret
|
| 321 |
+
REDIS_HOST=localhost
|
| 322 |
+
REDIS_PORT=6379
|
| 323 |
+
REDIS_PASSWORD=your-redis-password
|
| 324 |
+
SUPABASE_URL=https://your-project.supabase.co
|
| 325 |
+
SUPABASE_SERVICE_KEY=your-service-key
|
| 326 |
+
|
| 327 |
+
# Wallet Vault
|
| 328 |
+
WALLET_VAULT_PASSWORD=your-vault-password
|
| 329 |
+
|
| 330 |
+
# Admin
|
| 331 |
+
ADMIN_API_KEY=your-admin-key
|
| 332 |
+
|
| 333 |
+
# x402
|
| 334 |
+
X402_EVM_PAY_TO=your-wallet-address
|
| 335 |
+
|
| 336 |
+
# Security
|
| 337 |
+
ABUSEIPDB_API_KEY=your-abuseipdb-key # optional
|
| 338 |
+
```
|
| 339 |
+
|
| 340 |
+
### Startup
|
| 341 |
+
```bash
|
| 342 |
+
cd /root/backend
|
| 343 |
+
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
|
| 344 |
+
```
|
| 345 |
+
|
| 346 |
+
### Health Check
|
| 347 |
+
```bash
|
| 348 |
+
curl http://localhost:8000/health
|
| 349 |
+
```
|
| 350 |
+
|
| 351 |
+
---
|
| 352 |
+
|
| 353 |
+
## Admin Access
|
| 354 |
+
|
| 355 |
+
### Default Admin
|
| 356 |
+
- **Email:** admin@rugmunch.io
|
| 357 |
+
- **Password:** Darkroom2025!
|
| 358 |
+
- **Role:** superadmin
|
| 359 |
+
|
| 360 |
+
### Admin UI
|
| 361 |
+
- **URL:** https://your-domain.com/admin
|
| 362 |
+
- **Login:** Email + Password + optional 2FA
|
| 363 |
+
- **Session:** 8-hour expiry, max 3 concurrent
|
| 364 |
+
|
| 365 |
+
### Darkroom (Token Deployer)
|
| 366 |
+
- **URL:** https://your-domain.com/darkroom
|
| 367 |
+
- **Auth:** X-Admin-Key header
|
| 368 |
+
|
| 369 |
+
---
|
| 370 |
+
|
| 371 |
+
## API Usage Examples
|
| 372 |
+
|
| 373 |
+
### Generate Wallet
|
| 374 |
+
```bash
|
| 375 |
+
curl -X POST https://api.rugmunch.io/api/v1/wallets/v2/generate \
|
| 376 |
+
-H "X-Admin-Session: sess_xxx" \
|
| 377 |
+
-H "Content-Type: application/json" \
|
| 378 |
+
-d '{"chain": "eth", "purpose": "payments", "tier": "hot"}'
|
| 379 |
+
```
|
| 380 |
+
|
| 381 |
+
### Record Payment
|
| 382 |
+
```bash
|
| 383 |
+
curl -X POST https://api.rugmunch.io/api/v1/wallets/v2/payments \
|
| 384 |
+
-H "X-Admin-Session: sess_xxx" \
|
| 385 |
+
-H "Content-Type: application/json" \
|
| 386 |
+
-d '{
|
| 387 |
+
"wallet_id": "wal_eth_123",
|
| 388 |
+
"wallet_address": "0x...",
|
| 389 |
+
"chain": "eth",
|
| 390 |
+
"payment_type": "x402",
|
| 391 |
+
"amount": 0.01,
|
| 392 |
+
"amount_usd": 25.00,
|
| 393 |
+
"user_id": "user_123"
|
| 394 |
+
}'
|
| 395 |
+
```
|
| 396 |
+
|
| 397 |
+
### Get Analytics
|
| 398 |
+
```bash
|
| 399 |
+
curl https://api.rugmunch.io/api/v1/analytics/dashboards/system \
|
| 400 |
+
-H "X-Admin-Session: sess_xxx"
|
| 401 |
+
```
|
| 402 |
+
|
| 403 |
+
### Prometheus Metrics
|
| 404 |
+
```bash
|
| 405 |
+
curl https://api.rugmunch.io/api/v1/analytics/prometheus
|
| 406 |
+
```
|
| 407 |
+
|
| 408 |
+
---
|
| 409 |
+
|
| 410 |
+
## Monitoring & Alerting
|
| 411 |
+
|
| 412 |
+
### Prometheus Metrics
|
| 413 |
+
All system metrics are exportable in Prometheus format at `/api/v1/analytics/prometheus`.
|
| 414 |
+
|
| 415 |
+
### Key Metrics
|
| 416 |
+
- `rmi_cpu_percent` — CPU usage
|
| 417 |
+
- `rmi_memory_percent` — Memory usage
|
| 418 |
+
- `rmi_requests_per_minute` — Request rate
|
| 419 |
+
- `rmi_response_time_ms` — Response latency
|
| 420 |
+
- `rmi_error_rate` — Error percentage
|
| 421 |
+
- `rmi_revenue_usd` — Total revenue
|
| 422 |
+
- `rmi_threats_blocked` — Threats blocked
|
| 423 |
+
- `rmi_active_users` — Active users
|
| 424 |
+
|
| 425 |
+
### Grafana Integration
|
| 426 |
+
Import the Prometheus endpoint into Grafana for visualization.
|
| 427 |
+
|
| 428 |
+
---
|
| 429 |
+
|
| 430 |
+
## Backup & Recovery
|
| 431 |
+
|
| 432 |
+
### Wallet Vault
|
| 433 |
+
- Encrypted JSON file at `/root/.rmi/wallets/vault_v2.json`
|
| 434 |
+
- Keystore at `/root/.rmi/wallets/keystore.enc`
|
| 435 |
+
- Payment log at `/root/.rmi/wallets/payments.jsonl`
|
| 436 |
+
|
| 437 |
+
### Backup Strategy
|
| 438 |
+
1. Daily encrypted backups to secure storage
|
| 439 |
+
2. Seed phrase recovery for HD wallets
|
| 440 |
+
3. Multi-signature backup for vault wallets
|
| 441 |
+
4. Audit log retention: 90 days
|
| 442 |
+
|
| 443 |
+
---
|
| 444 |
+
|
| 445 |
+
## Development
|
| 446 |
+
|
| 447 |
+
### Adding a New Plugin
|
| 448 |
+
```python
|
| 449 |
+
from app.plugin_system import Plugin, PluginType
|
| 450 |
+
|
| 451 |
+
class MyPlugin(Plugin):
|
| 452 |
+
@property
|
| 453 |
+
def name(self): return "my_plugin"
|
| 454 |
+
@property
|
| 455 |
+
def version(self): return "1.0.0"
|
| 456 |
+
@property
|
| 457 |
+
def plugin_type(self): return PluginType.ANALYZER
|
| 458 |
+
@property
|
| 459 |
+
def description(self): return "My custom analyzer"
|
| 460 |
+
|
| 461 |
+
def _setup(self):
|
| 462 |
+
# Initialize your plugin
|
| 463 |
+
pass
|
| 464 |
+
```
|
| 465 |
+
|
| 466 |
+
### Adding a Dashboard Widget
|
| 467 |
+
```python
|
| 468 |
+
from app.analytics_engine import DashboardWidget
|
| 469 |
+
|
| 470 |
+
widget = DashboardWidget(
|
| 471 |
+
widget_id="my_widget",
|
| 472 |
+
widget_type="line",
|
| 473 |
+
title="My Metric",
|
| 474 |
+
metric_name="my_metric",
|
| 475 |
+
width=6,
|
| 476 |
+
height=4,
|
| 477 |
+
)
|
| 478 |
+
engine.add_widget("system", widget)
|
| 479 |
+
```
|
| 480 |
+
|
| 481 |
+
---
|
| 482 |
+
|
| 483 |
+
## Security Checklist
|
| 484 |
+
|
| 485 |
+
- [ ] Change default admin password
|
| 486 |
+
- [ ] Set strong WALLET_VAULT_PASSWORD
|
| 487 |
+
- [ ] Enable Redis AUTH
|
| 488 |
+
- [ ] Configure IP allowlists for admin access
|
| 489 |
+
- [ ] Set up AbuseIPDB API key
|
| 490 |
+
- [ ] Enable 2FA for superadmin accounts
|
| 491 |
+
- [ ] Configure backup schedule
|
| 492 |
+
- [ ] Set up Prometheus/Grafana monitoring
|
| 493 |
+
- [ ] Enable HTTPS only
|
| 494 |
+
- [ ] Review audit logs weekly
|
| 495 |
+
- [ ] Rotate wallet keys quarterly
|
| 496 |
+
- [ ] Test disaster recovery plan
|
| 497 |
+
|
| 498 |
+
---
|
| 499 |
+
|
| 500 |
+
## Support
|
| 501 |
+
|
| 502 |
+
- **Email:** admin@rugmunch.io
|
| 503 |
+
- **Docs:** https://docs.rugmunch.io
|
| 504 |
+
- **API:** https://api.rugmunch.io/docs
|
| 505 |
+
- **Status:** https://status.rugmunch.io
|
| 506 |
+
|
| 507 |
+
---
|
| 508 |
+
|
| 509 |
+
## License
|
| 510 |
+
|
| 511 |
+
Proprietary and confidential. Unauthorized use, distribution, or reproduction is strictly prohibited.
|
| 512 |
+
|
| 513 |
+
Copyright (c) 2026 RugMunch Intelligence. All rights reserved.
|
| 514 |
+
|
| 515 |
+
---
|
| 516 |
+
|
| 517 |
+
**Built with:** FastAPI, Redis, Supabase, Python 3.12, love for crypto security.
|
| 518 |
+
|
| 519 |
+
**The Bloomberg Terminal of Shitcoins.**
|
backend/EMAIL_SETUP.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Email Forwarding Setup Guide
|
| 2 |
+
# =============================
|
| 3 |
+
#
|
| 4 |
+
# This system forwards emails from your domains to a Gmail inbox,
|
| 5 |
+
# then polls that inbox and forwards emails to your Telegram admin bot.
|
| 6 |
+
#
|
| 7 |
+
# NO AUTO-REPLIES - emails appear in Telegram for admin review.
|
| 8 |
+
|
| 9 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 10 |
+
|
| 11 |
+
SETUP STEPS
|
| 12 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 13 |
+
|
| 14 |
+
1. CREATE GMAIL RECEIVER ACCOUNT
|
| 15 |
+
------------------------------
|
| 16 |
+
Create a new Gmail account (or use existing):
|
| 17 |
+
|
| 18 |
+
Example: rugmunch.admin@gmail.com
|
| 19 |
+
|
| 20 |
+
IMPORTANT: Enable 2FA and create an App Password:
|
| 21 |
+
- Go to: https://myaccount.google.com/security
|
| 22 |
+
- Enable 2-Step Verification (if not already)
|
| 23 |
+
- Go to: https://myaccount.google.com/apppasswords
|
| 24 |
+
- Create a new app password (select "Mail" and your device)
|
| 25 |
+
- COPY THE 16-CHARACTER PASSWORD (no spaces)
|
| 26 |
+
|
| 27 |
+
You'll need:
|
| 28 |
+
- Email: rugmunch.admin@gmail.com (or your choice)
|
| 29 |
+
- App Password: XXXX XXXX XXXX XXXX (16 chars)
|
| 30 |
+
|
| 31 |
+
2. CONFIGURE CLOUDFLARE EMAIL ROUTING
|
| 32 |
+
-----------------------------------
|
| 33 |
+
|
| 34 |
+
For rugmunch.io:
|
| 35 |
+
- Log in to Cloudflare dashboard
|
| 36 |
+
- Go to your rugmunch.io zone
|
| 37 |
+
- Click "Email" → "Email Routing"
|
| 38 |
+
- Click "Add Route"
|
| 39 |
+
- Create these addresses (all forward to same Gmail):
|
| 40 |
+
|
| 41 |
+
admin@rugmunch.io → rugmunch.admin@gmail.com
|
| 42 |
+
support@rugmunch.io → rugmunch.admin@gmail.com
|
| 43 |
+
contact@rugmunch.io → rugmunch.admin@gmail.com
|
| 44 |
+
|
| 45 |
+
For cryptorugmunch.com:
|
| 46 |
+
- Go to your cryptorugmunch.com zone
|
| 47 |
+
- Click "Email" → "Email Routing"
|
| 48 |
+
- Click "Add Route"
|
| 49 |
+
- Create these addresses:
|
| 50 |
+
|
| 51 |
+
admin@cryptorugmunch.com → rugmunch.admin@gmail.com
|
| 52 |
+
team@cryptorugmunch.com → rugmunch.admin@gmail.com
|
| 53 |
+
info@cryptorugmunch.com → rugmunch.admin@gmail.com
|
| 54 |
+
|
| 55 |
+
IMPORTANT: Make sure Email Routing is ENABLED (toggle ON)
|
| 56 |
+
|
| 57 |
+
3. CONFIGURE BACKEND ENVIRONMENT VARIABLES
|
| 58 |
+
----------------------------------------
|
| 59 |
+
|
| 60 |
+
Add these to your /root/.secrets/project_envs/rmi-backend.env:
|
| 61 |
+
|
| 62 |
+
# Email Forwarding
|
| 63 |
+
EMAIL_RECEIVER=rugmunch.admin@gmail.com
|
| 64 |
+
EMAIL_PASSWORD=xxxx xxxx xxxx xxxx (app password, no spaces)
|
| 65 |
+
TELEGRAM_ADMIN_CHAT_ID=123456789 (your admin Telegram chat ID)
|
| 66 |
+
EMAIL_POLL_INTERVAL=60 # check every 60 seconds
|
| 67 |
+
|
| 68 |
+
# Get your Telegram Chat ID:
|
| 69 |
+
- Message your bot: @userinfobot
|
| 70 |
+
- Send any message
|
| 71 |
+
- It will reply with your ID (e.g., 123456789)
|
| 72 |
+
|
| 73 |
+
4. START RESTART BACKEND
|
| 74 |
+
----------------------
|
| 75 |
+
Restart your backend service:
|
| 76 |
+
|
| 77 |
+
sudo systemctl restart rmi-backend
|
| 78 |
+
|
| 79 |
+
Or if running manually:
|
| 80 |
+
cd /srv/rmi/backend
|
| 81 |
+
source venv/bin/activate
|
| 82 |
+
python main.py
|
| 83 |
+
|
| 84 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 85 |
+
|
| 86 |
+
VERIFICATION
|
| 87 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 88 |
+
|
| 89 |
+
Check logs for email polling startup:
|
| 90 |
+
sudo journalctl -u rmi-backend -f
|
| 91 |
+
|
| 92 |
+
You should see:
|
| 93 |
+
[RMI] 📧 Email polling enabled - starting IMAP service
|
| 94 |
+
|
| 95 |
+
Send a test email to:
|
| 96 |
+
admin@rugmunch.io
|
| 97 |
+
|
| 98 |
+
Wait 1-2 minutes. You should receive a Telegram message in your admin chat:
|
| 99 |
+
|
| 100 |
+
📧 New Email
|
| 101 |
+
|
| 102 |
+
From: sender@example.com
|
| 103 |
+
Domain: rugmunch.io
|
| 104 |
+
Subject: Test Email
|
| 105 |
+
Time: 2026-05-01 12:34:56
|
| 106 |
+
|
| 107 |
+
━━━━━━━━━━━━━━━━━━━━
|
| 108 |
+
|
| 109 |
+
This is the email body...
|
| 110 |
+
|
| 111 |
+
Inbox: rugmunch.admin@gmail.com
|
| 112 |
+
|
| 113 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 114 |
+
|
| 115 |
+
FAQ
|
| 116 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 117 |
+
|
| 118 |
+
Q: Can users reply to these emails?
|
| 119 |
+
A: Emails can be replied to (standard email), but your system
|
| 120 |
+
won't auto-reply. Admins review in Telegram and respond manually
|
| 121 |
+
via their email client.
|
| 122 |
+
|
| 123 |
+
Q: What happens if Gmail IMAP fails?
|
| 124 |
+
A: The poller logs errors and retries on next interval. Emails
|
| 125 |
+
are marked as read, so they won't be re-sent to Telegram.
|
| 126 |
+
|
| 127 |
+
Q: Can I forward to a different email?
|
| 128 |
+
A: Yes, just change EMAIL_RECEIVER to any Gmail/IMAP-enabled
|
| 129 |
+
address. You'll need an app password for Gmail.
|
| 130 |
+
|
| 131 |
+
Q: How many emails can I receive?
|
| 132 |
+
A: Gmail free accounts: 15GB storage (roughly 10,000+ emails)
|
| 133 |
+
Cloudflare Email Routing: Unlimited forwards
|
| 134 |
+
|
| 135 |
+
Q: Do I need to configure MX records?
|
| 136 |
+
A: NO! Cloudflare Email Routing handles this automatically when
|
| 137 |
+
you enable Email Routing for your zone.
|
| 138 |
+
|
| 139 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 140 |
+
|
| 141 |
+
TROUBLESHOOTING
|
| 142 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 143 |
+
|
| 144 |
+
"IMAP login failed":
|
| 145 |
+
- Check EMAIL_PASSWORD is correct (use app password, not regular password)
|
| 146 |
+
- Ensure IMAP is enabled in Gmail settings
|
| 147 |
+
- Try logging into Gmail IMAP manually: telnet imap.gmail.com 993
|
| 148 |
+
|
| 149 |
+
"No emails appearing in Telegram":
|
| 150 |
+
- Verify Cloudflare Email Routing is ENABLED
|
| 151 |
+
- Check that emails are actually arriving in Gmail inbox
|
| 152 |
+
- Look at backend logs for polling errors
|
| 153 |
+
- Wait up to 2 minutes (poll interval)
|
| 154 |
+
|
| 155 |
+
"Duplicate emails in Telegram":
|
| 156 |
+
- Emails are marked as read after first poll
|
| 157 |
+
- Check Gmail isn't moving emails back to inbox
|
| 158 |
+
- Reset seen_message_ids by restarting backend
|
| 159 |
+
|
| 160 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
backend/PORT_MAP.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Backend Port Map — v3 (Jun 21 2026)
|
| 2 |
+
|
| 3 |
+
> **v3 reality**: The legacy multi-port dev instances (8002/8003/8005/8006/8010)
|
| 4 |
+
> are gone. There is ONE backend on **port 8000** running the new clean
|
| 5 |
+
> `main.py` (243 lines, no `_legacy_main` import). The legacy 8,475-line
|
| 6 |
+
> monolith is preserved on disk at `/root/backend/_legacy_main.py` but is
|
| 7 |
+
> no longer served.
|
| 8 |
+
|
| 9 |
+
## Active Services (host-level listen sockets)
|
| 10 |
+
|
| 11 |
+
| Port | Bind | Service | Status | Purpose |
|
| 12 |
+
|------|------|---------|--------|---------|
|
| 13 |
+
| 8000 | 127.0.0.1 | docker-proxy → rmi-backend | UP (healthy) | FastAPI backend (v3) |
|
| 14 |
+
| 9090 | 127.0.0.1 | docker-proxy → rmi-prometheus | UP | Prometheus scrape + alert eval |
|
| 15 |
+
| 9093 | 127.0.0.1 | docker-proxy (orphan) | STALE | Old alertmanager docker-proxy, no container behind it |
|
| 16 |
+
| 9094 | 0.0.0.0 | docker-proxy (langfuse?) | UP | Langfuse web (alt port) |
|
| 17 |
+
| 9095 | * | prometheus-alertmanager (host binary) | UP | AlertManager → Telegram routing |
|
| 18 |
+
| 2368 | 127.0.0.1 | docker-proxy → rmi-ghost | UP | Ghost CMS |
|
| 19 |
+
| 3000 | 127.0.0.1 | docker-proxy → rmi-grafana | UP | Grafana dashboards |
|
| 20 |
+
| 3002 | 0.0.0.0 | docker-proxy → langfuse-langfuse-web | UP | Langfuse LLM observability |
|
| 21 |
+
| 6379 | 127.0.0.1 | docker-proxy → rmi-redis | UP (auth) | Redis (RMI_PROD_REDIS_2026) |
|
| 22 |
+
| 7474 | 127.0.0.1 | docker-proxy → rmi-neo4j | UP | Neo4j HTTP |
|
| 23 |
+
| 7687 | 127.0.0.1 | docker-proxy → rmi-neo4j | UP | Neo4j Bolt |
|
| 24 |
+
| 8095 | 0.0.0.0 | docker-proxy → opencti | UP | OpenCTI |
|
| 25 |
+
| 8545 | 127.0.0.1 | docker-proxy → rmi-reth | UP | Reth Ethereum RPC (HTTP) |
|
| 26 |
+
| 8546 | 127.0.0.1 | docker-proxy → rmi-reth | UP | Reth Ethereum RPC (WS) |
|
| 27 |
+
| 8880 | 0.0.0.0 | nginx (system) | UP | Frontend SPA / public |
|
| 28 |
+
| 25/143/465/587/993/995 | * | docker-proxy → rmi-mail | UP | Postfix + Dovecot |
|
| 29 |
+
| 4190 | * | docker-proxy → rmi-mail | UP | Dovecot managesieve |
|
| 30 |
+
|
| 31 |
+
## Ports no longer in use
|
| 32 |
+
|
| 33 |
+
- **8002 / 8003 / 8005 / 8006 / 8010** — Legacy dev instances, gone in v3.
|
| 34 |
+
- **9100** — node_exporter (target down, not currently running)
|
| 35 |
+
|
| 36 |
+
## Quick health checks
|
| 37 |
+
|
| 38 |
+
```bash
|
| 39 |
+
# Backend (v3)
|
| 40 |
+
curl http://localhost:8000/health
|
| 41 |
+
# → {"status":"ok","service":"rmi-backend","version":"2026.06.21",
|
| 42 |
+
# "deploy_mode":"new-system (no _legacy_main)"}
|
| 43 |
+
|
| 44 |
+
# Prometheus
|
| 45 |
+
curl http://localhost:9090/-/healthy
|
| 46 |
+
|
| 47 |
+
# AlertManager
|
| 48 |
+
curl http://localhost:9095/-/healthy
|
| 49 |
+
|
| 50 |
+
# v1 API surface (auto-discover)
|
| 51 |
+
curl http://localhost:8000/openapi.json | jq '.paths | keys'
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Backend ↔ Prometheus Network
|
| 55 |
+
|
| 56 |
+
Both run on Docker bridge `rmi_network`:
|
| 57 |
+
- rmi-backend: 172.19.0.3:8000
|
| 58 |
+
- rmi-prometheus: 172.19.0.8:9090
|
| 59 |
+
- gateway (host): 172.19.0.1
|
| 60 |
+
|
| 61 |
+
iptables INPUT chain policy is DROP. Required ACCEPT rules:
|
| 62 |
+
- 8880 (nginx)
|
| 63 |
+
- 11434 (ollama)
|
| 64 |
+
- 9095 (added Jun 21, alertmanager <-> prometheus communication)
|
| 65 |
+
|
| 66 |
+
## Redis access
|
| 67 |
+
|
| 68 |
+
Redis runs in `rmi-redis` container with auth. The v1 backend reads:
|
| 69 |
+
- `REDIS_HOST=rmi-redis`
|
| 70 |
+
- `REDIS_PORT=6379`
|
| 71 |
+
- `REDIS_DB=0`
|
| 72 |
+
- `REDIS_PASSWORD=RMI_PROD_REDIS_2026`
|
| 73 |
+
|
| 74 |
+
The old `redis-server --port 6379` (no auth) recipe is gone — production
|
| 75 |
+
Redis is authenticated. Local development must use the same env vars.
|
| 76 |
+
|
| 77 |
+
## Modern port-discovery (replaces netstat)
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
# What replaces `netstat -tlnp | grep :8000`
|
| 81 |
+
ss -tlnp 'sport = :8000'
|
| 82 |
+
|
| 83 |
+
# Free-port picker
|
| 84 |
+
python3 -c "import socket; s=socket.socket(); s.bind(('', 0)); print(s.getsockname()[1]); s.close()"
|
| 85 |
+
```
|
backend/PRICING_ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
RMI Pricing & Subscription Architecture v2
|
| 3 |
+
=============================================
|
| 4 |
+
|
| 5 |
+
INTELLIGENT SCAN ECONOMY — One Scan, Many Uses
|
| 6 |
+
-------------------------------------------------
|
| 7 |
+
|
| 8 |
+
The key insight: When a user scans a token address, that's ONE data event.
|
| 9 |
+
But it can power DOZENS of downstream analyses without re-fetching.
|
| 10 |
+
|
| 11 |
+
Example: User scans token 0xDEAD...BEEF
|
| 12 |
+
→ 1 API call fetches: price, liquidity, holders, contract bytecode
|
| 13 |
+
→ Powers: risk scan, holder analysis, bubble map, contract audit,
|
| 14 |
+
funding trace, social sentiment, whale tracking, cross-chain check
|
| 15 |
+
→ All from one scan input, shared across the DataBus cache
|
| 16 |
+
|
| 17 |
+
This means we can offer SCAN PACKS where one scan credit
|
| 18 |
+
actually delivers comprehensive intelligence across ALL our tools,
|
| 19 |
+
because the DataBus deduplicates and caches the underlying data.
|
| 20 |
+
|
| 21 |
+
COMPETITIVE ANALYSIS (June 2026)
|
| 22 |
+
---------------------------------
|
| 23 |
+
|
| 24 |
+
| Platform | Free Tier | Pro Tier | Enterprise |
|
| 25 |
+
|-----------------|-----------------------|--------------------|--------------------|
|
| 26 |
+
| GoPlus Security | 150K CU/mo | $199/mo (6M CU) | $799/mo (37.5M CU)|
|
| 27 |
+
| Arkham | Limited views | $99/mo | $999/mo |
|
| 28 |
+
| Nansen | Basic dashboard | $150/mo (Vital) | $1,000/mo (Onchain)|
|
| 29 |
+
| DexScreener | Free basic | — | Custom |
|
| 30 |
+
| Bubblemaps | Free V2 | $29/mo pro | B2B custom |
|
| 31 |
+
| TokenSniffer | Free basic | $99/mo (SnifferPro)| Custom |
|
| 32 |
+
| Honeypot.is | Free basic | — | — |
|
| 33 |
+
| Chainalysis KYT | None | — | $50K+/yr |
|
| 34 |
+
| TRM Labs | None | — | $30K+/yr |
|
| 35 |
+
| De.Fi | Free basic | $19.99/mo | Custom |
|
| 36 |
+
| RugCheck | Free token checks | — | — |
|
| 37 |
+
|
| 38 |
+
KEY INSIGHT: We're the ONLY platform that gives ONE scan = ALL intelligence.
|
| 39 |
+
GoPlus charges per CU. Nansen charges per month for limited chains.
|
| 40 |
+
Arkham gives entity data but no risk scoring. TokenSniffer gives scores only.
|
| 41 |
+
|
| 42 |
+
RMI covers 38 chains, 67 data providers, real-time caching, AND risk scoring
|
| 43 |
+
in a single scan. That's worth a serious premium.
|
| 44 |
+
|
| 45 |
+
PRICING TIERS (v2 — REVISED June 2026)
|
| 46 |
+
---------------------------------------
|
| 47 |
+
|
| 48 |
+
FREE TIER (Anonymous / Fingerprint)
|
| 49 |
+
- 3 basic scans per day (urlcheck, pulse, token_age)
|
| 50 |
+
- 1 market overview per day
|
| 51 |
+
- Limited data per scan (summary only, no deep analysis)
|
| 52 |
+
- No wallet tracking, no real-time alerts
|
| 53 |
+
- Powered-by branding on all outputs
|
| 54 |
+
|
| 55 |
+
SCOUT PACK — $4.99 (25 scan credits)
|
| 56 |
+
- 25 scan credits, each = ONE address scanned
|
| 57 |
+
- Each scan unlocks EVERY tool for that address for 24 hours
|
| 58 |
+
- Includes: risk scan, holder analysis, bubble map, funding trace,
|
| 59 |
+
contract audit, whale tracking, social sentiment, cross-chain
|
| 60 |
+
- Smart money queries: 10 per pack
|
| 61 |
+
- Market overview: unlimited
|
| 62 |
+
- Credits never expire
|
| 63 |
+
- PER-SCAN VALUE: $0.20 per scan (competitive with TokenSniffer's $0.01-0.05
|
| 64 |
+
per basic scan, but we deliver 10-20x more data per scan)
|
| 65 |
+
|
| 66 |
+
HUNTER PACK — $14.99 (150 scan credits)
|
| 67 |
+
- 150 scan credits, same "one scan = full intelligence" model
|
| 68 |
+
- 70% discount vs Scout per scan ($0.10/scan)
|
| 69 |
+
- Includes everything in Scout plus:
|
| 70 |
+
- Arkham entity intelligence (5 queries)
|
| 71 |
+
- Deep SENTINEL forensic scans
|
| 72 |
+
- Nansen smart money labels (10 queries)
|
| 73 |
+
- Prediction market signals (unlimited)
|
| 74 |
+
- Real-time alerts (24h per activation)
|
| 75 |
+
- Portfolio dashboard (3 wallets)
|
| 76 |
+
|
| 77 |
+
WHALE PACK — $49.99 (750 scan credits)
|
| 78 |
+
- 750 scan credits ($0.067/scan — bulk rate)
|
| 79 |
+
- 85% discount vs Scout per scan
|
| 80 |
+
- Includes everything in Hunter plus:
|
| 81 |
+
- Unlimited Arkham entity lookups
|
| 82 |
+
- Unlimited SENTINEL forensic scans
|
| 83 |
+
- Unlimited smart money queries
|
| 84 |
+
- 30-day real-time alerts
|
| 85 |
+
- Portfolio tracking (25 wallets)
|
| 86 |
+
- Priority queue (cache bypass)
|
| 87 |
+
- x402 API access for automation
|
| 88 |
+
|
| 89 |
+
MONTHLY SUBSCRIPTIONS
|
| 90 |
+
─────────────────────
|
| 91 |
+
|
| 92 |
+
SCOUT MONTHLY — $19.99/mo
|
| 93 |
+
- 75 scan credits/month (rolls over 1 month)
|
| 94 |
+
- All Scout Pack features
|
| 95 |
+
- Weekly intelligence digest email
|
| 96 |
+
- Community Discord access
|
| 97 |
+
|
| 98 |
+
HUNTER MONTHLY — $49.99/mo
|
| 99 |
+
- 350 scan credits/month (rolls over 1 month)
|
| 100 |
+
- All Hunter Pack features
|
| 101 |
+
- Daily watchlist alerts
|
| 102 |
+
- Priority support
|
| 103 |
+
|
| 104 |
+
WHALE MONTHLY — $149.99/mo
|
| 105 |
+
- 1,500 scan credits/month (rolls over 1 month)
|
| 106 |
+
- All Whale Pack features
|
| 107 |
+
- Dedicated Telegram alert channel
|
| 108 |
+
- Custom webhooks
|
| 109 |
+
- API access with higher rate limits
|
| 110 |
+
- Account manager
|
| 111 |
+
|
| 112 |
+
ENTERPRISE — $499/mo (or custom)
|
| 113 |
+
- Unlimited scans, all tools, all data
|
| 114 |
+
- Full API access (databus.fetch with admin key)
|
| 115 |
+
- WebSocket real-time streams
|
| 116 |
+
- Custom data pipelines
|
| 117 |
+
- White-label options
|
| 118 |
+
- Dedicated support & SLA
|
| 119 |
+
|
| 120 |
+
COMMUNITY DISCOUNT — 50% OFF for CRM / $cryptorugmunch holders
|
| 121 |
+
- Verify: Check wallet balance > 0 of CRM (Solana) or
|
| 122 |
+
$cryptorugmunch (Base/Zora) at purchase time
|
| 123 |
+
- Applied automatically when wallet connected
|
| 124 |
+
- Works on ALL tiers (packs and subscriptions)
|
| 125 |
+
- CRM Solana: 6pnitzwjumnzsvfyfejf9mijzpc4iuqh1xugfwvdf8wb
|
| 126 |
+
- $cryptorugmunch Base: 0x93c4f6f6f8a14a255e78de0273d6490719d8538e17dfcc9b72907df6a0d72bf204
|
| 127 |
+
|
| 128 |
+
PRICE JUSTIFICATION
|
| 129 |
+
────────────────────
|
| 130 |
+
|
| 131 |
+
Why $4.99 for 25 scans when GoPlus gives 150K calls/mo free?
|
| 132 |
+
- GoPlus gives RAW API calls. Most are useless without interpretation.
|
| 133 |
+
- Our 1 scan = 15-20 underlying API calls, all aggregated and scored.
|
| 134 |
+
- Real value: risk assessment, not raw data. A rug pull warning saves $1K+.
|
| 135 |
+
- Users don't buy API calls; they buy protection.
|
| 136 |
+
|
| 137 |
+
Why $14.99 for 150 scans?
|
| 138 |
+
- Cheaper than Nansen ($150/mo) for a serious trader
|
| 139 |
+
- More comprehensive than Arkham ($99/mo) for security
|
| 140 |
+
- Deep analysis that TokenSniffer can't match
|
| 141 |
+
|
| 142 |
+
Why $49.99 for 750 scans?
|
| 143 |
+
- Active investigators use 20-30 scans/day
|
| 144 |
+
- Cheaper per-scan than any competitor at this volume
|
| 145 |
+
- Priority access means better data freshness
|
| 146 |
+
|
| 147 |
+
Why subscriptions?
|
| 148 |
+
- Recurring revenue for sustainability
|
| 149 |
+
- Lower monthly cost vs. buying packs repeatedly
|
| 150 |
+
- Roll-over credits reduce purchase anxiety
|
| 151 |
+
|
| 152 |
+
WHY NOT CHEAPER?
|
| 153 |
+
- $0.99 for 50 scans devalues the intelligence. Our free tier already
|
| 154 |
+
gives 3 scans/day. The paid product must feel like a significant step up.
|
| 155 |
+
- Crypto security is a serious business. Users spending $500-5K on a rug
|
| 156 |
+
pull want serious tools, not dollar-store pricing.
|
| 157 |
+
- The 50% community discount already gives holders $2.50/25 or $7.50/150
|
| 158 |
+
scans — aggressive discount without cheapening the brand.
|
| 159 |
+
|
| 160 |
+
IMPLEMENTATION
|
| 161 |
+
──────────────
|
| 162 |
+
|
| 163 |
+
Scan credit tracking: Redis key x402:scan_credits:{wallet}
|
| 164 |
+
Community discount: Check wallet balance of CRM/$cryptorugmunch tokens
|
| 165 |
+
Pack purchase: x402 payment (USDC on Base or SOL)
|
| 166 |
+
Credit deduction: On first API call per unique address per 24h window
|
| 167 |
+
Address reuse: Same address within 24h = no additional credit deduction
|
| 168 |
+
|
| 169 |
+
x402 Tool Pricing (per-call, no pack):
|
| 170 |
+
- urlcheck: Free (loss leader)
|
| 171 |
+
- pulse: Free (loss leader)
|
| 172 |
+
- risk_scan: $0.05
|
| 173 |
+
- holder_analysis: $0.08
|
| 174 |
+
- bubble_map: $0.10
|
| 175 |
+
- contract_audit: $0.15
|
| 176 |
+
- funding_trace: $0.08
|
| 177 |
+
- whale_watch: $0.12
|
| 178 |
+
- sentiment: $0.05
|
| 179 |
+
- cross_chain: $0.08
|
| 180 |
+
- arkham_entity: $0.20
|
| 181 |
+
- sentinel_deep: $0.25
|
| 182 |
+
|
| 183 |
+
Pack scanning: 1 credit = all above tools for 1 address for 24h
|
| 184 |
+
→ Per-credit value: $1.00+ of individual tool calls
|
| 185 |
+
→ Effective per-scan price: $0.067-$0.20 depending on pack size
|
| 186 |
+
"""
|
backend/RAG_MODERNIZATION.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI RAG Modernization — 2026 Standards
|
| 2 |
+
# ======================================
|
| 3 |
+
# Design document for upgrading RMI's RAG system to production-grade
|
| 4 |
+
# modern standards. Based on audit of all 40+ endpoints, 4 pipelines,
|
| 5 |
+
# 9 collections, and 3 embedders.
|
| 6 |
+
|
| 7 |
+
## Current State Audit
|
| 8 |
+
|
| 9 |
+
### Collections (crypto_embeddings.py)
|
| 10 |
+
wallet_profiles, token_analysis, scam_patterns, forensic_reports,
|
| 11 |
+
market_intel, contract_audits, known_scams, news_articles,
|
| 12 |
+
transaction_patterns
|
| 13 |
+
|
| 14 |
+
### Embedders (INCONSISTENT — 3 different models)
|
| 15 |
+
- nomic-embed-text (768d) — rag_engine.py, smart_ai_engine.py
|
| 16 |
+
- bge-m3 (1024d) — rag_ingestion.py, rag_supreme.py
|
| 17 |
+
- bge-small-en-v1.5 (384d) — crypto_embeddings.py (primary)
|
| 18 |
+
|
| 19 |
+
### Pipelines (4 separate, overlapping)
|
| 20 |
+
- rag_engine.py — Qdrant REST API, nomic-embed-text, 5 collections
|
| 21 |
+
- rag_service.py — FAISS ANN, bge-small, 9 collections, 3-pillar search
|
| 22 |
+
- rag_supreme.py — 15-win pipeline, bge-m3, 5 Qdrant collections
|
| 23 |
+
- rag_firehose.py — continuous ingestion engine (designed, not fully wired)
|
| 24 |
+
|
| 25 |
+
### Gaps Identified
|
| 26 |
+
1. NO historical scam ingestion (Rekt DB, Chainabuse, DeFi hacks)
|
| 27 |
+
2. NO structured chunking — raw text embedding, no overlap
|
| 28 |
+
3. NO evaluation running (RAGAS mentioned, not active)
|
| 29 |
+
4. Embedding model inconsistency across pipelines
|
| 30 |
+
5. Firehose sources not wired (cadences defined, fetchers missing)
|
| 31 |
+
6. NO query transformation in production path
|
| 32 |
+
7. NO feedback loop active
|
| 33 |
+
8. Redis SCARD bug (FIXED 2026-06-17)
|
| 34 |
+
9. FAISS disk indexes exist but Redis backing data evicted for 7/9 collections
|
| 35 |
+
|
| 36 |
+
## Modern Standards (2025-2026 Industry Consensus)
|
| 37 |
+
|
| 38 |
+
### 1. Chunking Strategy
|
| 39 |
+
- DEFAULT: Recursive character splitting, 512 tokens, 15% overlap
|
| 40 |
+
- For code: add class/function boundary separators
|
| 41 |
+
- For news: sentence-based chunking preserves coherence
|
| 42 |
+
- For scam reports: semantic chunking on topic boundaries
|
| 43 |
+
- Overlap: 10-20% (test for your domain — some studies show no benefit)
|
| 44 |
+
|
| 45 |
+
### 2. Embedding Models
|
| 46 |
+
- STANDARDIZE on bge-m3 (1024d) — best open-source, multilingual
|
| 47 |
+
- Fallback: bge-small-en-v1.5 (384d) for fast/local
|
| 48 |
+
- Multi-head: different dims for different content types
|
| 49 |
+
- Contract code: 128d structural features (already in crypto_embeddings.py)
|
| 50 |
+
- Scam patterns: 384d behavioral embedding
|
| 51 |
+
- News/articles: 1024d semantic (bge-m3)
|
| 52 |
+
- Wallet profiles: 64d behavioral fingerprint
|
| 53 |
+
|
| 54 |
+
### 3. Retrieval Architecture
|
| 55 |
+
- HYBRID: Dense (70%) + BM25/Sparse (30%) — 5-15% recall improvement
|
| 56 |
+
- RRF fusion (Reciprocal Rank Fusion) — proven best for hybrid
|
| 57 |
+
- Cross-encoder rerank: top-20 → rerank → top-5
|
| 58 |
+
- MMR dedup: remove near-duplicate results
|
| 59 |
+
- Query expansion: generate 3 variants, fuse results
|
| 60 |
+
|
| 61 |
+
### 4. Ingestion Pipeline (UNIFIED)
|
| 62 |
+
- SINGLE entry point: POST /api/v1/rag/ingest
|
| 63 |
+
- Pipeline: Parse → Chunk → Dedup → Classify → Embed → Store → Index
|
| 64 |
+
- Dedup: content hash in Redis (MD5 of normalized text)
|
| 65 |
+
- Quality filter: skip docs below quality threshold
|
| 66 |
+
- Rate limiting: per-collection docs/minute
|
| 67 |
+
- Batch embedding: groups of 25-50, async
|
| 68 |
+
|
| 69 |
+
### 5. Historical Data Sources (NEW)
|
| 70 |
+
- Rekt DB (de.fi/rekt-database) — 3,000+ DeFi hacks since 2020
|
| 71 |
+
- Chainabuse — scam reports with addresses
|
| 72 |
+
- TRM Labs Crypto Crime Report — annual typologies
|
| 73 |
+
- Elliptic State of Crypto Scams — annual report
|
| 74 |
+
- Chainalysis Crypto Crime Report — annual trends
|
| 75 |
+
- SlowMist Hacked Archive — detailed exploit analysis
|
| 76 |
+
- Immunefi Bug Bounty Reports — vulnerability patterns
|
| 77 |
+
- CertiK Audit Findings — smart contract vulnerabilities
|
| 78 |
+
- Solana Compromised Accounts — known drained wallets
|
| 79 |
+
- Etherscan Labels — 115K+ labeled addresses (already have)
|
| 80 |
+
|
| 81 |
+
### 6. Evaluation Framework
|
| 82 |
+
- RAGAS metrics: faithfulness, answer_relevancy, context_precision, context_recall
|
| 83 |
+
- Golden test set: 50 known scam queries with expected answers
|
| 84 |
+
- Run weekly, alert on regression
|
| 85 |
+
- Track: Hit@5, MRR, NDCG@10
|
| 86 |
+
|
| 87 |
+
### 7. Feedback Loop
|
| 88 |
+
- Scanner hits → boost source weight
|
| 89 |
+
- False positives → penalize
|
| 90 |
+
- User corrections → update embeddings
|
| 91 |
+
- Track helpful docs, boost in future searches
|
| 92 |
+
|
| 93 |
+
## Implementation Plan
|
| 94 |
+
|
| 95 |
+
### Phase 1: Standardize & Consolidate (NOW)
|
| 96 |
+
1. Standardize embedder: bge-m3 (1024d) primary, bge-small (384d) fallback
|
| 97 |
+
2. Add recursive chunking to ingest pipeline
|
| 98 |
+
3. Wire firehose sources (Rekt DB, Chainabuse, Etherscan labels)
|
| 99 |
+
4. Add content hash dedup to all ingestion paths
|
| 100 |
+
|
| 101 |
+
### Phase 2: Historical Data Ingestion (THIS WEEK)
|
| 102 |
+
5. Build Rekt DB scraper → forensic_reports collection
|
| 103 |
+
6. Build Chainabuse scraper → known_scams collection
|
| 104 |
+
7. Ingest TRM/Elliptic/Chainalysis annual reports → market_intel
|
| 105 |
+
8. Ingest SlowMist/Immunefi/CertiK findings → contract_audits
|
| 106 |
+
|
| 107 |
+
### Phase 3: Evaluation & Feedback (NEXT WEEK)
|
| 108 |
+
9. Activate RAGAS evaluation pipeline
|
| 109 |
+
10. Build golden test set (50 queries)
|
| 110 |
+
11. Wire feedback loop (scanner hits → boost)
|
| 111 |
+
12. Add query transformation (HyDE, expansion)
|
| 112 |
+
|
| 113 |
+
### Phase 4: Advanced Retrieval (ONGOING)
|
| 114 |
+
13. Cross-encoder reranking (bge-reranker-v2-m3)
|
| 115 |
+
14. Parent-child retrieval for long documents
|
| 116 |
+
15. Multi-modal: code + text + transaction patterns
|
| 117 |
+
16. Streaming response for agentic investigation
|
| 118 |
+
|
| 119 |
+
## New Unified Ingestion Pipeline
|
| 120 |
+
|
| 121 |
+
```
|
| 122 |
+
POST /api/v1/rag/ingest
|
| 123 |
+
{
|
| 124 |
+
"documents": [...],
|
| 125 |
+
"collection": "known_scams",
|
| 126 |
+
"source": "rekt_db",
|
| 127 |
+
"chunking": "recursive" // or "semantic", "sentence", "none"
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
Pipeline:
|
| 131 |
+
1. PARSE — extract text, metadata, entities
|
| 132 |
+
2. CHUNK — recursive split (512 tokens, 15% overlap)
|
| 133 |
+
3. DEDUP — MD5 hash check against Redis
|
| 134 |
+
4. QUALITY — score content, skip if < threshold
|
| 135 |
+
5. CLASSIFY — route to correct collection
|
| 136 |
+
6. EMBED — batch embed via bge-m3 (Ollama)
|
| 137 |
+
7. STORE — Redis (hot) + FAISS (index) + R2 (cold)
|
| 138 |
+
8. INDEX — update ANN index version
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
## New Collections to Add
|
| 142 |
+
|
| 143 |
+
| Collection | Source | Dims | Purpose |
|
| 144 |
+
|-----------|--------|------|---------|
|
| 145 |
+
| defi_hacks | Rekt DB, SlowMist | 1024d | Historical DeFi exploits |
|
| 146 |
+
| rug_timeline | Chainabuse, SENTINEL | 1024d | Rug pull chronology |
|
| 147 |
+
| vuln_patterns | Immunefi, CertiK | 1024d | Smart contract vulnerabilities |
|
| 148 |
+
| crime_reports | TRM, Elliptic, Chainalysis | 1024d | Annual crime typologies |
|
| 149 |
+
| compromised_wallets | Solana, Etherscan | 384d | Known drained addresses |
|
| 150 |
+
| exploit_techniques | All sources | 1024d | How hacks were executed |
|
| 151 |
+
|
| 152 |
+
## Success Metrics
|
| 153 |
+
|
| 154 |
+
- RAG total_docs: 2,473 → 50,000+ (20x)
|
| 155 |
+
- Collections with data: 2/9 → 9/9 + 6 new
|
| 156 |
+
- Embedding consistency: 3 models → 1 primary + 1 fallback
|
| 157 |
+
- Ingestion cadence: ad-hoc → continuous (firehose)
|
| 158 |
+
- Evaluation: none → weekly RAGAS
|
| 159 |
+
- Chunking: none → recursive 512-token
|
| 160 |
+
- Dedup: none → content hash
|
| 161 |
+
- Cold storage: partial → full R2 permanence
|
backend/RAG_R2_SETUP.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RAG R2 Storage — Setup Required
|
| 2 |
+
|
| 3 |
+
## One-time Cloudflare setup:
|
| 4 |
+
|
| 5 |
+
1. Create R2 bucket "rmi-rag-storage" in Cloudflare dashboard
|
| 6 |
+
2. Generate R2 API token with Object Read & Write permissions
|
| 7 |
+
3. Set environment variables:
|
| 8 |
+
- R2_ACCESS_KEY (the Access Key ID from R2 token)
|
| 9 |
+
- R2_SECRET_KEY (the Secret Access Key from R2 token)
|
| 10 |
+
|
| 11 |
+
## Architecture (already deployed):
|
| 12 |
+
|
| 13 |
+
Hot → Redis (in-memory, fast queries, always available)
|
| 14 |
+
Warm → Local /data/rag-storage (7-day cache, auto-cleaned)
|
| 15 |
+
Cold → Cloudflare R2 (permanent, 10GB free, zero egress)
|
| 16 |
+
|
| 17 |
+
## Endpoints (all working, all bypass write middleware):
|
| 18 |
+
|
| 19 |
+
POST /api/v1/rag/permanence/snapshot → Save all collections to R2
|
| 20 |
+
POST /api/v1/rag/permanence/restore → Pull latest from R2 into Redis
|
| 21 |
+
POST /api/v1/rag/permanence/nightly → Full cycle: snapshot→R2, clean local, rebuild ANN
|
| 22 |
+
GET /api/v1/rag/permanence/stats → R2 usage + local cache stats
|
| 23 |
+
|
| 24 |
+
## Cron (active):
|
| 25 |
+
|
| 26 |
+
cd0f23b963f2 — runs nightly at 3 AM UTC — full RAG persistence cycle
|
backend/README.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rug Munch Intelligence — Platform Documentation
|
| 2 |
+
|
| 3 |
+
## The Bloomberg Terminal of Shitcoins
|
| 4 |
+
|
| 5 |
+
Rug Munch Intelligence (RMI) is a unified crypto intelligence platform providing **270+ tools** for token security, wallet forensics, whale tracking, market data, and blockchain queries. Every data call routes through our **DataBus pipeline** — 38 data chains, 67 providers, automatic failover, multi-layer caching.
|
| 6 |
+
|
| 7 |
+
**Access:** `https://mcp.rugmunch.io` | **Docs:** `https://rugmunch.io/docs` | **Operations:** `@rmialerts` (Telegram)
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## v3 Architecture (Jun 21 2026)
|
| 12 |
+
|
| 13 |
+
The backend was rebuilt via **strangler-fig pattern** during Jun 21 crisis ops.
|
| 14 |
+
The legacy 8,475-line `_legacy_main.py` is preserved but **no longer imported**.
|
| 15 |
+
The new clean `main.py` (243 lines) mounts v1 routers exclusively.
|
| 16 |
+
|
| 17 |
+
**Frozen files** (do not edit without explicit un-freeze):
|
| 18 |
+
- `main.py`, `_legacy_main.py`, `app/core/redis.py`, `app/core/config.py`,
|
| 19 |
+
`app/databus/core.py`, `app/rag/pipeline.py`, `app/crypto_embeddings.py`,
|
| 20 |
+
`app/api/v1/__init__.py`, `docker-compose.yml`, `app/core/tracing.py`,
|
| 21 |
+
`app/agents/loop.py`, `app/mcp/server.py`, `app/core/metrics.py`,
|
| 22 |
+
`app/middleware/cost_tracking.py`
|
| 23 |
+
|
| 24 |
+
**AI-Forward Modules (M1-M8)** — 8 mandated modules shipping through Jun:
|
| 25 |
+
- M1 Risk Explainer · M2 News Classifier · M3 Sentiment Stream
|
| 26 |
+
- M4 On-chain Detective · M5 Threat Modeler · M6 Cost Optimizer
|
| 27 |
+
- M7 SLO + Error Budgets · M8 Self-Healing Loops
|
| 28 |
+
|
| 29 |
+
**Telegram channel surface** (rugmunchbot has admin on all):
|
| 30 |
+
- @cryptorugmuncher (main) · @rmicryptonews (news)
|
| 31 |
+
- @rmiupdates (changelog) · @rmialerts (operations — wired to AlertManager)
|
| 32 |
+
- @rmialpha (intel) · @rmiscans (scan feed)
|
| 33 |
+
|
| 34 |
+
**Observability stack:**
|
| 35 |
+
- Prometheus on 172.19.0.8:9090, scrapes rmi-backend at 172.19.0.3:8000
|
| 36 |
+
- 11 alert rules across `rmi-backend-critical`, `rmi-infra-warning`, `rmi-slo-burn`
|
| 37 |
+
- AlertManager on host:9095, routes to @rmialerts via rugmunchbot
|
| 38 |
+
- `/api/v1/admin/alerts/{webhook,critical,recent}` — in-app alert history
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## Quick Start
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
# Discover the platform
|
| 46 |
+
curl https://mcp.rugmunch.io/.well-known/mcp
|
| 47 |
+
|
| 48 |
+
# List all tools
|
| 49 |
+
curl https://mcp.rugmunch.io/mcp/tools
|
| 50 |
+
|
| 51 |
+
# Check platform health
|
| 52 |
+
curl https://mcp.rugmunch.io/mcp/health
|
| 53 |
+
|
| 54 |
+
# Get SDK examples
|
| 55 |
+
curl https://mcp.rugmunch.io/mcp/sdk
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
**MCP Native (Claude Desktop, Cursor, Windsurf):**
|
| 59 |
+
```json
|
| 60 |
+
{
|
| 61 |
+
"mcpServers": {
|
| 62 |
+
"rug-munch": {
|
| 63 |
+
"url": "https://mcp.rugmunch.io/mcp",
|
| 64 |
+
"transport": "streamable-http"
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Platform Capabilities
|
| 73 |
+
|
| 74 |
+
### Tool Categories (234+ total, growing — check `/mcp/status` for live count)
|
| 75 |
+
|
| 76 |
+
| Category | Count | Description |
|
| 77 |
+
|----------|-------|-------------|
|
| 78 |
+
| Security Scanning | 45 | Rug pulls, honeypots, audits, clone detection, MEV protection |
|
| 79 |
+
| Wallet Intelligence | 38 | PnL, clustering, insider networks, whale tracking, forensics |
|
| 80 |
+
| Market Data | 32 | Prices, liquidity, volume, arbitrage, trends, OHLCV |
|
| 81 |
+
| Token Analytics | 28 | Holder distribution, sniper detection, deployer history |
|
| 82 |
+
| DeFi Analytics | 24 | TVL, yields, protocol risk, liquidity flow, bridges |
|
| 83 |
+
| Social Signals | 18 | Sentiment, KOL tracking, profile flips, meme scoring |
|
| 84 |
+
| Caching Shield | 13 | Internal multi-provider data access layer |
|
| 85 |
+
| Local MCP | 85 | Self-hosted Solana RPC (60) + EVM (25 tools, 86 networks) |
|
| 86 |
+
| Free Public MCP | 50 | Boar blockchain (ETH, ENS, contracts, keyless) |
|
| 87 |
+
|
| 88 |
+
### Supported Chains (96+ via DataBus, 13 native + 86 EVM via local MCP)
|
| 89 |
+
|
| 90 |
+
DataBus is the single source of truth: 96 chains, 119 providers, automatic failover.
|
| 91 |
+
See `app/databus/core.py` and `app/api/v1/public/databus/` for the live surface.
|
| 92 |
+
|
| 93 |
+
### Payment Facilitators (8 — plus x402 MCP marketplace gateway)
|
| 94 |
+
|
| 95 |
+
Coinbase CDP, EIP-7702 Universal EVM, Cloudflare x402, PayAI, Asterpay (SEPA),
|
| 96 |
+
TRON Self-Verify, Bitcoin Self-Verify, PrimeV. The x402 MCP marketplace gateway
|
| 97 |
+
(`x402-mcp-gateway` skill) handles tool-level micropayments in USDC on Base.
|
| 98 |
+
|
| 99 |
+
---
|
| 100 |
+
|
| 101 |
+
## Pricing & Access
|
| 102 |
+
|
| 103 |
+
### Free Trials
|
| 104 |
+
Every paid tool includes 1-5 free trial calls. No payment required until trials exhausted. Fingerprint-gated anti-abuse. Monthly reset.
|
| 105 |
+
|
| 106 |
+
### Individual Tools
|
| 107 |
+
$0.01 - $0.40 per call. Pay only for what you use. Full automatic refund within 48 hours if tool returns no data.
|
| 108 |
+
|
| 109 |
+
### Scan Packs (50-53% off)
|
| 110 |
+
| Pack | Tools | Price |
|
| 111 |
+
|------|-------|-------|
|
| 112 |
+
| Token Hunter Pack | Fresh pairs, snipers, security, deployer, clone detection | $0.09 |
|
| 113 |
+
| Whale Watcher Suite | Whale scan, accumulation, smart money, syndicates, PnL | $0.14 |
|
| 114 |
+
| Wallet Forensics | Funding trace, insider network, wash trading, wallet graph | $0.17 |
|
| 115 |
+
| Market Pulse | Prices, liquidity, arbitrage, sentiment, listings | $0.12 |
|
| 116 |
+
|
| 117 |
+
### Membership Tiers (60-90% discount)
|
| 118 |
+
| Tier | Price/mo | Daily Calls | Best For |
|
| 119 |
+
|------|----------|-------------|----------|
|
| 120 |
+
| Scout | $4.99 | 50 | Casual traders, hobby agents |
|
| 121 |
+
| Hunter | $14.99 | 200 | Active traders, alpha groups |
|
| 122 |
+
| Whale | $49.99 | 1,000 | Professional funds, market makers |
|
| 123 |
+
| Institution | $199.99 | 5,000 | Enterprises, high-frequency agents |
|
| 124 |
+
|
| 125 |
+
### Streaming Feeds
|
| 126 |
+
Real-time data via WebSocket + webhook delivery:
|
| 127 |
+
- New Token Firehose ($0.50/hr) — Every new token across all chains
|
| 128 |
+
- Whale Alert Stream ($0.75/hr) — Large transfers, positions, accumulation
|
| 129 |
+
- Multi-Chain Price Feed ($0.30/hr) — OHLCV, volume, arbitrage
|
| 130 |
+
- Security Alert Feed ($0.60/hr) — Rug pulls, exploits, suspicious activity
|
| 131 |
+
|
| 132 |
+
### Deep Research Reports
|
| 133 |
+
- Token Deep Dive ($0.75) — Full contract audit + deployer + holders + sentiment
|
| 134 |
+
- Wallet Intelligence Profile ($0.50) — PnL, style, associations, risk
|
| 135 |
+
- Chain Health Report ($0.25) — Gas, congestion, MEV, TVL, governance
|
| 136 |
+
- Cross-Chain Fund Trace ($1.50) — Follow money through bridges and mixers
|
| 137 |
+
|
| 138 |
+
### Batch Processing (75-90% off)
|
| 139 |
+
- Batch Token Scanner — 100 tokens, $0.05 per 10
|
| 140 |
+
- Batch Wallet Analysis — 50 wallets, $0.03 per 10
|
| 141 |
+
- Batch Pre-Buy Screen — 200 tokens, $0.02 per 50
|
| 142 |
+
|
| 143 |
+
### AI Data Feeds
|
| 144 |
+
- Market Context Feed ($9.99/mo) — LLM-optimized market summaries
|
| 145 |
+
- Alpha Signal Feed ($19.99/mo) — Scored trading signals
|
| 146 |
+
- Entity Relationship Graph ($14.99/mo) — Pre-computed wallet clusters
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## Agent Skills (18 Workflows)
|
| 151 |
+
|
| 152 |
+
Every agent gets 18 guided workflows teaching best practices:
|
| 153 |
+
|
| 154 |
+
**Security & Vetting:** Pre-Buy Token Vetting, Scam Investigation, Post-Rug Forensics, Compliance Screening
|
| 155 |
+
|
| 156 |
+
**Trading & Execution:** Launch Day Playbook, MEV/Sandwich Avoidance, Market Making Intelligence, Portfolio Defense
|
| 157 |
+
|
| 158 |
+
**Alpha Discovery:** Alpha Discovery Pipeline, Whale Movement Tracking, CEX Listing Prediction, Insider Trading Detection
|
| 159 |
+
|
| 160 |
+
**DeFi & Yield:** Yield Farming Optimizer, Cross-Chain Bridge Monitor, DAO Governance Intelligence
|
| 161 |
+
|
| 162 |
+
**NFTs & Influencers:** NFT Mint Sniper, KOL Performance Tracker, Airdrop Hunting
|
| 163 |
+
|
| 164 |
+
Access at `GET /mcp/skills` — includes anti-abuse rules and 4 ready-to-use agent prompts.
|
| 165 |
+
|
| 166 |
+
---
|
| 167 |
+
|
| 168 |
+
## Technical Architecture
|
| 169 |
+
|
| 170 |
+
### Caching Shield
|
| 171 |
+
Every data call passes through three layers:
|
| 172 |
+
1. **L1 Memory Cache** — Sub-millisecond TTL lookup (8s-1hr depending on data type)
|
| 173 |
+
2. **Rate Limiter** — Token bucket per provider (prevents burning free tier quotas)
|
| 174 |
+
3. **Provider Chain** — Ordered fallback (3-4 providers per data type)
|
| 175 |
+
|
| 176 |
+
### Provider Fallback Chains
|
| 177 |
+
| Data Type | Primary | Fallback 1 | Fallback 2 | Fallback 3 |
|
| 178 |
+
|-----------|---------|------------|------------|------------|
|
| 179 |
+
| Token Price | Jupiter | Solana Tracker | DexScreener | Binance |
|
| 180 |
+
| Token Metadata | Helius DAS | Solana Tracker | Jupiter | DexScreener |
|
| 181 |
+
| Wallet Balance | Helius | QuickNode | Alchemy | PublicNode |
|
| 182 |
+
| Risk Scan | GoPlus | RugCheck | Honeypot | Local Labels |
|
| 183 |
+
| EVM Funding | Blockscout | Etherscan | Public RPC | Boar MCP |
|
| 184 |
+
|
| 185 |
+
### Infrastructure
|
| 186 |
+
- **Server:** Bare metal VPS, Docker Compose (30 containers)
|
| 187 |
+
- **Secrets:** GPG-encrypted vault (76 secrets), age-encrypted runtime injection
|
| 188 |
+
- **CI/CD:** GitHub Actions auto-deploy on push to main
|
| 189 |
+
- **Edge:** Cloudflare Workers for x402 payment gateway
|
| 190 |
+
- **Observability:** Langfuse cloud with smart sampling (20% normal, 100% errors)
|
| 191 |
+
|
| 192 |
+
### Local MCP Servers
|
| 193 |
+
Two self-hosted MCP servers run on our infrastructure:
|
| 194 |
+
- **Solana SVM MCP** (Rust, 32MB binary) — 60 RPC tools, WebSocket subscriptions, built-in x402
|
| 195 |
+
- **EVM MCP** (TypeScript, bun runtime) — 25 tools across 86 networks, ENS, contracts, gas
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
## API Reference
|
| 200 |
+
|
| 201 |
+
### MCP Protocol (Streamable HTTP)
|
| 202 |
+
```
|
| 203 |
+
POST /mcp JSON-RPC endpoint
|
| 204 |
+
GET /mcp/tools Tool catalog with input schemas
|
| 205 |
+
GET /mcp/call/{tool_id} Direct tool execution
|
| 206 |
+
GET /.well-known/mcp Server discovery
|
| 207 |
+
GET /.well-known/x402 Payment protocol discovery
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
### Platform Endpoints
|
| 211 |
+
```
|
| 212 |
+
GET /mcp/health Uptime + response time
|
| 213 |
+
GET /mcp/status Cache stats, provider health
|
| 214 |
+
GET /mcp/manifest Auto-updating platform manifest
|
| 215 |
+
GET /mcp/skills 18 agent workflow guides
|
| 216 |
+
GET /mcp/membership Plans, pricing, scan packs
|
| 217 |
+
GET /mcp/sdk Python/TS/curl quick-start
|
| 218 |
+
GET /mcp/changelog Version history
|
| 219 |
+
GET /mcp/trials Free trial status
|
| 220 |
+
GET /mcp/earnings Revenue dashboard
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
### REST API
|
| 224 |
+
```
|
| 225 |
+
POST /api/v1/investigate/trace Wallet funding source tracing
|
| 226 |
+
POST /api/v1/investigate/scan Full investigation
|
| 227 |
+
GET /api/v1/investigate/chains Supported chains
|
| 228 |
+
GET /api/v1/cache/health Caching shield status
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
### Dashboard Pages
|
| 232 |
+
```
|
| 233 |
+
/earnings Revenue dashboard (auto-refreshing)
|
| 234 |
+
/investigate Wallet investigation tool
|
| 235 |
+
```
|
| 236 |
+
|
| 237 |
+
---
|
| 238 |
+
|
| 239 |
+
## SDKs & Integration
|
| 240 |
+
|
| 241 |
+
**Python:** `pip install rmi-agent-sdk`
|
| 242 |
+
```python
|
| 243 |
+
from rmi_agent import RMIAgent
|
| 244 |
+
agent = RMIAgent() # auto-discovers via /.well-known/mcp
|
| 245 |
+
result = agent.call("rug_pull_predictor", {"token": "So111..."})
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
**TypeScript:** `npm install @rugmunch/agent-sdk`
|
| 249 |
+
```typescript
|
| 250 |
+
import { RMIAgent } from "@rugmunch/agent-sdk";
|
| 251 |
+
const agent = new RMIAgent();
|
| 252 |
+
const result = await agent.call("rug_pull_predictor", { token: "So111..." });
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
---
|
| 256 |
+
|
| 257 |
+
## Directory Listings
|
| 258 |
+
|
| 259 |
+
- **Smithery:** `https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence`
|
| 260 |
+
- **Glama:** `https://glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence`
|
| 261 |
+
- **mcp.so:** `https://mcp.so/server/rug-munch-intelligence`
|
| 262 |
+
- **GitHub:** `https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp`
|
| 263 |
+
- **HuggingFace:** `https://huggingface.co/cryptorugmunch/rug-munch-intelligence`
|
| 264 |
+
|
| 265 |
+
---
|
| 266 |
+
|
| 267 |
+
## Version History
|
| 268 |
+
|
| 269 |
+
### v3.4.0 (2026-06-21) — Crisis Ops Rebuild
|
| 270 |
+
- Backend rewritten via strangler-fig: clean main.py (243 lines) replaces 8,475-line legacy
|
| 271 |
+
- DataBus promoted to single source of truth (96 chains, 119 providers)
|
| 272 |
+
- 14 frozen files — explicit un-freeze required before edit
|
| 273 |
+
- AI-Forward Modules M1-M8 mandated across the system
|
| 274 |
+
- Prometheus + AlertManager wired to @rmialerts Telegram channel
|
| 275 |
+
- x402 MCP marketplace gateway live for tool-level micropayments
|
| 276 |
+
- 5 new v1 routers: admin/alerts_webhook, databus, x402/payments, rag/search, scanner
|
| 277 |
+
|
| 278 |
+
### v3.3.0 (2026-06-01)
|
| 279 |
+
- 18 agent skills with workflow guides and anti-abuse rules
|
| 280 |
+
- 4 membership tiers with daily call limits (60-90% discount)
|
| 281 |
+
- 4 scan packs at 50-53% off individual tools
|
| 282 |
+
- 4 real-time streaming feeds (WebSocket + webhook)
|
| 283 |
+
- 4 deep research report products
|
| 284 |
+
- 3 batch scanning products (75-90% off)
|
| 285 |
+
- 3 AI-optimized data feeds for LLM consumption
|
| 286 |
+
- 85 local MCP tools (Solana RPC + EVM 86 networks)
|
| 287 |
+
- 50 free Boar blockchain tools (ETH, ENS, contracts)
|
| 288 |
+
- Multi-provider caching shield on every data call
|
| 289 |
+
- Platform manifest — single source of truth, auto-syncing
|
| 290 |
+
- Earnings dashboard with wallet tracking
|
| 291 |
+
- Quality endpoints: health, status, SDK, changelog, trials
|
| 292 |
+
|
| 293 |
+
### v3.2.0 (2026-05-15)
|
| 294 |
+
- POST /mcp JSON-RPC handler
|
| 295 |
+
- inputSchema on every tool
|
| 296 |
+
- Dynamic facilitator count
|
| 297 |
+
- CORS headers for browser clients
|
| 298 |
+
|
| 299 |
+
### v3.1.0 (2026-04-01)
|
| 300 |
+
- /.well-known/mcp discovery
|
| 301 |
+
- llms.txt for AI agent discovery
|
| 302 |
+
- x402 payment protocol support
|
| 303 |
+
- 8 payment facilitators across 13 chains
|
| 304 |
+
|
| 305 |
+
---
|
| 306 |
+
|
| 307 |
+
**Contact:** mcp@rugmunch.io | **GitHub:** github.com/Rug-Munch-Media-LLC
|
| 308 |
+
**Operations:** @rmialerts (Telegram, Prometheus-wired)
|
backend/RMI_SYSTEM_MAP.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rug Munch Intelligence (RMI) — System Map & Build Status
|
| 2 |
+
|
| 3 |
+
## LIVE SYSTEM OVERVIEW
|
| 4 |
+
|
| 5 |
+
```
|
| 6 |
+
┌─────────────────────────────────────────────────────────┐
|
| 7 |
+
│ FRONTEND (React) │
|
| 8 |
+
│ /root/frontend/ — 20 pages, dist/index.html │
|
| 9 |
+
│ RugMaps, RugCharts, Alerts, Markets, News, │
|
| 10 |
+
│ Intelligence, Investigation, ScamSchool, MCP Docs │
|
| 11 |
+
└────────────────────┬────────────────────────────────────┘
|
| 12 |
+
│ Supabase + REST API
|
| 13 |
+
┌────────────────────▼────────────────────────────────────┐
|
| 14 |
+
│ BACKEND (FastAPI) │
|
| 15 |
+
│ /root/backend/ — 379 endpoints, 6 routers │
|
| 16 |
+
│ Docker: rmi_backend (volume-mounted /app/app) │
|
| 17 |
+
│ 66 backend modules, 8 data connectors │
|
| 18 |
+
│ │
|
| 19 |
+
│ WALLET-CLUSTERING ROUTER (14 endpoints) │
|
| 20 |
+
│ POST /contract-scan → holders → clusters → bundles │
|
| 21 |
+
│ POST /cluster/detect → 7-method detection │
|
| 22 |
+
│ POST /cluster/analyze → behavioral fingerprinting │
|
| 23 |
+
│ GET /health → cache + GNN + spam stats │
|
| 24 |
+
│ │
|
| 25 |
+
│ FORENSICS ROUTER (12 endpoints) │
|
| 26 |
+
│ POST /threat-check → CryptoScamDB + GoPlus + Januus │
|
| 27 |
+
│ POST /deep-scan → full wallet forensics │
|
| 28 |
+
│ POST /cross-chain → multi-chain correlation │
|
| 29 |
+
│ │
|
| 30 |
+
│ RUGMAPS ROUTER (8 endpoints) │
|
| 31 |
+
│ GET /analyze/{address} → bubble map generation │
|
| 32 |
+
│ GET /health │
|
| 33 |
+
│ │
|
| 34 |
+
│ CROSS-TOKEN ROUTER (8 endpoints) │
|
| 35 |
+
│ GET /connections/{wallet} → cross-project links │
|
| 36 |
+
│ │
|
| 37 |
+
│ DISCOVERY ROUTER (8 endpoints) │
|
| 38 |
+
│ GET /tokens → new token discovery │
|
| 39 |
+
│ │
|
| 40 |
+
│ X402 TOOLS ROUTER (142 endpoints) │
|
| 41 |
+
└────────────────────┬────────────────────────────────────┘
|
| 42 |
+
│
|
| 43 |
+
┌──────────────┼──────────────┐
|
| 44 |
+
▼ ▼ ▼
|
| 45 |
+
┌──────────┐ ┌──────────┐ ┌──────────────┐
|
| 46 |
+
│ Helius x3 │ │QuickNode │ │ DexScreener │
|
| 47 |
+
│ (primary) │ │(fallback)│ │ (free tier) │
|
| 48 |
+
└──────────┘ └──────────┘ └──────────────┘
|
| 49 |
+
▼ ▼ ▼
|
| 50 |
+
┌─────────────────────────────────────────────────────────┐
|
| 51 |
+
│ UNIFIED PROVIDER (7-source cascade) │
|
| 52 |
+
│ Helius → Birdeye → Solscan → GMGN → DexScreener → │
|
| 53 |
+
│ QuickNode → Blockchair Rate-limited 5 req/sec │
|
| 54 |
+
└─────────────────────────────────────────────────────────┘
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## DATA SOURCES (18 API Keys)
|
| 58 |
+
|
| 59 |
+
| Source | Key File | Purpose | Status |
|
| 60 |
+
|---|---|---|---|
|
| 61 |
+
| Helius x3 | helius_api_key, _2, _3 | Solana RPC primary | LIVE |
|
| 62 |
+
| QuickNode | quicknode_api_key | Solana RPC fallback | LIVE |
|
| 63 |
+
| Birdeye | birdeye_api_key | Token data, whale tracking | LIVE |
|
| 64 |
+
| GMGN | gmgn_api_key | Token discovery | LIVE |
|
| 65 |
+
| Moralis | moralis_api_key | Multi-chain EVM data | CONFIGURED |
|
| 66 |
+
| Arkham | arkham_api_key | Entity labeling | CONFIGURED |
|
| 67 |
+
| CoinGecko | coingecko_api_key | Price data | CONFIGURED |
|
| 68 |
+
| Dune | dune_api_key | SQL queries on-chain | CONFIGURED |
|
| 69 |
+
| Nansen | nansen_api_key | Smart money tracking | CONFIGURED |
|
| 70 |
+
| Solscan | solscan_api_key | Solana transaction data | CONFIGURED |
|
| 71 |
+
| NVIDIA | nvidia_api_key, dev_api_key | AI inference | CONFIGURED |
|
| 72 |
+
| OpenRouter | openrouter_api_key | LLM routing | CONFIGURED |
|
| 73 |
+
| Groq | groq_api_key | Fast LLM inference | CONFIGURED |
|
| 74 |
+
| SiliconFlow | siliconflow_api_key, _2 | LLM inference | CONFIGURED |
|
| 75 |
+
| Kimi | kimi_api_key | LLM (Moonshot) | CONFIGURED |
|
| 76 |
+
| Mistral | mistral_api_key | LLM inference | CONFIGURED |
|
| 77 |
+
| Gemini | gemini_api_key | Google AI | CONFIGURED |
|
| 78 |
+
| HuggingFace | huggingface_token | Model downloads | CONFIGURED |
|
| 79 |
+
| Cloudflare | cloudflare_api_token | Workers, DNS | LIVE |
|
| 80 |
+
| Telegram | telegram_bot_token | Bot integration | LIVE |
|
| 81 |
+
|
| 82 |
+
## DETECTION PIPELINE
|
| 83 |
+
|
| 84 |
+
```
|
| 85 |
+
Token/Address Input
|
| 86 |
+
│
|
| 87 |
+
▼
|
| 88 |
+
┌──────────────────┐
|
| 89 |
+
│ ENTITY REGISTRY │ ← 50+ CEX/DeFi/Mixer addresses
|
| 90 |
+
│ filter_infra() │ ← 100K+ Solana labels from CSV
|
| 91 |
+
└────────┬─────────┘
|
| 92 |
+
▼
|
| 93 |
+
┌──────────────────┐
|
| 94 |
+
│ SPAM REGISTRY │ ← 2,530 Scam Sniffer addresses
|
| 95 |
+
│ check_token() │ ← GoldRush 8M spam tokens (6 chains)
|
| 96 |
+
└────────┬─────────┘ ← OpenSanctions OFAC, Guardian phishing
|
| 97 |
+
▼
|
| 98 |
+
┌──────────────────┐
|
| 99 |
+
│ HOLDER ANALYSIS │ ← Helius getProgramAccounts (228K JTO)
|
| 100 |
+
│ (unified_provider)│ ← Multi-source fallback cascade
|
| 101 |
+
└────────┬─────────┘
|
| 102 |
+
▼
|
| 103 |
+
┌──────────────────┐
|
| 104 |
+
│ BUNDLE DETECTION │ 5 signals:
|
| 105 |
+
│ (bundle_detector)│ ← atomic_block, common_funder, temporal,
|
| 106 |
+
└────────┬─────────┘ ← distribution_anomaly, concentration
|
| 107 |
+
▼
|
| 108 |
+
┌──────────────────┐
|
| 109 |
+
│ CLUSTER DETECTION│ 7 methods:
|
| 110 |
+
│ (wallet_clustering)│ ← temporal, counterparty, behavioral,
|
| 111 |
+
└────────┬─────────┘ ← funding, pattern, ML similarity, sleeper
|
| 112 |
+
▼
|
| 113 |
+
┌──────────────────┐
|
| 114 |
+
│ GNN FRAUD SCORE │ ← Random Forest fallback (CPU-only)
|
| 115 |
+
│ (fraud_gnn) │ ← HuggingFace sklearn (gated, not loaded)
|
| 116 |
+
└────────┬─────────┘
|
| 117 |
+
▼
|
| 118 |
+
┌──────────────────┐
|
| 119 |
+
│ THREAT INTEL │ ← CryptoScamDB (MIT, free)
|
| 120 |
+
│ (threat_feeds) │ ← GoPlus Security (free tier)
|
| 121 |
+
└────────┬─────────┘ ← Januus risk scores (open-source)
|
| 122 |
+
▼
|
| 123 |
+
┌──────────────────┐
|
| 124 |
+
│ CROSS-CHAIN │ ← Behavioral fingerprinting
|
| 125 |
+
│ (correlator) │ ← CEX deposit pattern matching
|
| 126 |
+
└────────┬─────────┘ ← Union-find entity grouping
|
| 127 |
+
▼
|
| 128 |
+
RISK SCORE OUTPUT
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## LOCAL DATA FILES
|
| 132 |
+
|
| 133 |
+
| File | Lines | Purpose |
|
| 134 |
+
|---|---|---|
|
| 135 |
+
| wallet-labels/solana_cex_labels.csv | 100,001 | All known CEX hot wallets on Solana |
|
| 136 |
+
| wallet-labels/solana_defi_labels.csv | 1,481 | DeFi protocol addresses (Jupiter, Raydium, etc.) |
|
| 137 |
+
| wallet-labels/solana_dapp_labels.csv | 1,791 | Dapp addresses |
|
| 138 |
+
| wallet-labels/etherscan_malicious_labels.csv | 7,781 | Etherscan-flagged malicious contracts |
|
| 139 |
+
| wallet-labels/malicious_smart_contracts.csv | 754 | Additional malicious contracts |
|
| 140 |
+
| wallet-labels/ofac_sanctions.json | 0 | (Empty - needs seeding) |
|
| 141 |
+
| spam/scamsniffer_blacklist.json | 2,531 | Scam Sniffer address blacklist |
|
| 142 |
+
| SOSANA-CRM-2024.json | 101,916 | Full CRM data dump |
|
| 143 |
+
| wallet_database.json | 364 | Wallet profiles DB |
|
| 144 |
+
| rmi.db | 9 | SQLite state |
|
| 145 |
+
|
| 146 |
+
## SUPABASE TABLES (8 tables)
|
| 147 |
+
|
| 148 |
+
- profiles — user profiles
|
| 149 |
+
- wallet_labels — labeled wallet data
|
| 150 |
+
- token_analysis — token analysis results
|
| 151 |
+
- scam_reports — scam report submissions
|
| 152 |
+
- alerts — alert configurations
|
| 153 |
+
- market_intel — market intelligence cache
|
| 154 |
+
- news — news article cache
|
| 155 |
+
- forensic_reports — forensic analysis results
|
| 156 |
+
|
| 157 |
+
## INFRASTRUCTURE
|
| 158 |
+
|
| 159 |
+
| Service | Container | Status | Purpose |
|
| 160 |
+
|---|---|---|---|
|
| 161 |
+
| Backend API | rmi_backend | UP (healthy) | FastAPI, 379 endpoints |
|
| 162 |
+
| n8n Automation | rmi_n8n | UP | Workflow automation |
|
| 163 |
+
| Worker | rmi_worker | UP (healthy) | Background job processing |
|
| 164 |
+
| Telegram Bot | telegram-mcp | UP | Telegram bot integration |
|
| 165 |
+
| Listmonk | rmi-listmonk | UP | Email newsletters |
|
| 166 |
+
| Dragonfly (Redis) | rmi_dragonfly | UP (healthy) | Caching |
|
| 167 |
+
| Cloudflare Worker | rmi_cloudflare | UP | CF tunnel/edge |
|
| 168 |
+
| Ghost CMS | rmi-ghost | UP | Blog/content |
|
| 169 |
+
| MySQL | rmi-mysql | UP | Database |
|
| 170 |
+
| Langfuse | langfuse stack | UP | LLM observability |
|
| 171 |
+
| CF Edge Worker | rag.rugmunch.io | LIVE | RAG caching |
|
| 172 |
+
|
| 173 |
+
## WHAT'S WORKING (VERIFIED)
|
| 174 |
+
|
| 175 |
+
- [x] Helius RPC — 228K JTO holders detected via getProgramAccounts
|
| 176 |
+
- [x] Multi-source cascade — Helius → QuickNode → DexScreener fallback
|
| 177 |
+
- [x] Entity Registry — Binance/Uniswap/Tornado correctly identified
|
| 178 |
+
- [x] Bundle Detection — JTO = 0.09 confidence (correctly low)
|
| 179 |
+
- [x] Spam Registry — 2,530 Scam Sniffer addresses loaded
|
| 180 |
+
- [x] GNN Scoring — Random Forest fallback active (HuggingFace model gated)
|
| 181 |
+
- [x] Threat Feeds — GoPlus + CryptoScamDB + Januus integrated
|
| 182 |
+
- [x] All 5 health endpoints returning "ok"
|
| 183 |
+
- [x] All 10 core modules importing clean
|
| 184 |
+
- [x] RAG Edge Worker at rag.rugmunch.io returning health ok
|
| 185 |
+
- [x] n8n running with database
|
| 186 |
+
- [x] Telegram bot connected to Telegram servers
|
| 187 |
+
|
| 188 |
+
## WHAT'S BROKEN / NEEDS WORK
|
| 189 |
+
|
| 190 |
+
### Critical
|
| 191 |
+
- [ ] **RAG collections empty** — wallet_profiles, scam_patterns, forensic_reports all 0 docs. n8n needs to feed these. Only news_articles has 4 docs.
|
| 192 |
+
- [ ] **OFAC sanctions empty** — wallet-labels/ofac_sanctions.json is 0 lines. Needs seeding from opensanctions.org
|
| 193 |
+
- [ ] **563 uncommitted files** — backend has substantial uncommitted changes (Dockerfile, x402, entity_labeler, portfolio_tracker, etc.)
|
| 194 |
+
- [ ] **Frontend only has index.html** — 20 page source files exist but dist/ only has index.html. Other pages (docs, pricing, tools, x402) were deleted.
|
| 195 |
+
|
| 196 |
+
### High Priority
|
| 197 |
+
- [ ] **HuggingFace model gated** — fraud_gnn.py falls back to heuristic Random Forest because the sklearn model requires auth. Need to either get access or train a proper model.
|
| 198 |
+
- [ ] **n8n workflows not queryable** — 6 workflows claimed but API returned empty. Need to verify they're running.
|
| 199 |
+
- [ ] **CryptoGuard/GoPlus integration testing** — threat_feeds.py has the code but needs live testing with known scam addresses.
|
| 200 |
+
- [ ] **Entity labeler refactoring** — entity_labeler.py has 1084 lines of changes uncommitted, needs cleanup.
|
| 201 |
+
- [ ] **Exchange flow analyzer** — exchange_flow_analyzer.py reworked but uncommitted.
|
| 202 |
+
|
| 203 |
+
### Medium Priority
|
| 204 |
+
- [ ] **Frontend build pipeline** — Need to build and deploy the React frontend properly with all 20 pages.
|
| 205 |
+
- [ ] **Telegram bot features** — Bot is connected but needs command handlers for RMI features (scan, alert, etc.)
|
| 206 |
+
- [ ] **Email alerts** — Listmonk is running but not wired to RMI alert system.
|
| 207 |
+
- [ ] **CF Worker source** — rag.rugmunch.io is live but worker source code not in repo.
|
| 208 |
+
- [ ] **DexScreener connector** — Listed in unified_provider but not tested in cascade.
|
| 209 |
+
- [ ] **Blockchair connector** — Exists but not wired into unified_provider cascade.
|
| 210 |
+
- [ ] **EVM connector** — File exists but not tested against real EVM chains.
|
| 211 |
+
|
| 212 |
+
### Low Priority / Nice-to-Have
|
| 213 |
+
- [ ] **x402 payment system** — 142+ endpoints in x402_tools but uncommitted changes.
|
| 214 |
+
- [ ] **GNN model training** — Train a local sklearn model on known fraud data instead of HF gated model.
|
| 215 |
+
- [ ] **Cross-chain EVM testing** — cross_chain_correlator has Ethereum CEX addresses but Solana-only testing.
|
| 216 |
+
- [ ] **Mempool sentinel** — mempool_sentinel.py exists but unclear if active.
|
| 217 |
+
- [ ] **Wallet monitor** — wallet_monitor.py exists but not connected to alerts.
|
| 218 |
+
|
| 219 |
+
## BUILD PLAN — NEXT STEPS
|
| 220 |
+
|
| 221 |
+
### Phase 1: Stabilize & Commit (Day 1)
|
| 222 |
+
1. Commit all 563 uncommitted backend files
|
| 223 |
+
2. Seed RAG collections (wallet profiles from labels, known scam patterns)
|
| 224 |
+
3. Seed OFAC sanctions data from OpenSanctions
|
| 225 |
+
4. Test all threat feeds end-to-end with known scam addresses
|
| 226 |
+
|
| 227 |
+
### Phase 2: Frontend & Bot (Day 2-3)
|
| 228 |
+
5. Build frontend properly — `npm run build` in /root/frontend
|
| 229 |
+
6. Wire Telegram bot commands: /scan, /alert, /watch, /status
|
| 230 |
+
7. Deploy frontend to CF Pages or VPS
|
| 231 |
+
|
| 232 |
+
### Phase 3: Data Pipeline (Day 3-4)
|
| 233 |
+
8. Wire n8n workflows to feed RAG collections continuously
|
| 234 |
+
9. Set up scheduled GoldRush spam token sync (6 chains)
|
| 235 |
+
10. Set up OpenSanctions daily sync
|
| 236 |
+
11. Set up Scam Sniffer blacklist auto-update
|
| 237 |
+
|
| 238 |
+
### Phase 4: Testing & Hardening (Day 4-5)
|
| 239 |
+
12. End-to-end test with known scam tokens (not just JTO)
|
| 240 |
+
13. EVM chain testing with Ethereum addresses
|
| 241 |
+
14. Load testing on /contract-scan endpoint
|
| 242 |
+
15. Documentation: API docs, setup guide, architecture diagram
|
| 243 |
+
|
| 244 |
+
### Phase 5: Production (Day 5+)
|
| 245 |
+
16. Set up GitHub Actions CI/CD
|
| 246 |
+
17. Auto-deploy on merge to main
|
| 247 |
+
18. Monitoring (Langfuse, uptime checks)
|
| 248 |
+
19. Rate limiting on public endpoints
|
| 249 |
+
20. Authentication on sensitive endpoints
|
| 250 |
+
|
| 251 |
+
## KEY FILES QUICK REFERENCE
|
| 252 |
+
|
| 253 |
+
```
|
| 254 |
+
/root/backend/app/
|
| 255 |
+
├── chain_client.py # Rate-limited Solana RPC (Helius + QuickNode)
|
| 256 |
+
├── chain_cache.py # LRU cache with TTL (500 entries)
|
| 257 |
+
├── chain_feeder.py # Wallet TX feeding into clustering engine
|
| 258 |
+
├── unified_provider.py # 7-source data cascade
|
| 259 |
+
├── bundle_detector.py # 5-signal bundle detection
|
| 260 |
+
├── entity_registry.py # 50+ CEX/DeFi/Mixer address exclusion
|
| 261 |
+
├── threat_feeds.py # CryptoScamDB + GoPlus + Januus
|
| 262 |
+
├── fraud_gnn.py # Random Forest fraud scoring (CPU-only)
|
| 263 |
+
├── spam_registry.py # 2,530 scam addresses + GoldRush integration
|
| 264 |
+
├── cross_chain_correlator.py # Multi-chain entity resolution
|
| 265 |
+
├── wallet_clustering.py # 7-method clustering engine
|
| 266 |
+
├── cluster_detection.py # Cluster detection orchestrator
|
| 267 |
+
├── bubble_maps.py # RugMaps visualization engine
|
| 268 |
+
├── token_discovery.py # New token scanning
|
| 269 |
+
├── rag_service.py # RAG query service
|
| 270 |
+
├── routers/
|
| 271 |
+
│ ├── wallet_clustering_router.py # 14 endpoints
|
| 272 |
+
│ ��── forensics_router.py # 12 endpoints
|
| 273 |
+
│ ├── bubble_maps_router.py # 8 endpoints
|
| 274 |
+
│ ├── cross_token_router.py # 8 endpoints
|
| 275 |
+
│ ├── discovery_router.py # 8 endpoints
|
| 276 |
+
│ └── ... (admin, chat, x402, etc.)
|
| 277 |
+
├── data/
|
| 278 |
+
│ ├── spam/scamsniffer_blacklist.json # 2,531 lines
|
| 279 |
+
│ ├── wallet-labels/ # 100K+ Solana labels
|
| 280 |
+
│ └── SOSANA-CRM-2024.json # Full CRM dump
|
| 281 |
+
```
|
backend/SECURITY.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Security Policy
|
| 2 |
+
|
| 3 |
+
## Supported Versions
|
| 4 |
+
|
| 5 |
+
| Version | Supported |
|
| 6 |
+
| ------- | ------------------ |
|
| 7 |
+
| 2.x | ✅ Active support |
|
| 8 |
+
| 1.x | ❌ End of life |
|
| 9 |
+
|
| 10 |
+
## Reporting a Vulnerability
|
| 11 |
+
|
| 12 |
+
**DO NOT OPEN A PUBLIC ISSUE.** This is a commercial security product. Vulnerabilities in our code directly affect our customers' safety.
|
| 13 |
+
|
| 14 |
+
**Email:** security@rugmunch.io
|
| 15 |
+
**PGP Key:** [Available on request]
|
| 16 |
+
**Response time:** Within 24 hours
|
| 17 |
+
**Disclosure:** Coordinated disclosure after fix deployment (max 90 days)
|
| 18 |
+
|
| 19 |
+
### What to include:
|
| 20 |
+
- Type of vulnerability (RCE, auth bypass, data exposure, etc.)
|
| 21 |
+
- Affected endpoint/component
|
| 22 |
+
- Steps to reproduce
|
| 23 |
+
- Proof of concept (if available)
|
| 24 |
+
- Impact assessment
|
| 25 |
+
|
| 26 |
+
### What you'll receive:
|
| 27 |
+
- Confirmation within 24 hours
|
| 28 |
+
- Regular status updates
|
| 29 |
+
- Credit in release notes (unless you request anonymity)
|
| 30 |
+
- Bug bounty at our discretion (contact us for current program details)
|
| 31 |
+
|
| 32 |
+
## Security Best Practices for Contributors
|
| 33 |
+
|
| 34 |
+
1. **Never commit secrets** — API keys, tokens, passwords, private keys go in environment variables only
|
| 35 |
+
2. **Use `.env` (gitignored)** for local development credentials
|
| 36 |
+
3. **Sign your commits** with GPG (`git config commit.gpgsign true`)
|
| 37 |
+
4. **Review your own diffs** before pushing — check for accidental credential exposure
|
| 38 |
+
5. **Use branch protection** — all changes to main must go through PR review
|
| 39 |
+
6. **Run `git-sync.py --dry-run`** before pushing to verify no secrets are staged
|
| 40 |
+
|
| 41 |
+
## Our Security Stack
|
| 42 |
+
|
| 43 |
+
- Pre-commit hooks scan every staged file for secrets
|
| 44 |
+
- Pre-push hooks block force pushes and re-scan for secrets
|
| 45 |
+
- GitHub Actions CI runs secret scanning on every PR
|
| 46 |
+
- Dependabot monitors dependencies for known CVEs
|
| 47 |
+
- Production secrets stored in GitHub Secrets vault + environment variables
|
| 48 |
+
- Backend .env never committed (in .gitignore)
|
backend/SECURITY_STACK.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RugMunch Intelligence — Security Stack Summary
|
| 2 |
+
# Generated: 2026-05-08
|
| 3 |
+
# WARNING: This file describes the security tooling deployed on this host.
|
| 4 |
+
# Do NOT share externally — contains system architecture details.
|
| 5 |
+
# Access: chmod 600, root-only.
|
| 6 |
+
|
| 7 |
+
══════════════════════════════════════════════════════════════════
|
| 8 |
+
INSTALLED OPEN-SOURCE SECURITY TOOLS
|
| 9 |
+
══════════════════════════════════════════════════════════════════
|
| 10 |
+
|
| 11 |
+
SAST (Static Analysis):
|
| 12 |
+
bandit 1.9.4 Python security linter → pipx install bandit
|
| 13 |
+
semgrep 1.162.0 Cross-language static analysis → pipx install semgrep
|
| 14 |
+
|
| 15 |
+
Secret Detection:
|
| 16 |
+
gitleaks 8.25.1 Git + filesystem secret scanning → binary download
|
| 17 |
+
|
| 18 |
+
Dependency Scan:
|
| 19 |
+
pip-audit 2.10.0 PyPI vulnerability audit → pipx install pip-audit
|
| 20 |
+
|
| 21 |
+
Container Scanning:
|
| 22 |
+
trivy 0.70.0 Container + filesystem + secrets → binary download
|
| 23 |
+
|
| 24 |
+
IPS / WAF:
|
| 25 |
+
crowdsec 1.7.7 Collaborative intrusion detection → apt install
|
| 26 |
+
fail2ban active IP-based brute-force blocker → apt install
|
| 27 |
+
|
| 28 |
+
Pre-commit:
|
| 29 |
+
pre-commit 4.6.0 Git hook automation → pipx install pre-commit
|
| 30 |
+
|
| 31 |
+
══════════════════════════════════════════════════════════════════
|
| 32 |
+
NEW FILES CREATED
|
| 33 |
+
══════════════════════════════════════════════════════════════════
|
| 34 |
+
|
| 35 |
+
/srv/rmi/backend/.bandit.yaml Bandit config (excludes B105/B311 false-posit, dirs)
|
| 36 |
+
/srv/rmi/backend/.gitleaks.toml Gitleaks allowlist (public SOL addresses + static/)
|
| 37 |
+
/srv/rmi/backend/.trivyignore Trivy ignore (investigation evidence files)
|
| 38 |
+
/srv/rmi/backend/.pre-commit-config.yaml Pre-commit: bandit + gitleaks + isort + black + pip-audit
|
| 39 |
+
/srv/rmi/backend/run-security.sh Full security suite runner
|
| 40 |
+
/srv/rmi/backend/tmp/ fail2ban templates + GitHub Actions template
|
| 41 |
+
|
| 42 |
+
══════════════════════════════════════════════════════════════════
|
| 43 |
+
CODE FIXES APPLIED
|
| 44 |
+
══════════════════════════════════════════════════════════════════
|
| 45 |
+
|
| 46 |
+
DOCKERFILE:
|
| 47 |
+
- FROM python:3.12-slim (was 3.11)
|
| 48 |
+
- Added non-root `rmi` user + USER rmi
|
| 49 |
+
- Upgraded known-vulnerable packages: jaraco.context + wheel
|
| 50 |
+
|
| 51 |
+
CODE (md5 → sha256 - CWE-327):
|
| 52 |
+
app/fallback_engine.py:83 Cache key hash
|
| 53 |
+
app/routers/news_feed.py:237 Article deduplication hash
|
| 54 |
+
app/routers/rugmaps.py:462 Token cluster seed
|
| 55 |
+
app/routers/social.py:435 Like hash
|
| 56 |
+
app/rugmaps_analyzer.py:99 Analyzer seed
|
| 57 |
+
|
| 58 |
+
BUG FIXES:
|
| 59 |
+
app/routers/daily_briefing.py:280 Fixed unterminated string literal syntax error
|
| 60 |
+
|
| 61 |
+
══════════════════════════════════════════════════════════════════
|
| 62 |
+
SCAN RESULTS (latest run)
|
| 63 |
+
══════════════════════════════════════════════════════════════════
|
| 64 |
+
|
| 65 |
+
Bandit: 0 HIGH, 42 MEDIUM (excludes B105 false-positives)
|
| 66 |
+
Semgrep: 4 findings (2 INFO + 2 WARNING — all in x402-gateway/*.ts, not backend)
|
| 67 |
+
pip-audit: 0 known dependency vulnerabilities
|
| 68 |
+
Gitleaks: 0 leaks (after allowlist for public SOL addresses + dist/)
|
| 69 |
+
Trivy fs: 0 HIGH/CRITICAL (after .trivyignore for investigation evidence)
|
| 70 |
+
|
| 71 |
+
══════════════════════════════════════════════════════════════════
|
| 72 |
+
MANUAL DEPLOY STEPS
|
| 73 |
+
══════════════════════════════════════════════════════════════════
|
| 74 |
+
|
| 75 |
+
Deploy fail2ban API abuse protection:
|
| 76 |
+
sudo cp /srv/rmi/backend/tmp/rmi-api.conf /etc/fail2ban/filter.d/rmi-api.conf
|
| 77 |
+
sudo cp /srv/rmi/backend/tmp/rmi-api-jail.conf /etc/fail2ban/jail.d/rmi-api.conf
|
| 78 |
+
sudo systemctl restart fail2ban
|
| 79 |
+
|
| 80 |
+
Deploy GitHub Actions when repo hooks up:
|
| 81 |
+
mkdir -p .github/workflows
|
| 82 |
+
cp /srv/rmi/backend/tmp/github-workflow.yml .github/workflows/security.yml
|
| 83 |
+
|
| 84 |
+
═════════════════════════════════════���════════════════════════════
|
| 85 |
+
COMMAND REFERENCE
|
| 86 |
+
══════════════════════════════════════════════════════════════════
|
| 87 |
+
|
| 88 |
+
Quick scan: cd /srv/rmi/backend && ./run-security.sh
|
| 89 |
+
Full scan: cd /srv/rmi/backend && ./run-security.sh --full
|
| 90 |
+
Bandit only: bandit -r app/ -c .bandit.yaml
|
| 91 |
+
Semgrep only: semgrep --config=auto
|
| 92 |
+
pip-audit: pip-audit -r requirements.txt
|
| 93 |
+
Gitleaks: gitleaks detect --source . --no-git --config .gitleaks.toml
|
| 94 |
+
Trivy fs: trivy fs --scanners vuln,secret,misconfig .
|
| 95 |
+
Trivy image: trivy image --severity HIGH,CRITICAL rmi-backend:latest
|
| 96 |
+
Pre-commit: pre-commit run --all-files
|
| 97 |
+
CrowdSec stats: cscli metrics + cscli decisions list
|
| 98 |
+
Fail2ban ban: sudo fail2ban-client status rmi-api
|
backend/STANDARDS.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI Development Standards — AI-Forward + Web3 Best Practices
|
| 2 |
+
|
| 3 |
+
> **v3 (Jun 21 2026) — Crisis Ops Rebuild**: These standards reflect the
|
| 4 |
+
> rebuilt architecture. The legacy 8,475-line `_legacy_main.py` is frozen;
|
| 5 |
+
> do not edit. New code goes into `app/api/v1/` via the aggregator in
|
| 6 |
+
> `app/api/v1/__init__.py`. See `docs/adr/0001-why-fastapi.md` and
|
| 7 |
+
> `docs/adr/0003-strangler-fig-not-rewrite.md` for the architectural decisions.
|
| 8 |
+
|
| 9 |
+
## v3 Hard Rules
|
| 10 |
+
|
| 11 |
+
1. **No mass regex.** Each transformation explicit, one-line-per-replace.
|
| 12 |
+
2. **New files only** — never modify the 14 frozen files without explicit un-freeze.
|
| 13 |
+
3. **Strangler-fig migration**: legacy routes stay mounted in `main.py` until
|
| 14 |
+
explicitly removed. New v1 routes mount at the same path — first match wins.
|
| 15 |
+
4. **One-line main.py edits only.** Even when adding routes, prefer the
|
| 16 |
+
`app/api/v1/__init__.py` aggregator + `v1_modules` list pattern.
|
| 17 |
+
5. **No `_legacy_main` import.** The new main.py does not import legacy.
|
| 18 |
+
6. **Real data flows only.** A v1 route that returns 404 / placeholder is not
|
| 19 |
+
done. Acceptance = a real route serves real data end-to-end.
|
| 20 |
+
7. **Prometheus metrics required.** Every new router emits `rmi_requests_total`
|
| 21 |
+
counter (auto via CostTrackingMiddleware).
|
| 22 |
+
8. **Telegram alerts via @rmialerts only.** No personal chat routing.
|
| 23 |
+
See `app/api/v1/admin/alerts_webhook.py`.
|
| 24 |
+
|
| 25 |
+
## v3 Modern Builder Bar (14 points)
|
| 26 |
+
|
| 27 |
+
See `~/.hermes/skills/rmi/modern-builder-compliance/SKILL.md` for the full bar.
|
| 28 |
+
Highlights:
|
| 29 |
+
- Async/await for all I/O · Pydantic v2 everywhere · Structured logging
|
| 30 |
+
- Type hints on all public functions · No bare except: · Frozen file respect
|
| 31 |
+
- Real data acceptance test · Documented in DESIGN.md or relevant ADR
|
| 32 |
+
- One concern per file · Tests before merge · No silent failures
|
| 33 |
+
- Idempotent endpoints · Pagination on list endpoints · Rate-limited public routes
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## ⚠️ FIRST: Read /root/DEVELOPERS.md for canonical paths.
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## BACKEND DEVELOPMENT
|
| 42 |
+
|
| 43 |
+
### Pre-commit checklist (run before every commit):
|
| 44 |
+
```bash
|
| 45 |
+
bash /root/backend/scripts/pre-commit.sh
|
| 46 |
+
```
|
| 47 |
+
Checks: Python syntax, hardcoded secrets, env var consistency, stale path references.
|
| 48 |
+
|
| 49 |
+
### Environment variables:
|
| 50 |
+
```bash
|
| 51 |
+
# Auto-generate from Hermes config:
|
| 52 |
+
python3 /root/backend/generate_env.py --force
|
| 53 |
+
# Then fill in missing values:
|
| 54 |
+
nano /root/backend/.env
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### Live development (no rebuild needed):
|
| 58 |
+
```bash
|
| 59 |
+
# Volume mount means code changes are instant:
|
| 60 |
+
docker restart rmi-backend
|
| 61 |
+
# Verify:
|
| 62 |
+
curl http://localhost:8000/health
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### Adding new env vars:
|
| 66 |
+
1. Add to code: `os.getenv("MY_VAR")`
|
| 67 |
+
2. Add to `/root/backend/.env.example` with comment
|
| 68 |
+
3. Run `python3 /root/backend/generate_env.py --force`
|
| 69 |
+
4. Add to `/srv/rugmuncher-backend/docker-compose.yml` if container needs it
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## AI AGENT DEVELOPMENT WORKFLOW
|
| 74 |
+
|
| 75 |
+
This system is designed for AI-assisted development. Here's the stack:
|
| 76 |
+
|
| 77 |
+
```
|
| 78 |
+
hermes-agent (CLI)
|
| 79 |
+
│
|
| 80 |
+
├── Terminal tool → docker exec, git, curl, python
|
| 81 |
+
├── Web tool → API testing, research
|
| 82 |
+
├── File tool → Edit /root/backend/ directly
|
| 83 |
+
├── Delegate → Spawn sub-agents for parallel work
|
| 84 |
+
└── Cron jobs → Automated tasks
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
### How Hermes develops the backend:
|
| 88 |
+
1. **Discover**: Reads AGENTS.md in /root/backend/
|
| 89 |
+
2. **Edit**: Patches files directly (volume mount = live)
|
| 90 |
+
3. **Test**: `curl localhost:8000/health` after changes
|
| 91 |
+
4. **Rebuild**: `docker compose build && docker compose up -d`
|
| 92 |
+
5. **Verify**: Checks logs, API responses
|
| 93 |
+
|
| 94 |
+
### n8n workflow development:
|
| 95 |
+
- UI: http://localhost:5678 (admin / RugMuncher2024)
|
| 96 |
+
- Direct DB: `sqlite3 /root/n8n-data/database.sqlite`
|
| 97 |
+
- Import: Copy workflow JSONs into `/root/n8n-workflows/`
|
| 98 |
+
- Test: Check execution history in UI
|
| 99 |
+
|
| 100 |
+
### Orchestrator swarm:
|
| 101 |
+
- API: http://localhost:8081
|
| 102 |
+
- Health: `curl http://localhost:8081/health`
|
| 103 |
+
- Bots: `curl http://localhost:8081/orchestrator/bots`
|
| 104 |
+
- Create task: `POST /orchestrator/task`
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## WEB3 SECURITY BEST PRACTICES
|
| 109 |
+
|
| 110 |
+
### Secrets management:
|
| 111 |
+
- **NO hardcoded secrets** in any `.py` file
|
| 112 |
+
- All secrets in `/root/.secrets/` or `/root/.hermes/.env`
|
| 113 |
+
- App passwords preferred over account passwords
|
| 114 |
+
- Rotate API keys quarterly
|
| 115 |
+
|
| 116 |
+
### Key scanning:
|
| 117 |
+
```bash
|
| 118 |
+
# Run before any commit:
|
| 119 |
+
grep -rn '0x[0-9a-fA-F]\{64\}\|sk-[a-zA-Z0-9]\{20,\}' /root/backend/app/ --include='*.py'
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### RPC security:
|
| 123 |
+
- Use dedicated RPC URLs, never public endpoints in production
|
| 124 |
+
- Rate limit all on-chain queries
|
| 125 |
+
- Cache blockchain data aggressively (Redis)
|
| 126 |
+
|
| 127 |
+
---
|
| 128 |
+
|
| 129 |
+
## CODE QUALITY
|
| 130 |
+
|
| 131 |
+
### Python:
|
| 132 |
+
- Type hints on all public functions
|
| 133 |
+
- Docstrings for modules and classes
|
| 134 |
+
- Async/await for all I/O operations
|
| 135 |
+
- Use Pydantic for data models
|
| 136 |
+
|
| 137 |
+
### TypeScript (Frontend):
|
| 138 |
+
- Components in `/srv/rugmuncher-backend/rmi-frontend/src/components/`
|
| 139 |
+
- Services in `/srv/rugmuncher-backend/rmi-frontend/src/services/`
|
| 140 |
+
- Types shared via `/srv/rugmuncher-backend/rmi-frontend/src/types.ts`
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## MONITORING
|
| 145 |
+
|
| 146 |
+
### Health checks:
|
| 147 |
+
```bash
|
| 148 |
+
# All services:
|
| 149 |
+
curl http://localhost:8000/health # Backend
|
| 150 |
+
curl http://localhost:8081/health # Orchestrator
|
| 151 |
+
curl http://localhost:5678/healthz # n8n
|
| 152 |
+
curl http://localhost:9001/api/health # Listmonk
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
### Logs:
|
| 156 |
+
```bash
|
| 157 |
+
docker logs rmi-backend --tail 50
|
| 158 |
+
docker logs rmi-n8n --tail 50
|
| 159 |
+
journalctl -u hermes -n 50
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
### Cron jobs:
|
| 163 |
+
```bash
|
| 164 |
+
# List all:
|
| 165 |
+
cronjob action='list'
|
| 166 |
+
# Check status of specific job:
|
| 167 |
+
cronjob action='list' # look for last_status
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
---
|
| 171 |
+
|
| 172 |
+
## DEPLOYMENT
|
| 173 |
+
|
| 174 |
+
### Full stack restart:
|
| 175 |
+
```bash
|
| 176 |
+
cd /srv/rugmuncher-backend
|
| 177 |
+
docker compose down
|
| 178 |
+
docker compose up -d
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
### Rebuild with cache clear:
|
| 182 |
+
```bash
|
| 183 |
+
docker compose build --no-cache backend worker orchestrator
|
| 184 |
+
docker compose up -d
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
### Rollback (if something breaks):
|
| 188 |
+
```bash
|
| 189 |
+
# Restore backup:
|
| 190 |
+
cp /root/backups/n8n/$(date +%Y-%m)/database.sqlite /root/n8n-data/
|
| 191 |
+
docker restart rmi-n8n
|
| 192 |
+
|
| 193 |
+
# Rebuild from known-good commit:
|
| 194 |
+
cd /root/backend && git checkout <commit-hash>
|
| 195 |
+
docker restart rmi-backend
|
| 196 |
+
```
|
backend/SUPABASE_ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI Supabase Integration — AI-First, Web3-Forward
|
| 2 |
+
|
| 3 |
+
## Architecture
|
| 4 |
+
|
| 5 |
+
```
|
| 6 |
+
┌─────────────────────────────────────────────────────────┐
|
| 7 |
+
│ RMI Backend (FastAPI) │
|
| 8 |
+
│ │
|
| 9 |
+
│ supabase_router.py supabase_oauth_router.py │
|
| 10 |
+
│ supabase_auth_router.py supabase_service.py │
|
| 11 |
+
│ supabase_rag.py db_client.py │
|
| 12 |
+
└──────────────┬──────────────────────────────────────────┘
|
| 13 |
+
│ httpx + service_role key
|
| 14 |
+
▼
|
| 15 |
+
┌─────────────────────────────────────────────────────────┐
|
| 16 |
+
│ Supabase │
|
| 17 |
+
│ │
|
| 18 |
+
│ ┌───────────┐ ┌───────────┐ ┌───────────────────┐ │
|
| 19 |
+
│ │ Auth │ │ Postgres │ │ Row Level │ │
|
| 20 |
+
│ │ (JWT+OAuth)│ │ (Database)│ │ Security (RLS) │ │
|
| 21 |
+
│ └───────────┘ └───────────┘ └───────────────────┘ │
|
| 22 |
+
│ │
|
| 23 |
+
│ ┌───────────┐ ┌───────────┐ ┌───────────────────┐ │
|
| 24 |
+
│ │ Storage │ │ Edge │ │ Real-time │ │
|
| 25 |
+
│ │ (Files) │ │ Functions │ │ Subscriptions │ │
|
| 26 |
+
│ └───────────┘ └───────────┘ └───────────────────┘ │
|
| 27 |
+
└─────────────────────────────────────────────────────────┘
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Key Integration Points
|
| 31 |
+
|
| 32 |
+
### 1. Authentication (Web3 + Traditional)
|
| 33 |
+
- **JWT auth** via `supabase-auth` skill + `auth.py`
|
| 34 |
+
- **OAuth providers**: GitHub, Google (configured in `supabase_oauth_router.py`)
|
| 35 |
+
- **Wallet auth**: EVM + Solana wallet connection (non-custodial)
|
| 36 |
+
- **x402 trial tracking**: Device fingerprint + wallet-based quotas
|
| 37 |
+
|
| 38 |
+
### 2. Database (Postgres via Supabase)
|
| 39 |
+
- **User profiles**: `users` table with premium tiers, notification prefs
|
| 40 |
+
- **Intelligence data**: whale_movements, market_trending_tokens, scam_alerts
|
| 41 |
+
- **Content**: content posts, comments, upvotes, gamification events
|
| 42 |
+
- **x402 payments**: transaction logs, tool usage, trial tracking
|
| 43 |
+
- **Retention**: 90-day auto-cleanup for non-security data
|
| 44 |
+
|
| 45 |
+
### 3. RAG / Vector Store
|
| 46 |
+
- Redis-based vector store for crypto intelligence (`rag_service.py`)
|
| 47 |
+
- Lightweight SQLite+TF-IDF fallback (`rag_lightweight.py`)
|
| 48 |
+
- Collections: wallet_profiles, token_analysis, scam_patterns, forensic_reports, market_intel
|
| 49 |
+
- n8n workflow ingests news articles into RAG
|
| 50 |
+
|
| 51 |
+
### 4. Env Vars Required
|
| 52 |
+
```
|
| 53 |
+
SUPABASE_URL=https://<project>.supabase.co
|
| 54 |
+
SUPABASE_ANON_KEY=eyJh...
|
| 55 |
+
SUPABASE_SERVICE_KEY=eyJh...
|
| 56 |
+
SUPABASE_JWT_SECRET=...
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## MCP (Model Context Protocol) Integration
|
| 60 |
+
|
| 61 |
+
- **`/api/v1/x402/tools-catalog`** — Full MCP catalog of 51 (44 MCP + 7 bundles) tools
|
| 62 |
+
- **`app/mcp/x402_mcp_server.py`** — MCP server implementation
|
| 63 |
+
- **`app/mcp_router.py`** — Routes MCP tool calls to backend functions
|
| 64 |
+
- **GitHub repo**: `Rug-Munch-Media-LLC/rug-munch-intelligence-mcp` (public)
|
| 65 |
+
|
| 66 |
+
## x402 Payment Protocol
|
| 67 |
+
|
| 68 |
+
- **`/.well-known/x402`** — Protocol discovery document
|
| 69 |
+
- **7 chains**: Solana (Facilitator), Base (Facilitator), ETH/BSC/ARB/OPT/POL (Self-verify)
|
| 70 |
+
- **Trial**: 1 free call (no wallet), 3 free calls (with wallet)
|
| 71 |
+
- **Payment**: USDC micropayments via HTTP 402
|
| 72 |
+
- **Repos**: `x402-gateway-solana`, `x402-gateway-base`, `x402-twitter-view`
|
| 73 |
+
|
| 74 |
+
## AI-Forward Architecture
|
| 75 |
+
|
| 76 |
+
```
|
| 77 |
+
User Request → Backend API → Orchestrator (9 agents)
|
| 78 |
+
│ │
|
| 79 |
+
├── Supabase ├── Wallet clustering
|
| 80 |
+
├── Redis RAG ├── Scam detection
|
| 81 |
+
├── News Agg ├── Threat intel
|
| 82 |
+
└── x402 Gate └── Cross-chain analysis
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Web3 Best Practices Applied
|
| 86 |
+
- **Non-custodial**: No private keys stored server-side
|
| 87 |
+
- **RLS**: Row Level Security on all Supabase tables
|
| 88 |
+
- **Device fingerprinting**: Anti-abuse for trial system
|
| 89 |
+
- **On-chain verification**: Self-verify mode for 5 chains
|
| 90 |
+
- **Facilitator mode**: Cloudflare Workers for Base/Solana
|
backend/X402_ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# x402 Protocol — Complete System Architecture
|
| 2 |
+
## MUST READ for all future RMI developers
|
| 3 |
+
### Auto-audited: May 23, 2026 — 59 tools, 7 chains, all endpoints verified
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## SYSTEM OVERVIEW
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
INTERNET
|
| 11 |
+
│
|
| 12 |
+
▼
|
| 13 |
+
Cloudflare Tunnel (rmi-cloudflare)
|
| 14 |
+
┌─────────────────────────────┐
|
| 15 |
+
│ rugmunch.io │
|
| 16 |
+
│ mcp.rugmunch.io │
|
| 17 |
+
│ n8n.rugmunch.io │
|
| 18 |
+
└─────────────┬───────────────┘
|
| 19 |
+
│
|
| 20 |
+
┌─────────────▼───────────────┐
|
| 21 |
+
│ nginx (:80, :443) │
|
| 22 |
+
│ Routes: │
|
| 23 |
+
│ /api/* → :8000 │
|
| 24 |
+
│ /.well-known/* → :8000 │
|
| 25 |
+
│ /mcp/* → :8000 │
|
| 26 |
+
│ /health → :8000 │
|
| 27 |
+
│ / → static │
|
| 28 |
+
└─────────────┬───────────────┘
|
| 29 |
+
│
|
| 30 |
+
┌───────────────────┼───────────────────┐
|
| 31 |
+
│ │ │
|
| 32 |
+
▼ ▼ ▼
|
| 33 |
+
┌─────────┐ ┌──────────┐ ┌──────────┐
|
| 34 |
+
│ Backend │ │ Orchestrator│ │ n8n │
|
| 35 |
+
│ :8000 │ │ :8081 │ │ :5678 │
|
| 36 |
+
│ 59 tools│ │ 9 agents │ │ 2 flows │
|
| 37 |
+
└────┬────┘ └──────────┘ └──────────┘
|
| 38 |
+
│
|
| 39 |
+
┌────┼────────────────────┐
|
| 40 |
+
│ │ │
|
| 41 |
+
▼ ▼ ▼
|
| 42 |
+
┌──────┐ ┌──────┐ ┌──────────┐
|
| 43 |
+
│Redis │ │Supabase│ │ Langfuse │
|
| 44 |
+
│:6379 │ │ (API) │ │ :3100 │
|
| 45 |
+
└──────┘ └──────┘ └──────────┘
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## FILE MAP — Every x402 file and what it does
|
| 51 |
+
|
| 52 |
+
### Core Backend (Python/FastAPI)
|
| 53 |
+
|
| 54 |
+
| File | Lines | Purpose |
|
| 55 |
+
|------|-------|---------|
|
| 56 |
+
| `app/routers/x402_enforcement.py` | 1290 | **Payment gatekeeper** — intercepts all `/api/v1/x402-tools/*`, verifies x402 payment headers, enforces trials, builds 402 Payment Required responses. 7-chain support. |
|
| 57 |
+
| `app/routers/x402_tools.py` | 3581 | **Tool handlers** — 48 route implementations. Each `@router.post("/audit")` is a tool. Also serves AI framework adapters (OpenAI, Anthropic, Gemini, LangChain formats). |
|
| 58 |
+
| `app/routers/x402_catalog.py` | 255 | **Auto-discovery** — parses gateway index.ts files + scans route decorators. Builds unified catalog. No hardcoded tool lists. |
|
| 59 |
+
| `app/routers/x402_forensic_tools.py` | 237 | **Forensic bundles** — 3 premium tools: forensic_valuation, osint_identity_hunt, investigation_report |
|
| 60 |
+
| `app/routers/x402_dashboard.py` | 493 | **Analytics** — usage tracking, revenue per tool, top users, trial exhaustion stats |
|
| 61 |
+
| `app/routers/x402_middleware.py` | 685 | **Anti-abuse** — device fingerprinting, trial tracking per device/wallet, rate limiting |
|
| 62 |
+
| `app/mcp/x402_mcp_server.py` | 682 | **MCP protocol server** — translates x402 tools into MCP format for Claude/Cursor/Windsurf |
|
| 63 |
+
|
| 64 |
+
### Cloudflare Workers (TypeScript)
|
| 65 |
+
|
| 66 |
+
| File | Lines | Purpose |
|
| 67 |
+
|------|-------|---------|
|
| 68 |
+
| `x402-gateway/base/index.ts` | 2650 | **Base + EVM gateway** — Payment verification via PayAI facilitator. 44 tool definitions. Routes to backend. |
|
| 69 |
+
| `x402-gateway/solana/index.ts` | 2650 | **Solana gateway** — Payment verification via PayAI facilitator. 35 tool definitions. Routes to backend. |
|
| 70 |
+
| `x402-twitter-view/src/index.ts` | ~200 | **Twitter data worker** — profiles, timelines, search. Self-healing with failover. |
|
| 71 |
+
|
| 72 |
+
### GitHub Repos (public)
|
| 73 |
+
|
| 74 |
+
| Repo | Purpose |
|
| 75 |
+
|------|---------|
|
| 76 |
+
| `rug-munch-intelligence-mcp` | Public pip package. Thin MCP wrapper around x402 API. |
|
| 77 |
+
| `x402-gateway-solana` | Solana gateway source — deploys to Cloudflare Workers |
|
| 78 |
+
| `x402-gateway-base` | Base + EVM gateway source — deploys to Cloudflare Workers |
|
| 79 |
+
| `x402-twitter-view` | Twitter data worker source |
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## PAYMENT FLOW — Step by step
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
1. User/bot calls POST /api/v1/x402-tools/{tool}
|
| 87 |
+
│
|
| 88 |
+
2. x402_enforcement middleware intercepts
|
| 89 |
+
├── Check: Has user paid? (x-pay header with tx hash)
|
| 90 |
+
├── Check: Is trial available? (device fingerprint + wallet)
|
| 91 |
+
├── If unpaid AND no trials → build 402 Payment Required
|
| 92 |
+
│ └── Returns: payment addresses per chain, amounts, timeout
|
| 93 |
+
│
|
| 94 |
+
3. If paid or trial available → forward to tool handler
|
| 95 |
+
│
|
| 96 |
+
4. Tool handler (x402_tools.py) executes
|
| 97 |
+
├── Call backend connectors (Helius, Etherscan, DeFiLlama, etc.)
|
| 98 |
+
├── Aggregate multi-source data
|
| 99 |
+
└── Return JSON response
|
| 100 |
+
│
|
| 101 |
+
5. Payment verification (if paid):
|
| 102 |
+
├── Base/Solana → PayAI facilitator verifies USDC transfer
|
| 103 |
+
└── ETH/BSC/ARB/OPT/POL → Self-verify via Etherscan on-chain check
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
### Payment Addresses
|
| 107 |
+
- **All EVM chains**: `0x1E3AC01d0fdb976179790BDD02823196A92705C9`
|
| 108 |
+
- **Solana**: `Gix4P9AmwcZRGzr2hCEME5m2QAvY86dBfm8c7e7MpFzv`
|
| 109 |
+
- **Token**: USDC on all chains
|
| 110 |
+
- **Amounts**: $0.01 - $0.50 per tool (defined in gateway index.ts)
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## TOOL DISCOVERY — How the catalog works
|
| 115 |
+
|
| 116 |
+
```
|
| 117 |
+
MCP Catalog (/api/v1/x402/tools-catalog)
|
| 118 |
+
│
|
| 119 |
+
├── Step 1: parse_gateway_tools()
|
| 120 |
+
│ └── Reads x402-gateway/{base,solana}/index.ts
|
| 121 |
+
│ └── Regex extracts each tool from RMI_TOOLS object
|
| 122 |
+
│ └── Finds: name, description, price, category, trialFree, method
|
| 123 |
+
│ └── Result: 44 tools (22 unique to base, 0 unique to solana)
|
| 124 |
+
│
|
| 125 |
+
├── Step 2: discover_route_tools()
|
| 126 |
+
│ └── Scans x402_tools.py + x402_forensic_tools.py
|
| 127 |
+
│ └── Finds @router.get/post decorators
|
| 128 |
+
│ └── Extracts docstrings as descriptions
|
| 129 |
+
│ └── Result: 5 unique tools not in gateways
|
| 130 |
+
│
|
| 131 |
+
└── Step 3: Merge + Deduplicate
|
| 132 |
+
└── Same tool ID = merge chains
|
| 133 |
+
└── Result: 59 total tools
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
### Output formats
|
| 137 |
+
| Format | Endpoint | For |
|
| 138 |
+
|--------|----------|-----|
|
| 139 |
+
| Full catalog | `/api/v1/x402/tools-catalog` | Humans, dashboards |
|
| 140 |
+
| x402 protocol | `/.well-known/x402` | AI agents, protocol discovery |
|
| 141 |
+
| OpenAI | `/api/v1/x402-tools/openai-tools` | ChatGPT, OpenAI-compatible |
|
| 142 |
+
| Anthropic | `/api/v1/x402-tools/anthropic-tools` | Claude, Cursor |
|
| 143 |
+
| Gemini | `/api/v1/x402-tools/gemini-tools` | Google Gemini |
|
| 144 |
+
| LangChain | `/api/v1/x402-tools/langchain-tools` | LangChain agents |
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
## PRICING & TRIALS
|
| 149 |
+
|
| 150 |
+
| Tier | Calls | Requirement |
|
| 151 |
+
|------|-------|-------------|
|
| 152 |
+
| Anonymous | 1 free per tool | Device fingerprint |
|
| 153 |
+
| Wallet connected | 3 free per tool | MetaMask/Phantom |
|
| 154 |
+
| Paid | Unlimited | USDC payment per call |
|
| 155 |
+
|
| 156 |
+
**Refund**: Full refund if tool returns no data. POST `/api/v1/x402/refund` with tx hash within 48h.
|
| 157 |
+
|
| 158 |
+
**Anti-abuse**: Device fingerprinting survives VPN/incognito. Identity hierarchy: wallet > device_id > turnstile > fingerprint.
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
## CHAIN SUPPORT MATRIX
|
| 163 |
+
|
| 164 |
+
| Chain | Network ID | USDC Address | Verification |
|
| 165 |
+
|-------|-----------|-------------|--------------|
|
| 166 |
+
| Base | eip155:8453 | 0x833589...a02913 | PayAI facilitator |
|
| 167 |
+
| Solana | solana:5eykt4... | EPjFWdd5...TDt1v | PayAI facilitator |
|
| 168 |
+
| Ethereum | eip155:1 | 0xA0b869...eB48 | Self-verify |
|
| 169 |
+
| BSC | eip155:56 | 0x8AC76a...d580d | Self-verify |
|
| 170 |
+
| Arbitrum | eip155:42161 | 0xaf88d0...5831 | Self-verify |
|
| 171 |
+
| Optimism | eip155:10 | 0x0b2C63...Ff85 | Self-verify |
|
| 172 |
+
| Polygon | eip155:137 | 0x3c499c...3359 | Self-verify |
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## CONNECTOR APIS — What data we have
|
| 177 |
+
|
| 178 |
+
| Connector | API Key | Status | Used By |
|
| 179 |
+
|-----------|---------|--------|---------|
|
| 180 |
+
| Helius | ✅ Working | Solana RPC, webhooks, transactions | wallet, cluster, whale, forensics |
|
| 181 |
+
| Etherscan | ✅ Working | Contract source, ABI, TX history | contract_inspect, tx_decoder |
|
| 182 |
+
| DeFiLlama | 🆓 Free | TVL, protocols, yields | protocol_research, yield_scanner |
|
| 183 |
+
| Birdeye | ✅ Working | Trending, token data | trending_tokens |
|
| 184 |
+
| CoinGecko | ✅ Working | Prices, categories, trending | market_price, market_sectors |
|
| 185 |
+
| DexScreener | 🆓 Free | Pairs, liquidity, volume | dex_activity, market_price |
|
| 186 |
+
| Moralis | ❌ Key invalid | Multi-chain wallet/token data | NOT USED |
|
| 187 |
+
| GMGN | ❌ Access denied | KOL tracking, trending | NOT USED |
|
| 188 |
+
| Arkham | ⚠️ Untested | Entity labeling | NOT USED |
|
| 189 |
+
| Nansen | ⚠️ Untested | Smart money, token god mode | NOT USED |
|
| 190 |
+
| Dune | ⚠️ Untested | Custom queries | NOT USED |
|
| 191 |
+
|
| 192 |
+
---
|
| 193 |
+
|
| 194 |
+
## TESTING
|
| 195 |
+
|
| 196 |
+
```bash
|
| 197 |
+
# Test all 59 tools (expect 403 = x402 enforcement working):
|
| 198 |
+
bash /root/backend/scripts/test_all_tools.sh
|
| 199 |
+
|
| 200 |
+
# Status dashboard:
|
| 201 |
+
python3 /root/scripts/rmi-status
|
| 202 |
+
|
| 203 |
+
# Pre-commit check:
|
| 204 |
+
bash /root/backend/scripts/pre-commit.sh
|
| 205 |
+
```
|
| 206 |
+
|
| 207 |
+
---
|
| 208 |
+
|
| 209 |
+
## COMMON ISSUES & FIXES
|
| 210 |
+
|
| 211 |
+
| Issue | Symptom | Fix |
|
| 212 |
+
|-------|---------|-----|
|
| 213 |
+
| Gateway files missing | Catalog shows 0 tools | Clone gateways to `/root/backend/x402-gateway/` |
|
| 214 |
+
| Tool returns 403 | x402 enforcement active | Expected — tools require payment or trial |
|
| 215 |
+
| Catalog stale after adding tools | Old count | Restart backend: `docker restart rmi-backend` |
|
| 216 |
+
| Payment verification fails | 402 responses | Check USDC addresses, network config |
|
| 217 |
+
| Self-signed cert on external | curl fails without -k | Cloudflare provides edge cert — use -k or browser |
|
| 218 |
+
|
| 219 |
+
---
|
| 220 |
+
|
| 221 |
+
## WHEN ADDING NEW TOOLS
|
| 222 |
+
|
| 223 |
+
1. Add definition to `x402-gateway/base/index.ts` (and solana if applicable)
|
| 224 |
+
2. Add route handler to `x402_tools.py`:
|
| 225 |
+
```python
|
| 226 |
+
@router.post("/my_new_tool")
|
| 227 |
+
async def my_new_tool(req: SomeRequest):
|
| 228 |
+
"""Description of what this tool does."""
|
| 229 |
+
# Implementation using existing connectors
|
| 230 |
+
```
|
| 231 |
+
3. Restart backend: `docker restart rmi-backend`
|
| 232 |
+
4. Verify: `curl http://localhost:8000/api/v1/x402-tools/my_new_tool`
|
| 233 |
+
5. Check catalog auto-updated: `curl http://localhost:8000/api/v1/x402/tools-catalog`
|
backend/X_AUDIT_AND_STRATEGY.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CryptoRugMunch X (Twitter) Complete Audit & Strategy
|
| 2 |
+
## Generated: June 2, 2026
|
| 3 |
+
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
## ACCOUNT SNAPSHOT
|
| 7 |
+
|
| 8 |
+
| Metric | Value |
|
| 9 |
+
|--------|-------|
|
| 10 |
+
| Handle | @CryptoRugMunch |
|
| 11 |
+
| Display Name | Crypto Rug Muncher ✓ (verified) |
|
| 12 |
+
| Joined | March 23, 2024 |
|
| 13 |
+
| Followers | 66,699 |
|
| 14 |
+
| Following | 505 |
|
| 15 |
+
| Total Posts | ~14,395 |
|
| 16 |
+
| Bio | "Rug Munch Intelligence: Terminal for dev tracking, KOL rep cards, & deep token analysis" |
|
| 17 |
+
| Website | t.me/cryptorugmuncher |
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## COMPLETE TWEKE INVENTORY (Discovered)
|
| 22 |
+
|
| 23 |
+
### TIER 1: High-Performing Investigative Threads (50-158 likes)
|
| 24 |
+
|
| 25 |
+
| Date | ID | Topic | Est. Likes |
|
| 26 |
+
|------|----|-------|-----------|
|
| 27 |
+
| 2026-01-13 | 2011121865268273169 | 🚨 RUG PULL WARNING: $USOR bundled scam | 158 |
|
| 28 |
+
| 2026-03-13 | 2032249064440431012 | DavinciJeremie expose — "turned followers into exit liquidity" | 50 |
|
| 29 |
+
| 2026-02-23 | 2025778728123666684 | The Paid Shill Pipeline: How KOLs Get Rich (Pump.fun lawsuit) | 41 |
|
| 30 |
+
| 2026-01-22 | 2014168260812685576 | More bundled garbage: $USR playing off $USOR success | ~30 |
|
| 31 |
+
| 2025-03-15 | 1900961816672694749 | WallStreetBets + Hayden Davis scam connection | 74 |
|
| 32 |
+
| 2025-02-14 | 1890538027115503700 | $LIBRA deployer multiple rug pulls (GMGN data) | ~60 |
|
| 33 |
+
| 2025-02-04 | 1886805232878858528 | Finixio/Clickout Media presale scams list Feb 2025 | ~35 |
|
| 34 |
+
| 2024-12-24 | 1871615662814056757 | Results of typical Finixio/Clickout Media presale scam | 35 |
|
| 35 |
+
| 2024-12-22 | 1870863989946609894 | Removed $ALICE post after feedback, community accountability | ~20 |
|
| 36 |
+
|
| 37 |
+
### TIER 2: Product/Brand Announcements (10-31 likes)
|
| 38 |
+
|
| 39 |
+
| Date | ID | Topic |
|
| 40 |
+
|------|----|-------|
|
| 41 |
+
| 2026-02-15 | 2023164661852418141 | Chrome/Firefox web extensions launching this week |
|
| 42 |
+
| 2026-02-18 | 2024167740219462025 | Coinbase AgentKit plugin for Rug Intel risk checks (x402) |
|
| 43 |
+
| 2025-09-26 | 1971604084756218356 | $CRM token supply, distribution, and controls for CoinGecko |
|
| 44 |
+
| 2026-01-29 | 2016675199387914592 | Bringing on additional developer, reworking website |
|
| 45 |
+
| 2026-03-01 | 2038909240178536655 | V2 $CRM token relaunch plan (3-step: forensics, product, then token) |
|
| 46 |
+
| 2026-02-08 | 2020370336940806508 | $BEAM shilled by serial scammer warning |
|
| 47 |
+
| 2025-04-05 | 1908461438894821690 | Wallet warning — remove immediately |
|
| 48 |
+
| 2025-02-14 | 1890529174802096440 | $LIBRA / JMilei — 3 wallets control 80% of supply |
|
| 49 |
+
|
| 50 |
+
### TIER 3: Scam Warnings & Call-Outs (19-35 likes)
|
| 51 |
+
|
| 52 |
+
| Date | ID | Topic |
|
| 53 |
+
|------|----|-------|
|
| 54 |
+
| 2024-06-12 | 1800953406137209006 | $DOGEVERSE scam — reports of staking theft |
|
| 55 |
+
| 2024-06-16 | 1802326083338945012 | Presale scam analysis: countdown clock, promotional tactics |
|
| 56 |
+
| 2024-06-17 | 1802697920606552549 | YouTube shill promotion, undoxxed team |
|
| 57 |
+
| 2024-06-18 | 1803060093740617960 | Paid advertorials in major crypto news outlets |
|
| 58 |
+
| 2024-06-19 | 1803439240203710756 | Same team behind $DOGEVERSE, $SMOG, $SLOTH, $SEALANA |
|
| 59 |
+
| 2024-06-25 | 1805662250101076378 | $SEAL team = $SLOTH + $DOGEVERSE + $DOGE20 + $SMOG |
|
| 60 |
+
| 2024-06-28 | 1806730519129805187 | $TIME presale scam — founder Erdem Nazli promoting to 167k |
|
| 61 |
+
| 2024-07-18 | 1813973110216925618 | Another presale scam format |
|
| 62 |
+
| 2024-09-03 | 1830974957700153375 | Cabal's 2024 End-of-Year Party, $NEIRO |
|
| 63 |
+
| 2024-11-08 | 1854947038968045621 | BlockDAG — inflated numbers, likely to become biggest presale scam |
|
| 64 |
+
| 2024-12-12 | 1867248464414867620 | Pepe Unchained $PEPU at $500M mcap — skeptics proven right? |
|
| 65 |
+
| 2024-12-18 | 1869175591804846368 | Clickout Media / Finixio — can't stop scamming |
|
| 66 |
+
| 2024-12-18 | 1869391339923570852 | Related Clickout expose |
|
| 67 |
+
| 2025-01-16 | 1811452834162110886 | Scam analysis continuation |
|
| 68 |
+
| 2025-11-01 | 1984657092507005033 | D Poppin collaboration/profile |
|
| 69 |
+
|
| 70 |
+
### TIER 4: Community / Personal
|
| 71 |
+
|
| 72 |
+
| Date | ID | Topic |
|
| 73 |
+
|------|----|-------|
|
| 74 |
+
| 2024-06-19 | 1803520713695105516 | OnlyFans behind-the-scenes access announcement |
|
| 75 |
+
| 2024-06-18 | 1803119961226756139 | "Who has been here?" — engagement post (2337 views) |
|
| 76 |
+
| 2026-03 | 2042987696889696307 | "I hear all of you... the silence has been frustrating... I had to learn to code and build" |
|
| 77 |
+
| 2025-02-04 | 1886835371331174834 | Top "traders" of bundled $ALPHA |
|
| 78 |
+
| 2026-01-16 | 2011984602559365328 | "Verify everything before you buy" |
|
| 79 |
+
|
| 80 |
+
### PRODUCT & TECH MILESTONES
|
| 81 |
+
|
| 82 |
+
| Date | ID | Topic |
|
| 83 |
+
|------|----|-------|
|
| 84 |
+
| 2026-02-15 | 2023164661852418141 | Web extensions (Chrome + Firefox) launching |
|
| 85 |
+
| 2026-02-18 | 2024167740219462025 | Coinbase AgentKit plugin with x402 risk checks |
|
| 86 |
+
| 2025-09-26 | 1971604084756218356 | $CRM token supply/distribution documentation |
|
| 87 |
+
| 2026-03-01 | 2038909240178536655 | V2 $CRM relaunch (3-step: forensics public → product live → token relaunch) |
|
| 88 |
+
| ~2025 | GitHub | Rug Munch MCP server (19 tools for crypto risk intelligence) |
|
| 89 |
+
| ~2025 | HuggingFace | x402-gateway-solana (Solana payment gateway) |
|
| 90 |
+
| ~2025 | Phantom | Listed on Phantom App Store |
|
| 91 |
+
| ~2025 | RNWY / Smithery | MCP Server directory listing |
|
| 92 |
+
| ~2025 | DexScreener | KOL scanner integration |
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## CONTENT ANALYSIS BY CATEGORY
|
| 97 |
+
|
| 98 |
+
### Category Breakdown (% of discovered tweets)
|
| 99 |
+
|
| 100 |
+
| Category | % | Avg Likes | Quality |
|
| 101 |
+
|----------|---|-----------|---------|
|
| 102 |
+
| 🔍 Scam/Investigation Expose | 40% | 50-158 | HIGH — core value prop |
|
| 103 |
+
| 🚨 Rug Pull Warnings | 25% | 20-40 | MEDIUM — high volume, lower per-tweet impact |
|
| 104 |
+
| 🛠️ Product Announcements | 10% | 10-31 | LOW — poor product-to-engagement conversion |
|
| 105 |
+
| 🗣️ Community/Personal | 10% | 5-15 | LOW — but necessary for trust |
|
| 106 |
+
| 🔁 Thread Continuations | 15% | 5-20 | MEDIUM — follow-through is good |
|
| 107 |
+
|
| 108 |
+
### STRENGTHS
|
| 109 |
+
|
| 110 |
+
1. **Deep investigative work** — the KOL expose thread (41 likes), $LIBRA research, Finixio/Clickout series are genuinely valuable
|
| 111 |
+
2. **Consistent anti-scam voice** — never wavering from the core mission
|
| 112 |
+
3. **Real on-chain evidence** — citing GMGN, wallet data, transaction analysis
|
| 113 |
+
4. **Thread discipline** — most investigations are properly threaded with evidence
|
| 114 |
+
5. **Brand recognition** — 66K followers in crypto security niche is solid
|
| 115 |
+
|
| 116 |
+
### WEAKNESSES (Critical)
|
| 117 |
+
|
| 118 |
+
1. **POSTING FREQUENCY IS ERRATIC** — massive gaps (weeks/months of silence), then bursts. The "I hear you all" tweet from March 2026 acknowledges this directly.
|
| 119 |
+
|
| 120 |
+
2. **PRODUCT ANNOUNCEMENTS HAVE ZERO HYPE STRATEGY** — Chrome/Firefox extension launch got 31 likes. AgentKit got buried. These should be 500+ likes announcements. The gap between product capability and audience awareness is enormous.
|
| 121 |
+
|
| 122 |
+
3. **NO VISUAL BRANDING** — no consistent color scheme, no branded graphics, no template for warnings vs. investigations vs. announcements. Every top crypto security account uses branded templates.
|
| 123 |
+
|
| 124 |
+
4. **NO ENGAGEMENT FUNNEL** — 66K followers but average engagement is 20-80 likes. That's a 0.03-0.12% engagement rate. Crypto Twitter avg for this size is 0.5-2%. Something is deeply wrong.
|
| 125 |
+
|
| 126 |
+
5. **INCONSISTENT THREAD LENGTH** — some bangers are 1-tweet wonders, others are 15-part threads. No standard format.
|
| 127 |
+
|
| 128 |
+
6. **NO RECURRING CONTENT SERIES** — no "Scam of the Week", no daily digest, no regular format that builds habit.
|
| 129 |
+
|
| 130 |
+
7. **ONLYFANS STUNT** — the June 2024 OnlyFans post was engagement bait that confused the serious security brand. Never again.
|
| 131 |
+
|
| 132 |
+
8. **$CRM TOKEN MISHANDLING** — the token launch, then silence, then "V2 relaunch" 6 months later creates massive trust erosion. The 3-step plan is good but should have been communicated DURING the gap, not after.
|
| 133 |
+
|
| 134 |
+
9. **NO COLLABORATION STRATEGY** — zero threads tagging or quoting other security researchers (ZachXBT, Coffeezilla, etc.). Self-contained bubble.
|
| 135 |
+
|
| 136 |
+
10. **THREADBOLDS/FORMAT INCONSISTENCY** — mix of 🚨 emojis and plain text, no visual hierarchy standard.
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
## COMPETITIVE ANALYSIS vs TOP CRYPTO SECURITY ACCOUNTS
|
| 141 |
+
|
| 142 |
+
| Account | Followers | Avg Likes | Engagement Rate | Content Type |
|
| 143 |
+
|---------|-----------|-----------|----------------|-------------|
|
| 144 |
+
| @zabxXBT (ZachXBT) | 650K | 2,000-10,000 | 1.5-3% | Investigative threads |
|
| 145 |
+
| @Coffeezilla | 1.2M | 5,000-50,000 | 0.8-4% | Video + thread exposes |
|
| 146 |
+
| @lookonchain | 450K | 500-5,000 | 0.5-1.5% | On-chain data threads |
|
| 147 |
+
| @CryptoRugMunch | 66.7K | 20-158 | 0.03-0.24% | Scam warnings + investigations |
|
| 148 |
+
| @ape_scanner | 15K | 50-200 | 0.5-1.3% | Token security alerts |
|
| 149 |
+
|
| 150 |
+
**KEY INSIGHT**: RMI's engagement rate is 5-10x BELOW comparable accounts. The content quality is there but the distribution and format strategy is fundamentally broken.
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## ACTIONABLE IMPROVEMENTS
|
| 155 |
+
|
| 156 |
+
### 1. POSTING CADENCE (Critical)
|
| 157 |
+
- **Minimum 2 posts/day**: 1 morning alert, 1 evening analysis
|
| 158 |
+
- **1 major thread/week**: Deep investigation (Tuesday 2pm ET)
|
| 159 |
+
- **Daily scam digest**: Top 3-5 scams to avoid that day (morning, 8am ET)
|
| 160 |
+
- **Fill the silence gaps**: If building, post "building in public" updates weekly
|
| 161 |
+
|
| 162 |
+
### 2. VISUAL BRANDING STACK
|
| 163 |
+
- Create 3 branded templates:
|
| 164 |
+
- 🚨 RUG ALERT (red/black, high urgency)
|
| 165 |
+
- 🔍 INVESTIGATION (blue/white, analytical)
|
| 166 |
+
- 🛡️ PRODUCT NEWS (green/dark, positive)
|
| 167 |
+
- Use consistent header bars with RMI logo
|
| 168 |
+
- All threads start with a branded image/graphic
|
| 169 |
+
|
| 170 |
+
### 3. ENGAGEMENT FUNNEL
|
| 171 |
+
- End every thread with a CTA: "Scan any token free at cryptorugmunch.com"
|
| 172 |
+
- Quote-tweet other researchers (ZachXBT, Lookonchain) with added context
|
| 173 |
+
- Reply to every major scam news within 60 minutes
|
| 174 |
+
- Use polls 1x/week for engagement bait ("How many of you lost money to [scam type]?")
|
| 175 |
+
|
| 176 |
+
### 4. RECURRING SERIES (Builds Habit)
|
| 177 |
+
- **"Scam School" weekly thread**: Educational deep-dive into one scam technique
|
| 178 |
+
- **"Monday Munchies"**: Top 5 projects to avoid this week
|
| 179 |
+
- **"Whale Watch Wednesday"**: Following smart money / whale wallet movements
|
| 180 |
+
- **"Verification Friday"**: Legit projects that passed RMI's full scan
|
| 181 |
+
- **Monthly State of Scams**: Comprehensive monthly report (great for bookmarks)
|
| 182 |
+
|
| 183 |
+
### 5. PRODUCT LAUNCH PLAYBOOK
|
| 184 |
+
- **7-day teaser campaign** before any launch
|
| 185 |
+
- **Launch day**: Thread storm (5+ tweets), video walkthrough, CTA
|
| 186 |
+
- **48-hour follow-up**: Share user results/stats
|
| 187 |
+
- **Week after**: "What we built vs. what you asked for" thread
|
| 188 |
+
|
| 189 |
+
### 6. CROSS-PLATFORM AMPLIFICATION
|
| 190 |
+
- Mirror every thread to Telegram channel (existing)
|
| 191 |
+
- Create YouTube Shorts from top threads (60-sec summaries)
|
| 192 |
+
- Reddit posts in r/CryptoCurrency for major investigations
|
| 193 |
+
- Cross-post to Mirror/Medium for long-form
|
| 194 |
+
|
| 195 |
+
### 7. HASHTAG STRATEGY
|
| 196 |
+
- Primary: #RugMunch #RugAlert #CryptoSecurity
|
| 197 |
+
- Secondary: #ScamAlert #DeFiSafety #OnChain
|
| 198 |
+
- Campaign: #ScanFirst (our equivalent of #DYOR but specific to RMI)
|
| 199 |
+
|
| 200 |
+
### 8. COMMUNITY BUILDING
|
| 201 |
+
- Weekly AMAs on X Spaces
|
| 202 |
+
- Create a "RMI Verified" badge for projects that pass full scan
|
| 203 |
+
- Community reports: let users submit scams, credit them in posts
|
| 204 |
+
- Reward top community members with premium access
|
| 205 |
+
|
| 206 |
+
---
|
| 207 |
+
|
| 208 |
+
## ENGAGEMENT TARGETS (30/60/90 Day)
|
| 209 |
+
|
| 210 |
+
| Metric | Current | 30 Day | 60 Day | 90 Day |
|
| 211 |
+
|--------|---------|--------|--------|--------|
|
| 212 |
+
| Posts/week | ~2-3 | 14 | 14 | 14 |
|
| 213 |
+
| Avg likes/tweet | 30 | 80 | 150 | 250 |
|
| 214 |
+
| Engagement rate | 0.08% | 0.5% | 1.0% | 1.5% |
|
| 215 |
+
| Major threads/month | 1-2 | 4 | 6 | 8 |
|
| 216 |
+
| Thread avg likes | 50 | 200 | 400 | 600 |
|
| 217 |
+
| Followers | 66.7K | 70K | 78K | 90K |
|
| 218 |
+
|
| 219 |
+
This requires: consistent posting, visual branding, engagement funnel, and collaboration strategy as outlined above.
|
backend/_check_mcp.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from app.api.v1.mcp import router
|
| 2 |
+
print("MCP router loaded:", len(router.routes), "routes")
|
| 3 |
+
for r in router.routes:
|
| 4 |
+
print(" ", r.methods, r.path)
|
backend/app/api/v1/admin/alerts_webhook.py
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""V1 Admin alerts webhook — receives AlertManager notifications.
|
| 2 |
+
|
| 3 |
+
This is the HTTP bridge between Prometheus AlertManager and the RMI backend.
|
| 4 |
+
AlertManager POSTs JSON payloads here for two receivers:
|
| 5 |
+
- /api/v1/admin/alerts/webhook — default (all severities, from rmi-alerts receiver)
|
| 6 |
+
- /api/v1/admin/alerts/critical — critical only (from rmi-critical receiver)
|
| 7 |
+
|
| 8 |
+
Each handler:
|
| 9 |
+
1. Parses the AlertManager v2 webhook payload
|
| 10 |
+
2. Persists to Redis (sorted set, capped) for in-app display
|
| 11 |
+
3. Logs structured record (JSON, single line)
|
| 12 |
+
4. Returns 200 OK immediately so AlertManager doesn't retry
|
| 13 |
+
|
| 14 |
+
AlertManager webhook payload shape (Prometheus):
|
| 15 |
+
{
|
| 16 |
+
"version": "4",
|
| 17 |
+
"groupKey": "<strings>",
|
| 18 |
+
"status": "firing|resolved",
|
| 19 |
+
"receiver": "rmi-alerts",
|
| 20 |
+
"groupLabels": {"alertname": "...", ...},
|
| 21 |
+
"commonLabels": {...},
|
| 22 |
+
"commonAnnotations": {...},
|
| 23 |
+
"externalURL": "...",
|
| 24 |
+
"alerts": [
|
| 25 |
+
{
|
| 26 |
+
"status": "firing|resolved",
|
| 27 |
+
"labels": {...},
|
| 28 |
+
"annotations": {...},
|
| 29 |
+
"startsAt": "RFC3339",
|
| 30 |
+
"endsAt": "RFC3339",
|
| 31 |
+
"generatorURL": "..."
|
| 32 |
+
}
|
| 33 |
+
]
|
| 34 |
+
}
|
| 35 |
+
"""
|
| 36 |
+
from __future__ import annotations
|
| 37 |
+
|
| 38 |
+
import json
|
| 39 |
+
import logging
|
| 40 |
+
import os
|
| 41 |
+
import time
|
| 42 |
+
from typing import Any
|
| 43 |
+
|
| 44 |
+
from fastapi import APIRouter, Request
|
| 45 |
+
from pydantic import BaseModel, Field
|
| 46 |
+
|
| 47 |
+
logger = logging.getLogger("rmi.admin.alerts_webhook")
|
| 48 |
+
|
| 49 |
+
# Cap the in-Redis alert history so it doesn't grow unbounded.
|
| 50 |
+
_REDIS_CAP = int(os.getenv("RMI_ALERTS_HISTORY_CAP", "500"))
|
| 51 |
+
|
| 52 |
+
router = APIRouter(prefix="/api/v1/admin/alerts", tags=["admin-alerts"])
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class AlertmanagerAlert(BaseModel):
|
| 56 |
+
status: str
|
| 57 |
+
labels: dict[str, str] = Field(default_factory=dict)
|
| 58 |
+
annotations: dict[str, str] = Field(default_factory=dict)
|
| 59 |
+
startsAt: str | None = None
|
| 60 |
+
endsAt: str | None = None
|
| 61 |
+
generatorURL: str | None = None
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class AlertmanagerPayload(BaseModel):
|
| 65 |
+
version: str | None = None
|
| 66 |
+
groupKey: str | None = None
|
| 67 |
+
status: str
|
| 68 |
+
receiver: str | None = None
|
| 69 |
+
groupLabels: dict[str, str] = Field(default_factory=dict)
|
| 70 |
+
commonLabels: dict[str, str] = Field(default_factory=dict)
|
| 71 |
+
commonAnnotations: dict[str, str] = Field(default_factory=dict)
|
| 72 |
+
externalURL: str | None = None
|
| 73 |
+
alerts: list[AlertmanagerAlert] = Field(default_factory=list)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def _redis_url_from_env() -> str:
|
| 77 |
+
"""Build a Redis URL from discrete REDIS_HOST/PORT/DB/PASSWORD env vars.
|
| 78 |
+
|
| 79 |
+
Falls back to REDIS_URL if set, otherwise localhost. Returns a URL with
|
| 80 |
+
auth credentials embedded if REDIS_PASSWORD is set.
|
| 81 |
+
"""
|
| 82 |
+
explicit = os.getenv("REDIS_URL")
|
| 83 |
+
if explicit:
|
| 84 |
+
return explicit
|
| 85 |
+
host = os.getenv("REDIS_HOST", "localhost")
|
| 86 |
+
port = os.getenv("REDIS_PORT", "6379")
|
| 87 |
+
db = os.getenv("REDIS_DB", "0")
|
| 88 |
+
password = os.getenv("REDIS_PASSWORD", "")
|
| 89 |
+
if password:
|
| 90 |
+
return f"redis://:{password}@{host}:{port}/{db}"
|
| 91 |
+
return f"redis://{host}:{port}/{db}"
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def _redis_client():
|
| 95 |
+
"""Lazy Redis import — avoids forcing a Redis dep at module load."""
|
| 96 |
+
try:
|
| 97 |
+
import redis.asyncio as redis_async # type: ignore
|
| 98 |
+
|
| 99 |
+
url = _redis_url_from_env()
|
| 100 |
+
return redis_async.from_url(url, decode_responses=True)
|
| 101 |
+
except Exception as exc: # pragma: no cover - degraded mode
|
| 102 |
+
logger.warning("redis_unavailable", extra={"err": str(exc)})
|
| 103 |
+
return None
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
async def _persist_to_redis(payload: AlertmanagerPayload, severity: str) -> int:
|
| 107 |
+
"""Push payload to Redis sorted set capped at _REDIS_CAP entries.
|
| 108 |
+
|
| 109 |
+
Returns number of alerts persisted (0 if Redis is down).
|
| 110 |
+
"""
|
| 111 |
+
client = _redis_client()
|
| 112 |
+
if client is None:
|
| 113 |
+
return 0
|
| 114 |
+
try:
|
| 115 |
+
score = time.time()
|
| 116 |
+
record = json.dumps(
|
| 117 |
+
{
|
| 118 |
+
"received_at": score,
|
| 119 |
+
"severity_bucket": severity,
|
| 120 |
+
"receiver": payload.receiver,
|
| 121 |
+
"status": payload.status,
|
| 122 |
+
"group_labels": payload.groupLabels,
|
| 123 |
+
"common_labels": payload.commonLabels,
|
| 124 |
+
"common_annotations": payload.commonAnnotations,
|
| 125 |
+
"alerts": [a.model_dump() for a in payload.alerts],
|
| 126 |
+
},
|
| 127 |
+
default=str,
|
| 128 |
+
)
|
| 129 |
+
key = "rmi:alerts:webhook"
|
| 130 |
+
async with client.pipeline(transaction=False) as pipe:
|
| 131 |
+
pipe.zadd(key, {record: score})
|
| 132 |
+
pipe.zremrangebyrank(key, 0, -(_REDIS_CAP + 1))
|
| 133 |
+
pipe.expire(key, 7 * 24 * 3600) # 7 days
|
| 134 |
+
await pipe.execute()
|
| 135 |
+
return len(payload.alerts)
|
| 136 |
+
except Exception as exc:
|
| 137 |
+
logger.warning("redis_persist_failed", extra={"err": str(exc)})
|
| 138 |
+
return 0
|
| 139 |
+
finally:
|
| 140 |
+
try:
|
| 141 |
+
await client.aclose()
|
| 142 |
+
except Exception:
|
| 143 |
+
pass
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def _log_payload(payload: AlertmanagerPayload, severity: str, persisted: int) -> None:
|
| 147 |
+
"""Single-line JSON log so log aggregators can index cleanly."""
|
| 148 |
+
record = {
|
| 149 |
+
"ts": time.time(),
|
| 150 |
+
"event": "alertmanager_webhook",
|
| 151 |
+
"severity_bucket": severity,
|
| 152 |
+
"receiver": payload.receiver,
|
| 153 |
+
"status": payload.status,
|
| 154 |
+
"alert_count": len(payload.alerts),
|
| 155 |
+
"persisted": persisted,
|
| 156 |
+
"alertname": payload.groupLabels.get("alertname"),
|
| 157 |
+
"common_labels": payload.commonLabels,
|
| 158 |
+
}
|
| 159 |
+
logger.info(json.dumps(record, default=str))
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
@router.post("/webhook", status_code=200)
|
| 163 |
+
async def alerts_webhook(payload: AlertmanagerPayload, request: Request) -> dict[str, Any]:
|
| 164 |
+
"""Default receiver webhook — all severities."""
|
| 165 |
+
severity = payload.commonLabels.get("severity", "unknown")
|
| 166 |
+
persisted = await _persist_to_redis(payload, severity)
|
| 167 |
+
_log_payload(payload, severity, persisted)
|
| 168 |
+
return {
|
| 169 |
+
"ok": True,
|
| 170 |
+
"received": len(payload.alerts),
|
| 171 |
+
"persisted": persisted,
|
| 172 |
+
"severity": severity,
|
| 173 |
+
"alertname": payload.groupLabels.get("alertname"),
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
@router.post("/critical", status_code=200)
|
| 178 |
+
async def alerts_critical_webhook(
|
| 179 |
+
payload: AlertmanagerPayload, request: Request
|
| 180 |
+
) -> dict[str, Any]:
|
| 181 |
+
"""Critical-only webhook — escalations only (severity=critical)."""
|
| 182 |
+
# Defensive: if someone misroutes a non-critical here, log and accept
|
| 183 |
+
# (we don't want to lose data). Severity bucket stays "critical" because
|
| 184 |
+
# the receiver name implies it.
|
| 185 |
+
severity = "critical"
|
| 186 |
+
persisted = await _persist_to_redis(payload, severity)
|
| 187 |
+
_log_payload(payload, severity, persisted)
|
| 188 |
+
return {
|
| 189 |
+
"ok": True,
|
| 190 |
+
"received": len(payload.alerts),
|
| 191 |
+
"persisted": persisted,
|
| 192 |
+
"severity": severity,
|
| 193 |
+
"alertname": payload.groupLabels.get("alertname"),
|
| 194 |
+
"bucket": "critical",
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
@router.get("/recent", status_code=200)
|
| 199 |
+
async def alerts_recent(limit: int = 50) -> dict[str, Any]:
|
| 200 |
+
"""Read recent alerts (debug endpoint — admin only in production)."""
|
| 201 |
+
client = _redis_client()
|
| 202 |
+
if client is None:
|
| 203 |
+
return {"ok": False, "error": "redis_unavailable", "items": []}
|
| 204 |
+
try:
|
| 205 |
+
# Newest first
|
| 206 |
+
raw = await client.zrevrange("rmi:alerts:webhook", 0, max(0, limit - 1))
|
| 207 |
+
items = [json.loads(r) for r in raw]
|
| 208 |
+
return {"ok": True, "count": len(items), "items": items}
|
| 209 |
+
except Exception as exc:
|
| 210 |
+
return {"ok": False, "error": str(exc), "items": []}
|
| 211 |
+
finally:
|
| 212 |
+
try:
|
| 213 |
+
await client.aclose()
|
| 214 |
+
except Exception:
|
| 215 |
+
pass
|
backend/app/catalog/reputation.py
CHANGED
|
@@ -1,15 +1,27 @@
|
|
| 1 |
-
"""
|
| 2 |
|
| 3 |
-
Per
|
|
|
|
| 4 |
|
| 5 |
-
The score is
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"""
|
| 9 |
from __future__ import annotations
|
| 10 |
|
| 11 |
import logging
|
| 12 |
-
import
|
| 13 |
from datetime import datetime, UTC
|
| 14 |
|
| 15 |
from app.catalog.models import Deployer, utcnow
|
|
@@ -17,103 +29,151 @@ from app.catalog.models import Deployer, utcnow
|
|
| 17 |
log = logging.getLogger(__name__)
|
| 18 |
|
| 19 |
|
| 20 |
-
# ──
|
| 21 |
-
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"volume_threshold_usd": 1_000_000,
|
| 30 |
-
"news_penalty": 15, # -15 if avg news sentiment < -0.3
|
| 31 |
-
"news_bonus": 10, # +10 if avg news sentiment > 0.3
|
| 32 |
-
"news_window_hours": 720, # 30 days
|
| 33 |
-
"rag_penalty": 20, # -20 per high-confidence RAG finding
|
| 34 |
-
"rag_penalty_cap": 60,
|
| 35 |
-
"rag_min_confidence": 0.7,
|
| 36 |
}
|
| 37 |
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
catalog: "CatalogService", # forward ref — avoids circular import
|
| 42 |
-
) -> int:
|
| 43 |
-
"""Compute 0-100 reputation score. Pure function of inputs.
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
"""
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
if catalog._health.redis:
|
| 49 |
try:
|
| 50 |
cached = await catalog._redis.get(cache_key)
|
| 51 |
if cached:
|
| 52 |
-
|
|
|
|
| 53 |
except Exception:
|
| 54 |
pass
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
deployments = len(deployer.deployments)
|
| 60 |
-
score += min(deployments * WEIGHTS["experience_bonus_per_deploy"], WEIGHTS["experience_bonus_cap"])
|
| 61 |
-
|
| 62 |
-
# Rug penalty (dominant)
|
| 63 |
-
score -= min(deployer.rug_count * WEIGHTS["rug_penalty"], WEIGHTS["rug_penalty_cap"])
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
-
#
|
| 71 |
-
|
| 72 |
-
score += WEIGHTS["volume_bonus"]
|
| 73 |
-
|
| 74 |
-
# News sentiment (if Postgres is reachable)
|
| 75 |
if catalog._health.postgres:
|
| 76 |
try:
|
| 77 |
async with catalog._pg_pool.acquire() as conn:
|
| 78 |
rows = await conn.fetch(
|
| 79 |
-
"SELECT sentiment_score FROM news_items
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
deployer.wallet_id,
|
|
|
|
| 84 |
)
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
score += WEIGHTS["news_bonus"]
|
| 93 |
except Exception as e:
|
| 94 |
log.debug("reputation_news_fail: %s", e)
|
| 95 |
|
| 96 |
-
#
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
if catalog._health.redis:
|
| 114 |
try:
|
| 115 |
-
|
|
|
|
| 116 |
except Exception:
|
| 117 |
pass
|
| 118 |
|
| 119 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""T01 — Bayesian Deployer Reputation System.
|
| 2 |
|
| 3 |
+
Per MINIMAX_M3_TASKS.md T01. Beta-Binomial posterior replaces the
|
| 4 |
+
weighted-sum that conflated probabilities with volumes.
|
| 5 |
|
| 6 |
+
The legacy 0-100 score is kept for backward compatibility (every
|
| 7 |
+
existing consumer reads it). The new authoritative output is:
|
| 8 |
+
probability — P(rug) = alpha / (alpha + beta)
|
| 9 |
+
credible_interval_95 — 95% Bayesian CI from Beta distribution
|
| 10 |
+
observations — {successes, failures, total}
|
| 11 |
+
|
| 12 |
+
We start with a uniform prior Beta(1,1). Each rug increments beta.
|
| 13 |
+
Each legitimate deployment increments alpha. News sentiment < -0.3
|
| 14 |
+
adds 2 to beta (pessimistic prior). News sentiment > 0.3 adds 2 to
|
| 15 |
+
alpha (optimistic prior). Age and volume are logged but not folded
|
| 16 |
+
into the prior (they are orthogonal signals, not evidence).
|
| 17 |
+
|
| 18 |
+
The legacy 0-100 score is derived deterministically from probability:
|
| 19 |
+
score = round((1 - probability) * 100)
|
| 20 |
"""
|
| 21 |
from __future__ import annotations
|
| 22 |
|
| 23 |
import logging
|
| 24 |
+
import math
|
| 25 |
from datetime import datetime, UTC
|
| 26 |
|
| 27 |
from app.catalog.models import Deployer, utcnow
|
|
|
|
| 29 |
log = logging.getLogger(__name__)
|
| 30 |
|
| 31 |
|
| 32 |
+
# ── Prior adjustments (Bayesian update weights) ────────────────
|
| 33 |
+
PRIOR_WEIGHTS: dict[str, int] = {
|
| 34 |
+
"prior_alpha": 1, # Beta(1,1) = uniform prior
|
| 35 |
+
"prior_beta": 1,
|
| 36 |
+
"news_pessimistic_shift": 2, # +2 to beta if avg sentiment < -0.3
|
| 37 |
+
"news_optimistic_shift": 2, # +2 to alpha if avg sentiment > 0.3
|
| 38 |
+
"news_window_hours": 720, # 30 days
|
| 39 |
+
"news_negative_threshold": -0.3,
|
| 40 |
+
"news_positive_threshold": 0.3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
}
|
| 42 |
|
| 43 |
|
| 44 |
+
def _beta_credible_interval_95(alpha: float, beta: float) -> tuple[float, float]:
|
| 45 |
+
"""Approximate 95% credible interval for Beta(alpha, beta).
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
Uses the normal approximation to the Beta distribution, which is
|
| 48 |
+
accurate for alpha+beta > 30 (our regime: typically dozens of
|
| 49 |
+
observations per deployer). For low-observation regimes, falls back
|
| 50 |
+
to a wider quantile-based interval.
|
| 51 |
"""
|
| 52 |
+
n = alpha + beta
|
| 53 |
+
if n <= 0:
|
| 54 |
+
return (0.0, 1.0)
|
| 55 |
+
if n < 30:
|
| 56 |
+
# Wider interval for low-data regime
|
| 57 |
+
mean = alpha / n
|
| 58 |
+
var = (alpha * beta) / (n * n * (n + 1))
|
| 59 |
+
sd = math.sqrt(var)
|
| 60 |
+
# Use 1.96 but clamp to [0,1]
|
| 61 |
+
lo = max(0.0, mean - 1.96 * sd)
|
| 62 |
+
hi = min(1.0, mean + 1.96 * sd)
|
| 63 |
+
return (lo, hi)
|
| 64 |
+
# High-data regime: tighter interval
|
| 65 |
+
mean = alpha / n
|
| 66 |
+
var = (alpha * beta) / (n * n * (n + 1))
|
| 67 |
+
sd = math.sqrt(var)
|
| 68 |
+
lo = max(0.0, mean - 1.96 * sd)
|
| 69 |
+
hi = min(1.0, mean + 1.96 * sd)
|
| 70 |
+
return (lo, hi)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
async def compute_deployer_posterior(
|
| 74 |
+
deployer: Deployer,
|
| 75 |
+
catalog: "CatalogService",
|
| 76 |
+
) -> dict:
|
| 77 |
+
"""Compute Bayesian reputation for a deployer.
|
| 78 |
+
|
| 79 |
+
Returns:
|
| 80 |
+
{
|
| 81 |
+
"probability": float, # P(rug), 0..1
|
| 82 |
+
"credible_interval_95": [lo, hi], # 95% Bayesian CI
|
| 83 |
+
"observations": {
|
| 84 |
+
"rugs": int, "legit": int, "total": int,
|
| 85 |
+
"alpha": float, "beta": float,
|
| 86 |
+
},
|
| 87 |
+
"news_sentiment": float | None, # -1..+1 if available
|
| 88 |
+
"score": int, # legacy 0-100 (backward compat)
|
| 89 |
+
"computed_at": str, # ISO8601
|
| 90 |
+
}
|
| 91 |
+
"""
|
| 92 |
+
cache_key = f"catalog:deployer_rep:v2:{deployer.wallet_id}"
|
| 93 |
if catalog._health.redis:
|
| 94 |
try:
|
| 95 |
cached = await catalog._redis.get(cache_key)
|
| 96 |
if cached:
|
| 97 |
+
import json as _json
|
| 98 |
+
return _json.loads(cached)
|
| 99 |
except Exception:
|
| 100 |
pass
|
| 101 |
|
| 102 |
+
# ── Update prior from observations ──
|
| 103 |
+
alpha = float(PRIOR_WEIGHTS["prior_alpha"])
|
| 104 |
+
beta = float(PRIOR_WEIGHTS["prior_beta"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
+
rugs = max(0, deployer.rug_count)
|
| 107 |
+
legit = max(0, len(deployer.deployments) - rugs)
|
| 108 |
+
alpha += legit
|
| 109 |
+
beta += rugs
|
| 110 |
|
| 111 |
+
# ── News sentiment prior adjustment ──
|
| 112 |
+
news_sentiment = None
|
|
|
|
|
|
|
|
|
|
| 113 |
if catalog._health.postgres:
|
| 114 |
try:
|
| 115 |
async with catalog._pg_pool.acquire() as conn:
|
| 116 |
rows = await conn.fetch(
|
| 117 |
+
"""SELECT sentiment_score FROM news_items
|
| 118 |
+
WHERE $1 = ANY(wallets_mentioned)
|
| 119 |
+
AND published_at > NOW() - make_interval(hours => $2)
|
| 120 |
+
LIMIT 20""",
|
| 121 |
deployer.wallet_id,
|
| 122 |
+
PRIOR_WEIGHTS["news_window_hours"],
|
| 123 |
)
|
| 124 |
+
scores = [r["sentiment_score"] for r in rows if r["sentiment_score"] is not None]
|
| 125 |
+
if scores:
|
| 126 |
+
news_sentiment = sum(scores) / len(scores)
|
| 127 |
+
if news_sentiment < PRIOR_WEIGHTS["news_negative_threshold"]:
|
| 128 |
+
beta += PRIOR_WEIGHTS["news_pessimistic_shift"]
|
| 129 |
+
elif news_sentiment > PRIOR_WEIGHTS["news_positive_threshold"]:
|
| 130 |
+
alpha += PRIOR_WEIGHTS["news_optimistic_shift"]
|
|
|
|
| 131 |
except Exception as e:
|
| 132 |
log.debug("reputation_news_fail: %s", e)
|
| 133 |
|
| 134 |
+
# ── Posterior ──
|
| 135 |
+
total = alpha + beta
|
| 136 |
+
probability = alpha / total if total > 0 else 0.5
|
| 137 |
+
lo, hi = _beta_credible_interval_95(alpha, beta)
|
| 138 |
+
|
| 139 |
+
result = {
|
| 140 |
+
"probability": round(probability, 4),
|
| 141 |
+
"credible_interval_95": [round(lo, 4), round(hi, 4)],
|
| 142 |
+
"observations": {
|
| 143 |
+
"rugs": int(rugs),
|
| 144 |
+
"legit": int(legit),
|
| 145 |
+
"total": int(deployer.total_volume_usd and len(deployer.deployments) or 0),
|
| 146 |
+
"alpha": alpha,
|
| 147 |
+
"beta": beta,
|
| 148 |
+
},
|
| 149 |
+
"news_sentiment": round(news_sentiment, 4) if news_sentiment is not None else None,
|
| 150 |
+
# Legacy 0-100 score: probability of legitness scaled to 0..100
|
| 151 |
+
# probability = P(rug), so legitness = 1 - probability
|
| 152 |
+
"score": int(round((1.0 - probability) * 100)),
|
| 153 |
+
"computed_at": utcnow().isoformat(),
|
| 154 |
+
}
|
| 155 |
|
| 156 |
if catalog._health.redis:
|
| 157 |
try:
|
| 158 |
+
import json as _json
|
| 159 |
+
await catalog._redis.setex(cache_key, 3600, _json.dumps(result))
|
| 160 |
except Exception:
|
| 161 |
pass
|
| 162 |
|
| 163 |
+
return result
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
# ── Backward-compatible wrapper (returns just the int score) ──
|
| 167 |
+
|
| 168 |
+
async def compute_deployer_reputation(
|
| 169 |
+
deployer: Deployer,
|
| 170 |
+
catalog: "CatalogService",
|
| 171 |
+
) -> int:
|
| 172 |
+
"""Legacy 0-100 reputation score.
|
| 173 |
+
|
| 174 |
+
Returns the integer score derived from the Bayesian posterior.
|
| 175 |
+
New code should call compute_deployer_posterior() directly for the
|
| 176 |
+
full probability + CI.
|
| 177 |
+
"""
|
| 178 |
+
posterior = await compute_deployer_posterior(deployer, catalog)
|
| 179 |
+
return posterior["score"]
|
backend/app/homepage.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""RMI Backend — root endpoints (homepage, health, version, MCP discoverability).
|
| 2 |
+
|
| 3 |
+
T33-SDK foundation: a single GET / endpoint that lists all available
|
| 4 |
+
endpoints in human-readable form. AI agents can discover what the
|
| 5 |
+
platform offers before committing to a tool call.
|
| 6 |
+
"""
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
from fastapi import APIRouter
|
| 10 |
+
from fastapi.responses import HTMLResponse, JSONResponse
|
| 11 |
+
|
| 12 |
+
router = APIRouter(tags=["meta"])
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
HOMEPAGE_HTML = """<!DOCTYPE html>
|
| 16 |
+
<html lang="en">
|
| 17 |
+
<head>
|
| 18 |
+
<meta charset="UTF-8">
|
| 19 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 20 |
+
<title>RugMunch Intelligence — API</title>
|
| 21 |
+
<style>
|
| 22 |
+
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
| 23 |
+
max-width: 1100px; margin: 0 auto; padding: 2rem; background: #0a0a0a; color: #e0e0e0; }
|
| 24 |
+
h1 { color: #f0a030; border-bottom: 1px solid #2a2a2a; padding-bottom: 0.5rem; }
|
| 25 |
+
h2 { color: #6cf; margin-top: 2rem; }
|
| 26 |
+
a { color: #6cf; text-decoration: none; }
|
| 27 |
+
a:hover { text-decoration: underline; }
|
| 28 |
+
.endpoint { background: #161616; padding: 0.5rem 0.8rem; margin: 0.3rem 0;
|
| 29 |
+
border-radius: 4px; font-family: "SF Mono", "Consolas", monospace;
|
| 30 |
+
font-size: 0.9rem; }
|
| 31 |
+
.method { display: inline-block; min-width: 50px; padding: 0.1rem 0.4rem;
|
| 32 |
+
border-radius: 3px; font-weight: bold; font-size: 0.8rem; }
|
| 33 |
+
.get { background: #1a3a1a; color: #6f6; }
|
| 34 |
+
.post { background: #1a2a3a; color: #6cf; }
|
| 35 |
+
.put { background: #3a2a1a; color: #fa0; }
|
| 36 |
+
.delete { background: #3a1a1a; color: #f66; }
|
| 37 |
+
.tag { display: inline-block; background: #2a2a2a; padding: 0.1rem 0.4rem;
|
| 38 |
+
border-radius: 3px; font-size: 0.75rem; margin-left: 0.4rem; }
|
| 39 |
+
.section { background: #1a1a1a; padding: 1rem 1.2rem; border-radius: 6px;
|
| 40 |
+
border-left: 3px solid #f0a030; margin: 1rem 0; }
|
| 41 |
+
.metric { display: inline-block; background: #0a0a0a; padding: 0.5rem 1rem;
|
| 42 |
+
border-radius: 4px; margin: 0.2rem; }
|
| 43 |
+
</style>
|
| 44 |
+
</head>
|
| 45 |
+
<body>
|
| 46 |
+
<h1>🛡️ RugMunch Intelligence — API v4.0</h1>
|
| 47 |
+
<p>13+ chains · 96 data providers · 8 MCP tools · x402 paid tier · sovereign-first FOSS</p>
|
| 48 |
+
|
| 49 |
+
<div class="section">
|
| 50 |
+
<h2>Quickstart</h2>
|
| 51 |
+
<p><b>Swagger UI:</b> <a href="/docs">/docs</a> · <b>ReDoc:</b> <a href="/redoc">/redoc</a> · <b>OpenAPI JSON:</b> <a href="/openapi.json">/openapi.json</a></p>
|
| 52 |
+
<p><b>Health:</b> <a href="/health">/health</a> · <b>Readiness:</b> <a href="/ready">/ready</a> · <b>Metrics:</b> <a href="/metrics">/metrics</a></p>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
<div class="section">
|
| 56 |
+
<h2>Discover the platform</h2>
|
| 57 |
+
<p><a href="/mcp/tools">/mcp/tools</a> — 8 MCP tools for AI agents (Claude Desktop, Cursor, Continue.dev)</p>
|
| 58 |
+
<p><a href="/api/v1/x402/catalog">/api/v1/x402/catalog</a> — paid tool catalog with pricing tiers</p>
|
| 59 |
+
<p><a href="/api/v1/catalog/probe">/api/v1/catalog/probe</a> — which data stores are reachable</p>
|
| 60 |
+
<p><a href="/api/v1/catalog/stats">/api/v1/catalog/stats</a> — token/wallet/news counts across 6 stores</p>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<div class="section">
|
| 64 |
+
<h2>Key endpoints (by domain)</h2>
|
| 65 |
+
<p class="metric"><span class="method get">GET</span> /api/v1/news/trending</p>
|
| 66 |
+
<p class="metric"><span class="method get">GET</span> /api/v1/rag/v2/search</p>
|
| 67 |
+
<p class="metric"><span class="method post">POST</span> /api/v1/reports/generate</p>
|
| 68 |
+
<p class="metric"><span class="method post">POST</span> /mcp</p>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<div class="section">
|
| 72 |
+
<h2>For AI agents (MCP)</h2>
|
| 73 |
+
<pre>// Claude Desktop config (~/.config/claude/claude_desktop_config.json)
|
| 74 |
+
{
|
| 75 |
+
"mcpServers": {
|
| 76 |
+
"rugmunch": {
|
| 77 |
+
"url": "http://localhost:8000/mcp",
|
| 78 |
+
"transport": "streamable-http"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}</pre>
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<div class="section">
|
| 85 |
+
<h2>Repositories</h2>
|
| 86 |
+
<p>GitHub: <a href="https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp">github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp</a></p>
|
| 87 |
+
<p>HuggingFace: <a href="https://huggingface.co/cryptorugmunch/rug-munch-intelligence">huggingface.co/cryptorugmunch/rug-munch-intelligence</a></p>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
</body>
|
| 91 |
+
</html>
|
| 92 |
+
"""
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
@router.get("/", response_class=HTMLResponse, include_in_schema=False)
|
| 96 |
+
async def homepage() -> HTMLResponse:
|
| 97 |
+
"""Human-readable homepage listing key endpoints."""
|
| 98 |
+
return HTMLResponse(content=HOMEPAGE_HTML)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
@router.get("/version")
|
| 102 |
+
async def version() -> dict:
|
| 103 |
+
"""Backend version + git info."""
|
| 104 |
+
import os
|
| 105 |
+
import subprocess
|
| 106 |
+
sha = "unknown"
|
| 107 |
+
try:
|
| 108 |
+
sha = subprocess.check_output(
|
| 109 |
+
["git", "rev-parse", "--short", "HEAD"],
|
| 110 |
+
cwd=os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
|
| 111 |
+
stderr=subprocess.DEVNULL,
|
| 112 |
+
).decode().strip()
|
| 113 |
+
except Exception:
|
| 114 |
+
pass
|
| 115 |
+
return {
|
| 116 |
+
"service": "rmi-backend",
|
| 117 |
+
"version": "2026.06.21",
|
| 118 |
+
"deploy_mode": "new-system (no _legacy_main)",
|
| 119 |
+
"git_sha": sha,
|
| 120 |
+
}
|
backend/docs/15-final-improvements.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI 2026 — 15 Final Improvements Before Frontend Push
|
| 2 |
+
# Complete AI Crypto Intelligence Platform
|
| 3 |
+
|
| 4 |
+
## TIER 1 — Consumer-Facing (Week 1)
|
| 5 |
+
|
| 6 |
+
### 1. Dify Chat Widget on rugmunch.io
|
| 7 |
+
Embed the RMI Crypto Expert as the homepage hero. Floating chat bubble bottom-right.
|
| 8 |
+
Single `<script>` tag embed. Dark theme, RMI branding.
|
| 9 |
+
**Impact:** Instant AI engagement. Users ask "is this token safe?" directly.
|
| 10 |
+
**Depends on:** Dify deployed ✅, 15 tools built ✅
|
| 11 |
+
|
| 12 |
+
### 2. Real-Time WebSocket Price Feed
|
| 13 |
+
Replace polling with persistent WS connections. `wss://rugmunch.io/ws/prices`
|
| 14 |
+
Solana, Ethereum, BSC top 100 tokens. Sub-100ms latency via DataBus cache.
|
| 15 |
+
**Impact:** Frontend feels instant. Professional trading terminal vibe.
|
| 16 |
+
**Depends on:** DataBus WebSocket ✅, Caddy reverse proxy
|
| 17 |
+
|
| 18 |
+
### 3. Automated Signal Generation
|
| 19 |
+
Cron: SENTINEL scan → score < 30 → "avoid" signal. Score > 80 + low cap → "gem" signal.
|
| 20 |
+
Publish to Telegram + websocket + email. Users subscribe to signal tiers.
|
| 21 |
+
**Impact:** Recurring revenue. "RMI Signals" = $19.99/mo premium feature.
|
| 22 |
+
**Depends on:** SENTINEL ✅, Redpanda ✅
|
| 23 |
+
|
| 24 |
+
### 4. Usage-Based Billing (x402 + Stripe)
|
| 25 |
+
Free: 100 API calls/day. Pro: $19.99/mo unlimited. Enterprise: custom.
|
| 26 |
+
Stripe for fiat, x402 for crypto. Usage tracked via Langfuse metrics.
|
| 27 |
+
**Impact:** Monetization engine. Every API call = revenue.
|
| 28 |
+
**Depends on:** x402 ✅, cost tracker ✅
|
| 29 |
+
|
| 30 |
+
## TIER 2 — Intelligence (Week 2)
|
| 31 |
+
|
| 32 |
+
### 5. Social Sentiment Pipeline
|
| 33 |
+
Ingest X/Twitter + Reddit mentions. NLP sentiment scoring.
|
| 34 |
+
"$BONK sentiment is 87% positive with 450 mentions/hour" → feeds into SENTINEL risk score.
|
| 35 |
+
**Impact:** First-to-market intelligence. Catch pumps before they happen.
|
| 36 |
+
**Depends on:** X API (BrightData fallback) ✅, Redpanda streaming
|
| 37 |
+
|
| 38 |
+
### 6. Cross-Chain Arbitrage Detector
|
| 39 |
+
Compare prices across 112 chains. "ETH is $3,201 on Ethereum but $3,245 on Arbitrum — 1.4% arb."
|
| 40 |
+
Factor in gas + bridge fees. Alert if net profit > $50.
|
| 41 |
+
**Impact:** Premium feature. Professional traders pay for this.
|
| 42 |
+
**Depends on:** DataBus ✅, chain comparability ✅
|
| 43 |
+
|
| 44 |
+
### 7. MEV Protection Advisory
|
| 45 |
+
Before token purchase, check: "This pool has had 12 sandwich attacks in 24h. Use Flashbots."
|
| 46 |
+
Integrate with wallet connection. Warn before confirming tx.
|
| 47 |
+
**Impact:** Unique value prop. No competitor does this at consumer level.
|
| 48 |
+
**Depends on:** MEV detector ✅, Erigon ✅
|
| 49 |
+
|
| 50 |
+
### 8. NFT Wash Trading Detector
|
| 51 |
+
Extend volume authenticity to NFTs. Detect: self-trades, round-trip wash, bid stuffing.
|
| 52 |
+
Score 0-100 authenticity per collection. "Bored Apes: 94% authentic. Random NFT #8472: 12% authentic."
|
| 53 |
+
**Impact:** NFT market is $5B+. Wash trading is rampant. First mover.
|
| 54 |
+
**Depends on:** Volume authenticity ✅, DataBus NFT providers
|
| 55 |
+
|
| 56 |
+
## TIER 3 — Platform (Week 3-4)
|
| 57 |
+
|
| 58 |
+
### 9. Developer API Portal
|
| 59 |
+
Self-service: sign up, get API key, view docs, track usage.
|
| 60 |
+
`developers.rugmunch.io` — Swagger docs, code snippets (Python/JS/Rust), rate limits.
|
| 61 |
+
**Impact:** Developer ecosystem. 3rd-party apps build on RMI.
|
| 62 |
+
**Depends on:** DataBus gateway ✅, Supabase auth
|
| 63 |
+
|
| 64 |
+
### 10. Automated Incident Response
|
| 65 |
+
If backend CPU > 90% for 5min → auto-scale warning.
|
| 66 |
+
If Redis down → serve stale cache + alert Telegram.
|
| 67 |
+
If disk > 85% → auto-prune old logs.
|
| 68 |
+
**Impact:** 24/7 reliability without human intervention.
|
| 69 |
+
**Depends on:** Prometheus ✅, Grafana ✅, health checks
|
| 70 |
+
|
| 71 |
+
### 11. Content Moderation Pipeline
|
| 72 |
+
User-submitted content (comments, posts, reviews) → AI moderation.
|
| 73 |
+
NSFW/spam/scam detection. Human review queue for edge cases.
|
| 74 |
+
**Impact:** Community features without moderation overhead.
|
| 75 |
+
**Depends on:** Ollama (classification) ✅, Ghost CMS
|
| 76 |
+
|
| 77 |
+
### 12. Model A/B Testing Framework
|
| 78 |
+
Deploy 2 prompt variants → split traffic 50/50 → measure accuracy.
|
| 79 |
+
"scam_detection_v2 has 94% accuracy vs v1 89%. Auto-promote v2."
|
| 80 |
+
**Impact:** Continuous improvement without manual testing.
|
| 81 |
+
**Depends on:** Prompt registry ✅, Langfuse ✅
|
| 82 |
+
|
| 83 |
+
## TIER 4 — Advanced AI (Ongoing)
|
| 84 |
+
|
| 85 |
+
### 13. Fine-Tuned RMI Models
|
| 86 |
+
Fine-tune qwen2.5-coder:7b on Real-CATS + MBAL + Elliptic.
|
| 87 |
+
`rmi-scam-detector:7b` — specialist model, 95%+ accuracy on rug detection.
|
| 88 |
+
Deploy to Ollama. A/B test against generic models.
|
| 89 |
+
**Impact:** Proprietary AI advantage. Moats are built on custom models.
|
| 90 |
+
**Depends on:** Ollama ✅, Real-CATS ✅, model eval ✅
|
| 91 |
+
|
| 92 |
+
### 14. Multi-Modal Token Analysis
|
| 93 |
+
Analyze token logos, website screenshots, social media images.
|
| 94 |
+
"Is this token using stolen artwork? Is the website a template?"
|
| 95 |
+
Vision model (Gemini 2.5 Flash free tier) → risk signal.
|
| 96 |
+
**Impact:** Catches scams that text-only analysis misses.
|
| 97 |
+
**Depends on:** Gemini API ✅, browser automation
|
| 98 |
+
|
| 99 |
+
### 15. Autonomous Research Agent (Cron)
|
| 100 |
+
Every morning: scan top 100 tokens, identify 5 most interesting, write research report.
|
| 101 |
+
Publish to Ghost CMS + Telegram + X. Fully automated.
|
| 102 |
+
LLM writes → LLM reviews → human approves → publish.
|
| 103 |
+
**Impact:** Content machine. Daily research without human effort.
|
| 104 |
+
**Depends on:** Dify ✅, DataBus ✅, Ghost ✅, agent memory ✅
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## Execution Priority
|
| 109 |
+
|
| 110 |
+
| Priority | Items | Timeline |
|
| 111 |
+
|---|---|---|
|
| 112 |
+
| NOW | #1 Widget, #2 WebSocket, #3 Signals, #4 Billing | 3 days |
|
| 113 |
+
| WEEK 2 | #5 Sentiment, #6 Arbitrage, #7 MEV, #8 NFT | 7 days |
|
| 114 |
+
| WEEK 3-4 | #9 API Portal, #10 Auto-Healing, #11 Moderation, #12 A/B | 14 days |
|
| 115 |
+
| ONGOING | #13 Fine-Tuning, #14 Multi-Modal, #15 Auto-Research | Continuous |
|
| 116 |
+
|
| 117 |
+
## Immediate Dependencies
|
| 118 |
+
|
| 119 |
+
| Blocker | Resolution |
|
| 120 |
+
|---|---|
|
| 121 |
+
| Dify admin setup | Go to :8899, create admin account |
|
| 122 |
+
| DeepSeek API key in Dify | Settings → Model Provider → DeepSeek |
|
| 123 |
+
| Caddy/nginx WebSocket proxy | 5-line config for /ws/ path |
|
| 124 |
+
| Stripe integration | Create Stripe account, get API keys |
|
backend/docs/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI Platform — System Architecture
|
| 2 |
+
|
| 3 |
+
> **v3 (Jun 21 2026)**: This document now describes the rebuilt architecture.
|
| 4 |
+
> The legacy monolith has been replaced via strangler-fig. New v1 routes
|
| 5 |
+
> mount via `app/api/v1/__init__.py` aggregator. See `docs/adr/0003-strangler-fig-not-rewrite.md`
|
| 6 |
+
> for the migration pattern, and `docs/adr/0001-why-fastapi.md` for framework choice.
|
| 7 |
+
|
| 8 |
+
## v3 Architecture Diagram
|
| 9 |
+
|
| 10 |
+
```
|
| 11 |
+
┌─────────────────────┐
|
| 12 |
+
│ CONSUMERS │
|
| 13 |
+
│ Frontend | MCP │
|
| 14 |
+
│ Telegram | API │
|
| 15 |
+
└──────────┬──────────┘
|
| 16 |
+
│
|
| 17 |
+
┌────────────────────┼────────────────────┐
|
| 18 |
+
│ │ │
|
| 19 |
+
┌───────▼───────┐ ┌───────▼───────┐ ┌───────▼───────┐
|
| 20 |
+
│ MCP ENDPOINT │ │ REST v1 API │ │ X402 GATEWAY │
|
| 21 |
+
│ /mcp/* │ │ /api/v1/* │ │ CF Workers │
|
| 22 |
+
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
|
| 23 |
+
│ │ │
|
| 24 |
+
└────────────────────┼────────────────────┘
|
| 25 |
+
│
|
| 26 |
+
┌────────────▼────────────┐
|
| 27 |
+
│ app/api/v1/__init__.py │
|
| 28 |
+
│ AGGREGATOR (NEW) │
|
| 29 |
+
└────────────┬────────────┘
|
| 30 |
+
│
|
| 31 |
+
┌────────────────────────┼────────────────────────┐
|
| 32 |
+
│ │ │
|
| 33 |
+
┌─────────▼─────────┐ ┌──────────▼──────────┐ ┌─────────▼─────────┐
|
| 34 |
+
│ AUTH ROUTERS │ │ PUBLIC ROUTERS │ │ ADMIN ROUTERS │
|
| 35 |
+
│ alerts, wallet │ │ wallet, token, │ │ alerts_webhook │
|
| 36 |
+
│ │ │ scanner, databus │ │ (Prometheus) │
|
| 37 |
+
└───────────────────┘ └──────────┬──────────┘ └───────────────────┘
|
| 38 |
+
│
|
| 39 |
+
┌───────────▼───────────┐
|
| 40 |
+
│ DATABUS │
|
| 41 |
+
│ 96 chains, 119 prov. │
|
| 42 |
+
└───────────┬───────────┘
|
| 43 |
+
│
|
| 44 |
+
┌───────────────────────┼───────────────────────┐
|
| 45 |
+
│ │ │
|
| 46 |
+
┌─────────▼─────────┐ ┌──────────▼──────────┐ ┌────────▼────────┐
|
| 47 |
+
│ SERVICE LAYER │ │ PROVIDER CHAINS │ │ LOCAL MCP │
|
| 48 |
+
│ app/domain/* │ │ Jupiter → Helius → │ │ SVM + EVM │
|
| 49 |
+
│ (pure Python) │ │ Alchemy → … │ │ Self-hosted │
|
| 50 |
+
└───────────────────┘ └─────────────────────┘ └─────────────────┘
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Overview
|
| 54 |
+
|
| 55 |
+
Rug Munch Intelligence is a unified crypto intelligence platform serving 234 tools across 9 provider categories. Every data call routes through a multi-layer caching shield with automatic provider fallback. The x402 micropayment layer handles paid tool access across 8 chains with instant settlement.
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
┌─────────────────────┐
|
| 59 |
+
│ FRONTEND / BOTS │
|
| 60 |
+
│ Web | Telegram | API│
|
| 61 |
+
└──────────┬──────────┘
|
| 62 |
+
│
|
| 63 |
+
┌────────────────────┼────────────────────┐
|
| 64 |
+
│ │ │
|
| 65 |
+
┌───────▼───────┐ ┌───────▼───────┐ ┌───────▼───────┐
|
| 66 |
+
│ MCP ENDPOINT │ │ REST API │ │ X402 GATEWAY │
|
| 67 |
+
│ /mcp/* │ │ /api/v1/* │ │ CF Workers │
|
| 68 |
+
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
|
| 69 |
+
│ │ │
|
| 70 |
+
└────────────────────┼────────────────────┘
|
| 71 |
+
│
|
| 72 |
+
┌────────────▼────────────┐
|
| 73 |
+
│ CACHING SHIELD │
|
| 74 |
+
│ L1 Memory → Rate Limit │
|
| 75 |
+
│ → Provider Chain │
|
| 76 |
+
└────────────┬────────────┘
|
| 77 |
+
│
|
| 78 |
+
┌────────────────────────┼────────────────────────┐
|
| 79 |
+
│ │ │
|
| 80 |
+
┌─────────▼─────────┐ ┌──────────▼──────────┐ ┌─────────▼─────────┐
|
| 81 |
+
│ DATA PROVIDERS │ │ LOCAL MCP SERVERS │ │ SERVICE MCP │
|
| 82 |
+
│ 20 sources │ │ SVM (60) + EVM (25)│ │ GMGN, Birdeye... │
|
| 83 |
+
└───────────────────┘ └─────────────────────┘ └───────────────────┘
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Tool Categories
|
| 87 |
+
|
| 88 |
+
| Category | Count | Access | Description |
|
| 89 |
+
|----------|-------|--------|-------------|
|
| 90 |
+
| Security Scanning | 45 | Free trial + paid | Rug pulls, honeypots, audits, clone detection |
|
| 91 |
+
| Wallet Intelligence | 38 | Free trial + paid | PnL, clustering, insider networks, whale tracking |
|
| 92 |
+
| Market Data | 32 | Free trial + paid | Prices, liquidity, volume, arbitrage, trends |
|
| 93 |
+
| Token Analytics | 28 | Free trial + paid | Holder distribution, sniper detection, deployer history |
|
| 94 |
+
| DeFi Analytics | 24 | Free trial + paid | TVL, yields, protocol risk, liquidity flow |
|
| 95 |
+
| Social Signals | 18 | Free trial + paid | Sentiment, KOL tracking, profile flips |
|
| 96 |
+
| **Caching Shield** | **13** | **Free internal** | Funding trace, risk scan, token price, wallet balance |
|
| 97 |
+
| Local MCP | 85 | Self-hosted | SVM Solana RPC, EVM blockchain queries |
|
| 98 |
+
| Free Public MCP | 50 | Free external | Boar blockchain (ETH, ENS, contracts) |
|
| 99 |
+
|
| 100 |
+
## Caching Shield Architecture
|
| 101 |
+
|
| 102 |
+
Every data call goes through three layers before hitting any external API:
|
| 103 |
+
|
| 104 |
+
1. **L1 Memory Cache** — Sub-millisecond lookup. TTLs: 8s (price) to 1hr (contract ABI).
|
| 105 |
+
2. **Rate Limiter** — Token bucket per provider. Prevents burning free tier quotas.
|
| 106 |
+
3. **Provider Chain** — Ordered fallback. If primary fails, next provider tried automatically.
|
| 107 |
+
|
| 108 |
+
Example: Token Price Request
|
| 109 |
+
```
|
| 110 |
+
Request → L1 cache (miss) → Rate check (allowed) → Jupiter (primary) →
|
| 111 |
+
if fail: Solana Tracker → if fail: DexScreener → if fail: Binance
|
| 112 |
+
Result cached for 8 seconds. Next request hits L1 cache instantly.
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## Provider Fallback Chains
|
| 116 |
+
|
| 117 |
+
| Data Type | Primary | Fallback 1 | Fallback 2 | Fallback 3 |
|
| 118 |
+
|-----------|---------|------------|------------|------------|
|
| 119 |
+
| Token Price | Jupiter | Solana Tracker | DexScreener | Binance |
|
| 120 |
+
| Token Metadata | Helius DAS | Solana Tracker | Jupiter | DexScreener |
|
| 121 |
+
| Wallet Balance | Helius | QuickNode | Alchemy | PublicNode |
|
| 122 |
+
| Risk Scan | GoPlus | RugCheck | Honeypot | Local Labels |
|
| 123 |
+
| EVM Funding | Blockscout | Etherscan | Public RPC | Boar MCP |
|
| 124 |
+
| Solana Funding | Helius | Solana Tracker | Public RPC | Local Labels |
|
| 125 |
+
|
| 126 |
+
## Free Access Tiers
|
| 127 |
+
|
| 128 |
+
### Free Trials (x402 Tools)
|
| 129 |
+
- Every paid tool includes 1-5 free trial calls
|
| 130 |
+
- No payment required for trial calls
|
| 131 |
+
- Fingerprint-gated anti-abuse protection
|
| 132 |
+
- Reset monthly or on tool updates
|
| 133 |
+
|
| 134 |
+
### Always-Free Tools
|
| 135 |
+
- **Funding Tracer** — Trace wallet funding sources (Solana + 9 EVM chains)
|
| 136 |
+
- **Token Price** — Real-time price with multi-provider consensus
|
| 137 |
+
- **Risk Scan** — Quick security check with 4 fallback layers
|
| 138 |
+
- **Wallet Balance** — Balance lookup with provider redundancy
|
| 139 |
+
- **GMGN Security** — Token safety analysis
|
| 140 |
+
- **Etherscan Gas** — Current gas prices
|
| 141 |
+
- **CoinGecko Price** — Market data
|
| 142 |
+
- **Langfuse Stats** — Observability metrics
|
| 143 |
+
- **All Local MCP Tools** — 85 tools running on our infrastructure
|
| 144 |
+
|
| 145 |
+
### Free Tier Limits (External APIs)
|
| 146 |
+
Solana Tracker: 5,000 requests/month across 2 accounts (6 RPS combined)
|
| 147 |
+
Helius: 2 accounts, 25 RPS each (50 RPS total)
|
| 148 |
+
Blockscout PRO: 100,000 credits/day, 5 RPS
|
| 149 |
+
CoinMarketCap: 10,000 calls/month, 11 endpoints
|
| 150 |
+
Boar MCP: Unlimited (keyless, read-only)
|
| 151 |
+
|
| 152 |
+
## X402 Payment System
|
| 153 |
+
|
| 154 |
+
- **Price range:** $0.01 - $0.40 per tool call
|
| 155 |
+
- **Payment chains:** Base, Solana, Ethereum, BSC, TRON, Bitcoin, Polygon, Arbitrum
|
| 156 |
+
- **8 payment facilitators** with automatic fallback
|
| 157 |
+
- **Instant refund** if tool returns no data
|
| 158 |
+
- **Settlement:** Instant on Base and Solana
|
| 159 |
+
|
| 160 |
+
## Local MCP Servers
|
| 161 |
+
|
| 162 |
+
Two self-hosted MCP servers run on our bare metal, accessed via stdio transport:
|
| 163 |
+
|
| 164 |
+
**Solana SVM MCP** (60 tools, Rust)
|
| 165 |
+
- getBalance, getAccountInfo, getTokenSupply, getSignaturesForAddress
|
| 166 |
+
- getTransaction, getProgramAccounts, getBlock, getBlockHeight
|
| 167 |
+
- WebSocket subscriptions for real-time updates
|
| 168 |
+
- Built-in x402 payment protocol support
|
| 169 |
+
|
| 170 |
+
**EVM MCP** (25 tools, 86 networks)
|
| 171 |
+
- getBalance, getTokenBalance, getAllowance
|
| 172 |
+
- getTransaction, getTransactionReceipt, waitForTransaction
|
| 173 |
+
- getBlock, resolveENS, lookupENS
|
| 174 |
+
- getGasPrice, getContractABI, getChainInfo
|
| 175 |
+
|
| 176 |
+
## Observability
|
| 177 |
+
|
| 178 |
+
Langfuse cloud with smart sampling:
|
| 179 |
+
- 20% of normal traces sent to cloud
|
| 180 |
+
- 100% of errors sent to cloud
|
| 181 |
+
- Full archive in local ClickHouse
|
| 182 |
+
- Target: 30,000 observations/month (free tier: 50,000)
|
| 183 |
+
|
| 184 |
+
## Deployment
|
| 185 |
+
|
| 186 |
+
- **Server:** Bare metal VPS (193GB SSD, Ubuntu)
|
| 187 |
+
- **Containers:** Docker Compose (30 containers)
|
| 188 |
+
- **CI/CD:** GitHub Actions — auto-deploy on push to main
|
| 189 |
+
- **Edge:** Cloudflare Workers for x402 payment gateway
|
| 190 |
+
- **Secrets:** GPG-encrypted vault (52 secrets), age-encrypted Docker runtime
|
| 191 |
+
|
| 192 |
+
## Auto-Updating Platform Manifest
|
| 193 |
+
|
| 194 |
+
All platform descriptions, tool counts, pricing, and agent skills are managed by a single source of truth at `app/caching_shield/platform_manifest.py`. Every external surface reads from here.
|
| 195 |
+
|
| 196 |
+
**Live endpoints (always current):**
|
| 197 |
+
- `GET /mcp/manifest` — Full platform manifest with live tool counts
|
| 198 |
+
- `GET /mcp/membership` — Membership tiers, scan packs, streams, research, batch
|
| 199 |
+
- `GET /mcp/skills` — 18 agent skills with workflows and anti-abuse rules
|
| 200 |
+
|
| 201 |
+
**Directory sync (run to update external listings):**
|
| 202 |
+
```bash
|
| 203 |
+
python3 /root/backend/scripts/sync_platforms.py
|
| 204 |
+
```
|
| 205 |
+
Updates Smithery, Glama, mcp.so, and README from the manifest.
|
| 206 |
+
|
| 207 |
+
**Tools by category (auto-counted):**
|
| 208 |
+
| Category | Count | Access |
|
| 209 |
+
|----------|-------|--------|
|
| 210 |
+
| Paid Tools (with free trials) | 200+ | 1-5 free calls, then pay-per-use |
|
| 211 |
+
| Local MCP Tools | 85 | Self-hosted, no rate limits |
|
| 212 |
+
| Free Public MCP | 50 | Keyless, read-only |
|
| 213 |
+
| Agent Skills | 18 | Free, included with any access |
|
| 214 |
+
| Scan Packs | 4 | 50-53% off individual tools |
|
| 215 |
+
| Membership Tiers | 4 | $4.99-$199.99/mo, daily call limits |
|
| 216 |
+
| Streaming Feeds | 4 | Real-time data via WebSocket |
|
| 217 |
+
| Research Reports | 4 | Deep dive investigations |
|
| 218 |
+
| Batch Products | 3 | 75-90% off bulk scanning |
|
| 219 |
+
| AI Data Feeds | 3 | Machine-ready market data |
|
backend/docs/FAQ.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI Platform — Frequently Asked Questions
|
| 2 |
+
|
| 3 |
+
## General
|
| 4 |
+
|
| 5 |
+
**What is Rug Munch Intelligence (RMI)?**
|
| 6 |
+
A unified crypto intelligence platform with 270+ tools for token security, wallet forensics, whale tracking, market data, and blockchain queries. Free tools available, paid tools via x402 micropayments.
|
| 7 |
+
|
| 8 |
+
**How many tools are free?**
|
| 9 |
+
Every paid tool includes 1-5 free trial calls. Connecting a wallet unlocks full trial allotment (3-5 for basic tools, 1-2 for premium). Bots without wallets get 1 trial per tool via fingerprint.
|
| 10 |
+
|
| 11 |
+
**What chains are supported?**
|
| 12 |
+
Solana, Ethereum, Base, BSC, Polygon, Arbitrum, Optimism, Avalanche, Fantom, Gnosis, TRON, Bitcoin (12 payment chains, 38 data chains).
|
| 13 |
+
|
| 14 |
+
## Pricing & Payments
|
| 15 |
+
|
| 16 |
+
**How does x402 pricing work?**
|
| 17 |
+
You pay per tool call in USDC. Prices range from $0.01 (basic lookups) to $0.25 (institutional forensics). Payment happens automatically via the x402 protocol — no accounts, no subscriptions, no prepayment.
|
| 18 |
+
|
| 19 |
+
**Which chains can I pay on?**
|
| 20 |
+
Base, Solana, Ethereum, BSC, TRON, Bitcoin, Polygon, Arbitrum, Optimism, Avalanche, Fantom, Gnosis. Plus EUR/SEPA via AsterPay for European users.
|
| 21 |
+
|
| 22 |
+
**What if a paid tool returns no data?**
|
| 23 |
+
Full automatic refund within 48 hours. You're never charged for empty results.
|
| 24 |
+
|
| 25 |
+
**Do free trials reset?**
|
| 26 |
+
Yes — every 24 hours. Fingerprint gating ensures fair usage:
|
| 27 |
+
- **Humans (wallet connected)**: Full trial allotment (3-5 for basic, 1-2 for premium)
|
| 28 |
+
- **Bots (device fingerprint)**: 1 trial per tool, then payment required
|
| 29 |
+
- **IP-only**: 1 trial max, then payment required
|
| 30 |
+
|
| 31 |
+
## DataBus
|
| 32 |
+
|
| 33 |
+
**What is DataBus?**
|
| 34 |
+
The single data pipeline powering all 270+ tools. 38 data chains, 67 providers, automatic failover. You never need to specify which provider to use — just request the data type and DataBus handles the rest.
|
| 35 |
+
|
| 36 |
+
**What happens when a source fails?**
|
| 37 |
+
DataBus automatically tries the next provider in the chain. Token prices try: local cache → Jupiter → DexScreener → Binance → CoinGecko. You always get data.
|
| 38 |
+
|
| 39 |
+
## Endpoints
|
| 40 |
+
|
| 41 |
+
| Path | Purpose |
|
| 42 |
+
|------|---------|
|
| 43 |
+
| `/api/v1/x402-databus/*` | DataBus direct endpoints (40 tools) |
|
| 44 |
+
| `/api/v1/x402-tools/*` | Legacy tool endpoints (230+ tools, DataBus fallback) |
|
| 45 |
+
| `/api/v1/catalog` | Human-facing catalog (search, featured, by-trial) |
|
| 46 |
+
| `/mcp/tools` | MCP-compliant tool catalog |
|
| 47 |
+
| `/.well-known/x402` | x402 discovery document |
|
| 48 |
+
|
| 49 |
+
## Security
|
| 50 |
+
|
| 51 |
+
- API keys encrypted in GPG vault, never in plaintext
|
| 52 |
+
- No source provider names exposed in responses
|
| 53 |
+
- 6-tier access control: public, authenticated, basic, premium, admin, x402_paid
|
| 54 |
+
- VPN-resistant fingerprinting for trial gating
|
backend/docs/MCP-DIRECTORIES.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MCP Directory Submissions — Complete Tracking
|
| 2 |
+
|
| 3 |
+
> Status of RMI listings across all MCP discovery directories and registries.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Listed Directories
|
| 8 |
+
|
| 9 |
+
| # | Directory | URL | Status | Last Updated |
|
| 10 |
+
|---|-----------|-----|--------|-------------|
|
| 11 |
+
| 1 | **Smithery** | [smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence](https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence) | ✅ Listed | 2026-05-25 |
|
| 12 |
+
| 2 | **Glama** | [glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence](https://glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence) | ⏳ Submitted | 2026-05-25 |
|
| 13 |
+
| 3 | **mcp.so** | [mcp.so/server/rug-munch-intelligence](https://mcp.so/server/rug-munch-intelligence) | ⏳ Pending | 2026-05-25 |
|
| 14 |
+
|
| 15 |
+
## Pending Submissions
|
| 16 |
+
|
| 17 |
+
| # | Directory | URL | Method | Priority |
|
| 18 |
+
|---|-----------|-----|--------|----------|
|
| 19 |
+
| 4 | PulseMCP | pulsemcp.com | Web submit | High |
|
| 20 |
+
| 5 | MCP List | mcplist.ai | Web submit | High |
|
| 21 |
+
| 6 | FindMCP | findmcp.dev | Web submit | High |
|
| 22 |
+
| 7 | Official MCP Registry | github.com/modelcontextprotocol/servers | GitHub PR | Medium |
|
| 23 |
+
| 8 | Cline MCP Marketplace | github.com/cline/mcp-marketplace | GitHub PR | Medium |
|
| 24 |
+
| 9 | Open WebUI | openwebui.com | Community listing | Medium |
|
| 25 |
+
| 10 | LobeHub | lobehub.com | MCP listing | Medium |
|
| 26 |
+
| 11 | MCP Repository | mcprepository.com | Web submit | Low |
|
| 27 |
+
| 12 | Cursor Directory | cursor.directory | Plugin listing | Medium |
|
| 28 |
+
| 13 | Agentpedia | agentpedia.codes | MCP listing | Low |
|
| 29 |
+
| 14 | Microsoft MCP Center | mcp.microsoft.com | Enterprise | Low |
|
| 30 |
+
| 15 | Composio | composio.dev | Registry | Medium |
|
| 31 |
+
| 16 | mcp.run | mcp.run | Registry | Low |
|
| 32 |
+
| 17 | Awesome MCP Servers | github.com/punkpeye/awesome-mcp-servers | GitHub PR | Medium |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Submission Information
|
| 37 |
+
|
| 38 |
+
Use these details for all directory submissions:
|
| 39 |
+
|
| 40 |
+
```
|
| 41 |
+
Name: Rug Munch Intelligence
|
| 42 |
+
Short Description: 210 crypto intelligence tools across 13 blockchains. Scam detection, wallet forensics, whale tracking, contract auditing, market analysis. Free trials + x402 micropayments. 8 payment facilitators. AI-native MCP server.
|
| 43 |
+
MCP Endpoint: https://rugmunch.io/mcp
|
| 44 |
+
MCP Transport: HTTP (Streamable)
|
| 45 |
+
Discovery: https://rugmunch.io/.well-known/mcp.json
|
| 46 |
+
x402 Discovery: https://rugmunch.io/.well-known/x402
|
| 47 |
+
GitHub: https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp
|
| 48 |
+
Website: https://rugmunch.io
|
| 49 |
+
Documentation: https://rugmunch.io/docs/mcp
|
| 50 |
+
Logo: https://rugmunch.io/logo.png
|
| 51 |
+
Contact: mcp@rugmunch.io
|
| 52 |
+
Maintainer: @cryptorugmuncher
|
| 53 |
+
Organization: CryptoRugMunch / Rug Munch Media LLC
|
| 54 |
+
License: Proprietary
|
| 55 |
+
|
| 56 |
+
Categories: Security, Intelligence, Market, Analysis, Social, Launchpad, Forensics, DeFi, NFT
|
| 57 |
+
Chains: Solana, Base, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis, TRON, Bitcoin, SEPA
|
| 58 |
+
Pricing: Free trials (1-5 calls/tool). $0.01-$0.40/call via x402. Pay with USDC, USDT, BTC, EUR on 13 chains.
|
| 59 |
+
Facilitators: Coinbase CDP, PayAI, Cloudflare x402, EIP-7702, TRON Self-Verify, Bitcoin Self-Verify, AsterPay, x402-rs
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
### Tags (comma-separated)
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
crypto, blockchain, web3, mcp, security, intelligence, defi, scam-detection, whale-tracking, contract-audit, solana, ethereum, base, forensics, ai-agents, x402, micropayments, rug-pull, honeypot-detection, wallet-analysis, market-intelligence
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## GitHub PR Submissions
|
| 71 |
+
|
| 72 |
+
### Official MCP Registry (modelcontextprotocol/servers)
|
| 73 |
+
- **Repo**: https://github.com/modelcontextprotocol/servers
|
| 74 |
+
- **Method**: Fork → Add entry → PR
|
| 75 |
+
- **Entry format**: JSON in `servers/` directory
|
| 76 |
+
- **PR title**: `Add Rug Munch Intelligence MCP server`
|
| 77 |
+
|
| 78 |
+
### Cline MCP Marketplace
|
| 79 |
+
- **Repo**: https://github.com/cline/mcp-marketplace
|
| 80 |
+
- **Method**: Fork → Add to `servers.json` → PR
|
| 81 |
+
|
| 82 |
+
### Awesome MCP Servers
|
| 83 |
+
- **Repo**: https://github.com/punkpeye/awesome-mcp-servers
|
| 84 |
+
- **Method**: Fork → Add to README → PR
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
## Verification Checklist
|
| 89 |
+
|
| 90 |
+
Before submitting to each directory, verify:
|
| 91 |
+
|
| 92 |
+
- [x] MCP endpoint responds at `https://rugmunch.io/mcp`
|
| 93 |
+
- [x] Discovery endpoint returns valid JSON at `https://rugmunch.io/.well-known/mcp.json`
|
| 94 |
+
- [x] x402 discovery returns payment info at `https://rugmunch.io/.well-known/x402`
|
| 95 |
+
- [x] GitHub repo is public and has smithery.json + glama.json in root
|
| 96 |
+
- [x] Logo accessible at `https://rugmunch.io/logo.png`
|
| 97 |
+
- [x] Documentation page live at `https://rugmunch.io/docs/mcp`
|
| 98 |
+
- [x] Free trials work without authentication
|
| 99 |
+
- [x] All 210 tools appear in discovery endpoint
|
| 100 |
+
- [x] Server responds to MCP `tools/list` method
|
| 101 |
+
- [x] Smithery listing is live and verified
|
| 102 |
+
- [ ] Glama listing is live and verified
|
| 103 |
+
- [ ] mcp.so listing submitted
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Post-Submission Monitoring
|
| 108 |
+
|
| 109 |
+
After listing on each directory:
|
| 110 |
+
|
| 111 |
+
1. **Verify listing** within 24 hours
|
| 112 |
+
2. **Test MCP connection** from the directory's "Try it" feature
|
| 113 |
+
3. **Check ratings/reviews** weekly
|
| 114 |
+
4. **Update descriptions** when tool count or features change
|
| 115 |
+
5. **Respond to user feedback** within 48 hours
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
*Last updated: 2026-05-25*
|
backend/docs/MCP-FAQ.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rug Munch Intelligence — Frequently Asked Questions
|
| 2 |
+
|
| 3 |
+
> Everything you need to know about crypto intelligence, MCP tools, x402 payments, and more.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## General
|
| 8 |
+
|
| 9 |
+
### What is Rug Munch Intelligence?
|
| 10 |
+
|
| 11 |
+
Rug Munch Intelligence (RMI) is an AI-powered crypto security platform that provides **210 tools** across **13 blockchains** for scam detection, rug pull prevention, wallet forensics, whale tracking, contract auditing, and market analysis. It's built for AI agents via the Model Context Protocol (MCP) and accessible to humans through our web platform.
|
| 12 |
+
|
| 13 |
+
### What is MCP?
|
| 14 |
+
|
| 15 |
+
The **Model Context Protocol** is an open standard that allows AI assistants (like Claude, Cursor, Windsurf, ChatGPT) to discover and call external tools. RMI implements MCP so any MCP-compatible agent can use our 210 crypto intelligence tools directly.
|
| 16 |
+
|
| 17 |
+
### How do I connect RMI to my AI assistant?
|
| 18 |
+
|
| 19 |
+
Add this to your MCP configuration:
|
| 20 |
+
|
| 21 |
+
**Claude Desktop / Cursor:**
|
| 22 |
+
```json
|
| 23 |
+
{
|
| 24 |
+
"mcpServers": {
|
| 25 |
+
"rug-munch-intelligence": {
|
| 26 |
+
"command": "npx",
|
| 27 |
+
"args": ["-y", "mcp-remote@latest", "https://rugmunch.io/mcp"]
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
**Windsurf / HTTP clients:**
|
| 34 |
+
```json
|
| 35 |
+
{
|
| 36 |
+
"mcpServers": {
|
| 37 |
+
"rug-munch-intelligence": {
|
| 38 |
+
"url": "https://rugmunch.io/mcp",
|
| 39 |
+
"transport": "http"
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
### What blockchains are supported?
|
| 46 |
+
|
| 47 |
+
We support **13 chains**: Solana, Base, Ethereum, BSC (BNB Chain), Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis, TRON, Bitcoin, and SEPA (European bank transfers).
|
| 48 |
+
|
| 49 |
+
### How many tools are available?
|
| 50 |
+
|
| 51 |
+
**210 tools** across multiple categories: Security (29 + 9 SENTINEL), Intelligence (27), Market (15), Analysis (14), Social (11), Launchpad (7), Premium (7), DeFi (4), NFT (2), Bundles (4), API (3), and Variants (80 per-chain).
|
| 52 |
+
|
| 53 |
+
### What endpoint formats are available?
|
| 54 |
+
|
| 55 |
+
Six discovery and tool-format endpoints are available:
|
| 56 |
+
|
| 57 |
+
| Endpoint | Format | Description |
|
| 58 |
+
|:---|:---|:---|
|
| 59 |
+
| `GET /api/v1/x402-tools/discovery` | x402 v2 | Full x402 protocol discovery with payment metadata |
|
| 60 |
+
| `GET /api/v1/x402-tools/catalog` | JSON | Human-readable organized tool catalog |
|
| 61 |
+
| `GET /api/v1/x402-tools/openai-tools` | OpenAI | OpenAI function calling format (210 tools) |
|
| 62 |
+
| `GET /api/v1/x402-tools/anthropic-tools` | Anthropic | Anthropic tool use format (210 tools) |
|
| 63 |
+
| `GET /api/v1/x402-tools/gemini-tools` | Gemini | Google Gemini function declarations (210 tools) |
|
| 64 |
+
| `GET /api/v1/x402-tools/langchain-tools` | LangChain | LangChain tool schema format (210 tools) |
|
| 65 |
+
|
| 66 |
+
All return the same 210 tools in their respective formats.
|
| 67 |
+
|
| 68 |
+
### What are the SENTINEL modules?
|
| 69 |
+
|
| 70 |
+
SENTINEL is our deep scanning suite — 9 specialized modules that can run individually ($0.05–$0.08 each) or as a full parallel scan ($0.15):
|
| 71 |
+
|
| 72 |
+
| Module | Price | Description |
|
| 73 |
+
|:---|:---|:---|
|
| 74 |
+
| `holder_analysis` | $0.05 | HHI concentration, fake diversification detection |
|
| 75 |
+
| `bundle_detect` | $0.08 | Bundle/sniper detection, funding chain analysis |
|
| 76 |
+
| `exchange_fund_check` | $0.05 | CEX-funded wallet detection |
|
| 77 |
+
| `liquidity_verify` | $0.05 | Lock verification, fake locker detection |
|
| 78 |
+
| `dev_reputation` | $0.05 | Serial rugg detection, cross-chain dev tracking |
|
| 79 |
+
| `wash_trading` (SENTINEL) | $0.08 | Circular transfer detection, cross-DEX loops |
|
| 80 |
+
| `metadata_fingerprint` | $0.05 | HTML structure hashing, description similarity |
|
| 81 |
+
| `pumpfun_analysis` | $0.08 | Bonding curve, bot detection (Solana only) |
|
| 82 |
+
| `sentiment_check` | $0.05 | Social sentiment scoring, bot campaign detection |
|
| 83 |
+
| `sentinel_scan` (all 9) | $0.15 | Full parallel deep scan with graded risk score |
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## Pricing & Payments
|
| 88 |
+
|
| 89 |
+
### Is it free to try?
|
| 90 |
+
|
| 91 |
+
**Yes!** Every tool offers 1–5 free trial calls. No wallet required — trials are gated by device fingerprint. Just start calling tools and your trials are automatically applied.
|
| 92 |
+
|
| 93 |
+
### What happens after free trials?
|
| 94 |
+
|
| 95 |
+
After trials expire, you need to pay per call via **x402 micropayments** ($0.01–$0.40/call). Payment is automatic when using an MCP client with wallet support.
|
| 96 |
+
|
| 97 |
+
### What is x402?
|
| 98 |
+
|
| 99 |
+
x402 is an open micropayment protocol that enables per-call crypto payments for API access. Instead of monthly subscriptions, you pay fractions of a cent per tool call, settled on-chain.
|
| 100 |
+
|
| 101 |
+
### Which cryptocurrencies do you accept?
|
| 102 |
+
|
| 103 |
+
| Currency | Chains |
|
| 104 |
+
|----------|--------|
|
| 105 |
+
| USDC | Base, Solana, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis |
|
| 106 |
+
| USDT | TRON, BSC |
|
| 107 |
+
| USDD | TRON |
|
| 108 |
+
| BTC | Bitcoin (1-confirmation) |
|
| 109 |
+
| EUR | SEPA (European bank transfer via AsterPay) |
|
| 110 |
+
|
| 111 |
+
### Which wallets can I use?
|
| 112 |
+
|
| 113 |
+
- **MetaMask** — EVM chains (Base, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, etc.)
|
| 114 |
+
- **Phantom** — Solana + EVM chains
|
| 115 |
+
- **Solflare** — Solana
|
| 116 |
+
- **Backpack** — Solana
|
| 117 |
+
- **Coinbase Wallet** — Base, Ethereum
|
| 118 |
+
- **Rainbow** — EVM chains
|
| 119 |
+
- **TronLink** — TRON
|
| 120 |
+
- **WalletConnect** — Any compatible wallet
|
| 121 |
+
|
| 122 |
+
### What are payment facilitators?
|
| 123 |
+
|
| 124 |
+
We use **8 facilitators** to process payments across different chains:
|
| 125 |
+
|
| 126 |
+
1. **Coinbase CDP** — Fee-free USDC on Base & Solana
|
| 127 |
+
2. **PayAI** — Base & Solana USDC with deferred settlement
|
| 128 |
+
3. **Cloudflare x402** — Base Sepolia & Ethereum fallback
|
| 129 |
+
4. **EIP-7702** — Universal EVM (BSC, Polygon, Avalanche, Fantom, Gnosis, Arbitrum, Optimism, Base)
|
| 130 |
+
5. **TRON Self-Verify** — Fee-free USDT/USDC/USDD on TRON
|
| 131 |
+
6. **Bitcoin Self-Verify** — Fee-free BTC via Mempool.space
|
| 132 |
+
7. **AsterPay** — EUR/SEPA European off-ramp
|
| 133 |
+
8. **x402-rs** — Self-hosted Docker facilitator
|
| 134 |
+
|
| 135 |
+
### Do you offer refunds?
|
| 136 |
+
|
| 137 |
+
**Yes.** Full refund if a tool returns no data. Request within 48 hours by posting to `/api/v1/x402/refund` with your transaction hash. No questions asked on empty-result refunds.
|
| 138 |
+
|
| 139 |
+
### Can I get a refund if the data was wrong?
|
| 140 |
+
|
| 141 |
+
We refund for **no data returned**. If data is returned but you disagree with the analysis, that falls under our accuracy policy — contact support@mcp.rugmunch.io.
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
## Tools & Features
|
| 146 |
+
|
| 147 |
+
### What can the security tools detect?
|
| 148 |
+
|
| 149 |
+
- **Honeypots** — Buy-only mechanics, 99% sell tax, blacklist traps
|
| 150 |
+
- **Rug pull predictors** — AI scoring with 12+ on-chain signals
|
| 151 |
+
- **Clone detectors** — Bytecode similarity against 10,000+ known scam contracts
|
| 152 |
+
- **Sniper detectors** — Bot activity in first blocks after launch
|
| 153 |
+
- **MEV alerts** — Sandwich attacks, frontrunning, backrunning
|
| 154 |
+
- **Wash trading** — Artificial volume inflation detection
|
| 155 |
+
|
| 156 |
+
### How accurate is the rug pull predictor?
|
| 157 |
+
|
| 158 |
+
Our predictor uses 12+ on-chain signals including liquidity lock status, ownership concentration, holder distribution, deployer history, mint authority, and social signals. Risk levels: Low / Medium / High / Critical.
|
| 159 |
+
|
| 160 |
+
### What chains do security tools support?
|
| 161 |
+
|
| 162 |
+
All 13 supported chains. High-value tools (audit, rug pull predictor) support EVM chains. Solana-specific tools handle SPL token analysis. TRON and Bitcoin tools are chain-specific.
|
| 163 |
+
|
| 164 |
+
### Can I use multiple tools in one call?
|
| 165 |
+
|
| 166 |
+
Yes! **Bundle endpoints** combine multiple tools into single calls for efficiency. Available bundles: `unified_scan`, `security_bundle`, `intelligence_bundle`, `full_audit`.
|
| 167 |
+
|
| 168 |
+
### What is the difference between free trial and paid calls?
|
| 169 |
+
|
| 170 |
+
| Feature | Free Trial | Paid |
|
| 171 |
+
|---------|-----------|------|
|
| 172 |
+
| Calls per tool | 1–5 | Unlimited |
|
| 173 |
+
| Rate limit | 60/hr | 300/hr |
|
| 174 |
+
| Wallet required | No | Yes |
|
| 175 |
+
| Data depth | Standard | Full |
|
| 176 |
+
| Response time | Normal | Priority |
|
| 177 |
+
|
| 178 |
+
---
|
| 179 |
+
|
| 180 |
+
## Technical
|
| 181 |
+
|
| 182 |
+
### How does device fingerprinting work?
|
| 183 |
+
|
| 184 |
+
Trials are gated by a device fingerprint (browser + IP hash). Each unique fingerprint gets 1–5 free calls per tool. Connecting a wallet unlocks extended trials (3 per standard tool, 1 per premium).
|
| 185 |
+
|
| 186 |
+
### What's the x402 payment flow?
|
| 187 |
+
|
| 188 |
+
1. Agent calls a tool endpoint
|
| 189 |
+
2. If trials expired, server returns `402 Payment Required` with payment details
|
| 190 |
+
3. Agent client signs an EIP-3009 (USDC) or similar authorization
|
| 191 |
+
4. Payment is verified on-chain by the facilitator
|
| 192 |
+
5. Tool response is returned with payment receipt
|
| 193 |
+
|
| 194 |
+
### Is the MCP endpoint streaming or request-response?
|
| 195 |
+
|
| 196 |
+
We support both **HTTP** and **SSE** transports. The primary endpoint (`https://rugmunch.io/mcp`) uses streamable HTTP. Legacy SSE is available at `https://rugmunch.io/mcp/sse`.
|
| 197 |
+
|
| 198 |
+
### What's the rate limit?
|
| 199 |
+
|
| 200 |
+
- **Trial**: 60 requests/hour per fingerprint
|
| 201 |
+
- **x402 paid**: 300 requests/hour per wallet
|
| 202 |
+
- **Enterprise**: Custom — contact mcp@rugmunch.io
|
| 203 |
+
|
| 204 |
+
### How do I check my trial balance?
|
| 205 |
+
|
| 206 |
+
```
|
| 207 |
+
GET /api/v1/x402-tools/trials?fingerprint=<your-fingerprint-id>
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
Returns per-tool trial counts: used, remaining, and maximum.
|
| 211 |
+
|
| 212 |
+
---
|
| 213 |
+
|
| 214 |
+
## Listing & Discovery
|
| 215 |
+
|
| 216 |
+
### Where can I find RMI listed?
|
| 217 |
+
|
| 218 |
+
- **Smithery**: [smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence](https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence)
|
| 219 |
+
- **Glama**: [glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence](https://glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence)
|
| 220 |
+
- **mcp.so**: [mcp.so/server/rug-munch-intelligence](https://mcp.so/server/rug-munch-intelligence)
|
| 221 |
+
- **GitHub**: [github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp](https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp)
|
| 222 |
+
|
| 223 |
+
### How do I list RMI in my MCP client?
|
| 224 |
+
|
| 225 |
+
Use our discovery endpoint:
|
| 226 |
+
```
|
| 227 |
+
GET https://rugmunch.io/.well-known/mcp.json
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
This returns the full server metadata with capabilities, stats, and connection info.
|
| 231 |
+
|
| 232 |
+
---
|
| 233 |
+
|
| 234 |
+
## Troubleshooting
|
| 235 |
+
|
| 236 |
+
### I'm getting a 402 error
|
| 237 |
+
|
| 238 |
+
This means your free trials have expired. You need to either:
|
| 239 |
+
1. Connect a wallet for extended trials
|
| 240 |
+
2. Send an x402 payment header with your request
|
| 241 |
+
3. Use a different device fingerprint (not recommended — we detect abuse)
|
| 242 |
+
|
| 243 |
+
### Tool returned no data
|
| 244 |
+
|
| 245 |
+
If a tool returns empty/null results, you're eligible for a **full refund**. Post to `/api/v1/x402/refund` with your transaction hash within 48 hours.
|
| 246 |
+
|
| 247 |
+
### My wallet isn't connecting
|
| 248 |
+
|
| 249 |
+
Make sure you're using a supported wallet (MetaMask, Phantom, Solflare, etc.) and that your wallet is connected to the correct chain. For EVM tools, switch to Base or Ethereum. For Solana tools, use Phantom/Solflare.
|
| 250 |
+
|
| 251 |
+
### I hit the rate limit
|
| 252 |
+
|
| 253 |
+
Wait an hour for the window to reset. If you need higher limits, contact mcp@rugmunch.io for enterprise pricing.
|
| 254 |
+
|
| 255 |
+
---
|
| 256 |
+
|
| 257 |
+
## Contact & Support
|
| 258 |
+
|
| 259 |
+
- **Website**: https://rugmunch.io
|
| 260 |
+
- **Documentation**: https://rugmunch.io/docs/mcp
|
| 261 |
+
- **Email**: mcp@rugmunch.io
|
| 262 |
+
- **GitHub**: https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp
|
| 263 |
+
- **Twitter**: @CryptoRugMunch
|
backend/docs/MCP-README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rug Munch Intelligence — MCP Server Documentation
|
| 2 |
+
|
| 3 |
+
> **210 crypto intelligence tools · 13 blockchains · x402 micropayments · Free trials**
|
| 4 |
+
|
| 5 |
+
[](https://modelcontextprotocol.io)
|
| 6 |
+
[](https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence)
|
| 7 |
+
[](https://glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence)
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Overview
|
| 12 |
+
|
| 13 |
+
Rug Munch Intelligence (RMI) is a crypto security and market intelligence MCP server. It provides **210 tools** across **13 blockchains** for scam detection, rug pull prevention, wallet forensics, whale tracking, contract auditing, and market analysis — accessible via the Model Context Protocol.
|
| 14 |
+
|
| 15 |
+
Every tool offers **1–5 free trial calls** (gated by device fingerprint) and **x402 micropayments** ($0.01–$0.40/call) via 8 payment facilitators across 13 chains.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## Architecture
|
| 20 |
+
|
| 21 |
+
```
|
| 22 |
+
┌─────────────────────────────────────────────────────────┐
|
| 23 |
+
│ AI Agent (Claude, Cursor, GPT, Windsurf, etc.) │
|
| 24 |
+
│ Uses MCP protocol to discover and call tools │
|
| 25 |
+
└───────────────────────┬─────────────────────────────────┘
|
| 26 |
+
│ MCP (HTTP/SSE)
|
| 27 |
+
▼
|
| 28 |
+
┌─────────────────────────────────────────────────────────┐
|
| 29 |
+
│ rugmunch.io/mcp │
|
| 30 |
+
│ MCP Server — 210 tools, schema discovery │
|
| 31 |
+
├─────────────────────────────────────────────────────────┤
|
| 32 |
+
│ x402 Payment Gatekeeper │
|
| 33 |
+
│ Trial enforcement → Payment required → 402 response │
|
| 34 |
+
│ 8 facilitators × 13 chains × USDC/USDT/BTC/EUR │
|
| 35 |
+
├─────────────────────────────────────────────────────────┤
|
| 36 |
+
│ FastAPI Backend — 80+ modules │
|
| 37 |
+
│ Security · Intelligence · Market · Social · Forensics │
|
| 38 |
+
├─────────────────────────────────────────────────────────┤
|
| 39 |
+
│ Data Layer │
|
| 40 |
+
│ DexScreener · CoinGecko · Helius · Birdeye · Jupiter │
|
| 41 |
+
│ Etherscan · Moralis · DefiLlama · 28 providers │
|
| 42 |
+
└─────────────────────────────────────────────────────────┘
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## Quick Start
|
| 48 |
+
|
| 49 |
+
### Claude Desktop
|
| 50 |
+
|
| 51 |
+
```json
|
| 52 |
+
{
|
| 53 |
+
"mcpServers": {
|
| 54 |
+
"rug-munch-intelligence": {
|
| 55 |
+
"command": "npx",
|
| 56 |
+
"args": ["-y", "mcp-remote@latest", "https://rugmunch.io/mcp"],
|
| 57 |
+
"env": {}
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Cursor / Windsurf
|
| 64 |
+
|
| 65 |
+
```json
|
| 66 |
+
{
|
| 67 |
+
"mcpServers": {
|
| 68 |
+
"rug-munch-intelligence": {
|
| 69 |
+
"url": "https://rugmunch.io/mcp",
|
| 70 |
+
"transport": "http"
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
### Raw HTTP (cURL)
|
| 77 |
+
|
| 78 |
+
```bash
|
| 79 |
+
# Discover available tools
|
| 80 |
+
curl https://rugmunch.io/api/v1/x402-tools/discovery
|
| 81 |
+
|
| 82 |
+
# Call a tool (free trial — no payment needed)
|
| 83 |
+
curl -X POST https://rugmunch.io/api/v1/x402-tools/rugshield \
|
| 84 |
+
-H "Content-Type: application/json" \
|
| 85 |
+
-H "X-Client-ID: my-fingerprint-id" \
|
| 86 |
+
-d '{"address": "So11111111111111111111111111111111111111112", "chain": "solana"}'
|
| 87 |
+
|
| 88 |
+
# Call a paid tool (with x402 payment)
|
| 89 |
+
curl -X POST https://rugmunch.io/api/v1/x402-tools/audit \
|
| 90 |
+
-H "Content-Type: application/json" \
|
| 91 |
+
-H "x-pay: <x402-payment-header>" \
|
| 92 |
+
-d '{"address": "0x...", "chain": "ethereum"}'
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Python
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
import requests
|
| 99 |
+
|
| 100 |
+
# Discover
|
| 101 |
+
tools = requests.get("https://rugmunch.io/api/v1/x402-tools/discovery").json()
|
| 102 |
+
print(f"{tools['total_tools']} tools available")
|
| 103 |
+
|
| 104 |
+
# Free trial call
|
| 105 |
+
result = requests.post(
|
| 106 |
+
"https://rugmunch.io/api/v1/x402-tools/rugshield",
|
| 107 |
+
headers={"X-Client-ID": "my-app"},
|
| 108 |
+
json={"address": "So11111111111111111111111111111111111111112", "chain": "solana"}
|
| 109 |
+
).json()
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## Tool Categories
|
| 115 |
+
|
| 116 |
+
| Category | Count | Highlight Tools |
|
| 117 |
+
|----------|-------|----------------|
|
| 118 |
+
| 🔒 Security | 29 + 9 SENTINEL | `audit`, `rugshield`, `honeypot_check`, `sentinel_scan`, `holder_analysis`, `flash_loan_detect`, `governance_attack` |
|
| 119 |
+
| 🧠 Intelligence | 27 | `smartmoney`, `whale_scan`, `cluster`, `insider`, `cross_chain_whale`, `degen_score`, `wallet_label_registry` |
|
| 120 |
+
| 📊 Market | 15 | `pulse`, `market_overview`, `chain_health`, `funding_rate`, `options_flow`, `liquidation_heatmap`, `volatility_surface` |
|
| 121 |
+
| 🔬 Analysis | 14 | `wallet`, `wallet_pnl`, `portfolio_tracker`, `forensics`, `correlation_matrix`, `drawdown_analyzer`, `volume_profile` |
|
| 122 |
+
| 💬 Social | 11 | `sentiment`, `social_signal`, `tw_profile`, `meme_vibe_score`, `telegram_pump_detect`, `discord_alpha`, `reddit_sentiment` |
|
| 123 |
+
| 🚀 Launch | 7 | `launch`, `launch_intel`, `airdrop_finder`, `presale_scanner`, `ido_tracker`, `fair_launch_detect` |
|
| 124 |
+
| 🔎 Premium | 7 | `forensic_valuation`, `osint_identity_hunt`, `deep_forensics`, `whale_network_map`, `cross_chain_trace`, `full_wallet_dossier` |
|
| 125 |
+
| 💎 DeFi | 4 | `defi_yield_scanner`, `yield_aggregator`, `impermanent_loss`, `protocol_risk` |
|
| 126 |
+
| 🖼 NFT | 2 | `nft_wash_detector`, `nft_floor_analytics` |
|
| 127 |
+
| 📦 Bundle | 4 | `security_pack`, `intelligence_pack`, `all_in_one`, `forensic_pack` |
|
| 128 |
+
| 🔌 API | 3 | `catalog`, `mcp-proxy`, `human-execute` |
|
| 129 |
+
| 🔄 Variant | 80 | Per-chain variants for Solana, Base, Ethereum, BSC |
|
| 130 |
+
|
| 131 |
+
**Total: 210 tools**
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
## Supported Blockchains
|
| 136 |
+
|
| 137 |
+
| Chain | Chain ID | USDC | USDT | BTC | EUR |
|
| 138 |
+
|-------|----------|------|------|-----|-----|
|
| 139 |
+
| Base | 8453 | ✅ | — | — | — |
|
| 140 |
+
| Solana | — | ✅ | — | — | — |
|
| 141 |
+
| Ethereum | 1 | ✅ | — | — | — |
|
| 142 |
+
| BSC | 56 | ✅ | ✅ | — | — |
|
| 143 |
+
| Arbitrum | 42161 | ✅ | — | — | — |
|
| 144 |
+
| Optimism | 10 | ✅ | — | — | — |
|
| 145 |
+
| Polygon | 137 | ✅ | — | — | — |
|
| 146 |
+
| Avalanche | 43114 | ✅ | — | — | — |
|
| 147 |
+
| Fantom | 250 | ✅ | — | — | — |
|
| 148 |
+
| Gnosis | 100 | ✅ | — | — | — |
|
| 149 |
+
| TRON | — | ✅ | ✅ | — | — |
|
| 150 |
+
| Bitcoin | — | — | — | ✅ | — |
|
| 151 |
+
| SEPA (EUR) | — | — | — | — | ✅ |
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
+
|
| 155 |
+
## Payment Facilitators
|
| 156 |
+
|
| 157 |
+
| Facilitator | Chains | Asset | Fee | Description |
|
| 158 |
+
|------------|--------|-------|-----|-------------|
|
| 159 |
+
| Coinbase CDP | Base, Solana | USDC | Free | Fee-free via Coinbase Developer Platform |
|
| 160 |
+
| PayAI | Base, Solana | USDC | Variable | Deferred settlement |
|
| 161 |
+
| Cloudflare x402 | Base Sepolia, Ethereum | USDC | Low | Cloudflare-managed facilitation |
|
| 162 |
+
| EIP-7702 | BSC, Polygon, Avalanche, Fantom, Gnosis, Arbitrum, Optimism, Base | USDC | Low | Universal EVM via EIP-7702 authorization |
|
| 163 |
+
| TRON Self-Verify | TRON | USDT/USDC/USDD | Free | Self-verified via TronGrid API |
|
| 164 |
+
| Bitcoin Self-Verify | Bitcoin | BTC | Free | Self-verified via Mempool.space (1-conf) |
|
| 165 |
+
| AsterPay | SEPA | EUR | Variable | European bank transfer |
|
| 166 |
+
| x402-rs | Multi-chain | USDC | Low | Self-hosted x402-rs Docker |
|
| 167 |
+
|
| 168 |
+
---
|
| 169 |
+
|
| 170 |
+
## Pricing & Trials
|
| 171 |
+
|
| 172 |
+
| Tier | Cost | Description |
|
| 173 |
+
|------|------|-------------|
|
| 174 |
+
| **Free Trial** | $0 | 1–5 calls per tool. Device fingerprint-gated. No wallet needed. |
|
| 175 |
+
| **Wallet Connected** | $0 | Connect wallet for 3 free calls per standard tool, 1 per premium. |
|
| 176 |
+
| **Pay Per Call** | $0.01–$0.40 | x402 micropayment per call. Auto-handled by MCP client. |
|
| 177 |
+
|
| 178 |
+
### Refund Policy
|
| 179 |
+
- **Full refund** if a tool returns no data
|
| 180 |
+
- Request within 48 hours via `POST /api/v1/x402/refund` with transaction hash
|
| 181 |
+
- No questions asked on empty-result refunds
|
| 182 |
+
|
| 183 |
+
---
|
| 184 |
+
|
| 185 |
+
## Authentication Hierarchy
|
| 186 |
+
|
| 187 |
+
1. **No auth** → Trial mode (1–5 free calls, fingerprint-gated)
|
| 188 |
+
2. **Wallet signature** → Extended trials (3 per tool, wallet-gated)
|
| 189 |
+
3. **x402 payment** → Full access (micropayment per call)
|
| 190 |
+
4. **API key** → Subscription access (coming soon)
|
| 191 |
+
|
| 192 |
+
---
|
| 193 |
+
|
| 194 |
+
## Error Handling
|
| 195 |
+
|
| 196 |
+
| HTTP Code | Meaning | Action |
|
| 197 |
+
|-----------|---------|--------|
|
| 198 |
+
| 200 | Success | Use response data |
|
| 199 |
+
| 402 | Payment Required | Send x402 payment header and retry |
|
| 200 |
+
| 429 | Rate Limited | Wait and retry with backoff |
|
| 201 |
+
| 404 | Tool Not Found | Check tool ID via `/discovery` |
|
| 202 |
+
| 500 | Server Error | Retry after brief delay |
|
| 203 |
+
|
| 204 |
+
---
|
| 205 |
+
|
| 206 |
+
## Rate Limits
|
| 207 |
+
|
| 208 |
+
- **Trial users**: 60 requests/hour per fingerprint
|
| 209 |
+
- **Paid users**: 300 requests/hour per wallet
|
| 210 |
+
- **Enterprise**: Custom limits — contact mcp@rugmunch.io
|
| 211 |
+
|
| 212 |
+
---
|
| 213 |
+
|
| 214 |
+
## Links & Resources
|
| 215 |
+
|
| 216 |
+
| Resource | URL |
|
| 217 |
+
|----------|-----|
|
| 218 |
+
| Website | https://rugmunch.io |
|
| 219 |
+
| Documentation | https://rugmunch.io/docs/mcp |
|
| 220 |
+
| MCP Endpoint | https://rugmunch.io/mcp |
|
| 221 |
+
| Discovery | https://rugmunch.io/.well-known/mcp.json |
|
| 222 |
+
| x402 Discovery | https://rugmunch.io/.well-known/x402 |
|
| 223 |
+
| GitHub | https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp |
|
| 224 |
+
| Smithery | https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence |
|
| 225 |
+
| Glama | https://glama.ai/mcp/servers/@cryptorugmuncher/rug-munch-intelligence |
|
| 226 |
+
|
| 227 |
+
---
|
| 228 |
+
|
| 229 |
+
## License
|
| 230 |
+
|
| 231 |
+
Proprietary — © 2024–2026 Rug Munch Media LLC. All rights reserved.
|
backend/docs/MCP-USER-GUIDE.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rug Munch Intelligence — User Guide
|
| 2 |
+
|
| 3 |
+
> **From zero to crypto intelligence in 5 minutes.** This guide walks you through connecting your wallet, running your first scan, and mastering all 210 tools.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Table of Contents
|
| 8 |
+
|
| 9 |
+
1. [Getting Started](#1-getting-started)
|
| 10 |
+
2. [Connecting Your Wallet](#2-connecting-your-wallet)
|
| 11 |
+
3. [Running Your First Scan](#3-running-your-first-scan)
|
| 12 |
+
4. [Understanding Results](#4-understanding-results)
|
| 13 |
+
5. [Tool Categories](#5-tool-categories)
|
| 14 |
+
6. [Payment Options](#6-payment-options)
|
| 15 |
+
7. [Choosing a Facilitator](#7-choosing-a-facilitator)
|
| 16 |
+
8. [Managing Trials & Credits](#8-managing-trials--credits)
|
| 17 |
+
9. [Advanced Usage](#9-advanced-usage)
|
| 18 |
+
10. [Refunds & Support](#10-refunds--support)
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## 1. Getting Started
|
| 23 |
+
|
| 24 |
+
### For AI Agent Users (Claude, Cursor, Windsurf)
|
| 25 |
+
|
| 26 |
+
1. Open your MCP configuration file
|
| 27 |
+
2. Add the RMI server connection
|
| 28 |
+
3. Restart your AI assistant
|
| 29 |
+
4. Start asking crypto security questions
|
| 30 |
+
|
| 31 |
+
```json
|
| 32 |
+
{
|
| 33 |
+
"mcpServers": {
|
| 34 |
+
"rug-munch-intelligence": {
|
| 35 |
+
"command": "npx",
|
| 36 |
+
"args": ["-y", "mcp-remote@latest", "https://rugmunch.io/mcp"]
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
✅ **That's it!** Your AI now has 210 crypto intelligence tools.
|
| 43 |
+
|
| 44 |
+
### For Human Users (Web Platform)
|
| 45 |
+
|
| 46 |
+
1. Visit [rugmunch.io](https://rugmunch.io)
|
| 47 |
+
2. Click **Sign In** or connect your wallet
|
| 48 |
+
3. Navigate to any tool page (Scanner, Intelligence, Markets)
|
| 49 |
+
4. Enter a token address or wallet and hit Scan
|
| 50 |
+
|
| 51 |
+
### For Developers (API)
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
# Discover all tools
|
| 55 |
+
curl https://rugmunch.io/api/v1/x402-tools/discovery
|
| 56 |
+
|
| 57 |
+
# Call a free-trial tool
|
| 58 |
+
curl -X POST https://rugmunch.io/api/v1/x402-tools/rugshield \
|
| 59 |
+
-H "Content-Type: application/json" \
|
| 60 |
+
-H "X-Client-ID: my-app-v1" \
|
| 61 |
+
-d '{"address": "So11111111111111111111111111111111111111112", "chain": "solana"}'
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## 2. Connecting Your Wallet
|
| 67 |
+
|
| 68 |
+
Connecting a wallet gives you **extended free trials** and enables **x402 micropayments** for paid calls.
|
| 69 |
+
|
| 70 |
+
### Supported Wallets
|
| 71 |
+
|
| 72 |
+
| Wallet | Chains | How to Connect |
|
| 73 |
+
|--------|--------|---------------|
|
| 74 |
+
| **MetaMask** | All EVM chains | Click "Connect Wallet" → Select MetaMask → Approve |
|
| 75 |
+
| **Phantom** | Solana + EVM | Click "Connect Wallet" → Select Phantom → Approve |
|
| 76 |
+
| **Solflare** | Solana | Click "Connect Wallet" → Select Solflare → Approve |
|
| 77 |
+
| **Backpack** | Solana | Click "Connect Wallet" → Select Backpack → Approve |
|
| 78 |
+
| **Coinbase Wallet** | Base, Ethereum | Click "Connect Wallet" → Select Coinbase → Approve |
|
| 79 |
+
| **Rainbow** | All EVM | Click "Connect Wallet" → Select Rainbow → Approve |
|
| 80 |
+
| **TronLink** | TRON | Click "Connect Wallet" → Select TronLink → Approve |
|
| 81 |
+
| **WalletConnect** | Any | Click "Connect Wallet" → Scan QR code |
|
| 82 |
+
|
| 83 |
+
### What happens when I connect?
|
| 84 |
+
|
| 85 |
+
1. Your wallet address is stored (we never request private keys)
|
| 86 |
+
2. You receive **3 free calls per standard tool**, **1 per premium tool**
|
| 87 |
+
3. For paid calls, you'll sign an EIP-3009 or EIP-712 authorization (no gas fees!)
|
| 88 |
+
4. Payment is settled on-chain by our facilitators
|
| 89 |
+
|
| 90 |
+
⚠️ **We never have access to your funds.** x402 authorizations are specific to the exact amount for each call.
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## 3. Running Your First Scan
|
| 95 |
+
|
| 96 |
+
### Quick Security Check
|
| 97 |
+
|
| 98 |
+
The fastest way to assess a token is `rugshield`:
|
| 99 |
+
|
| 100 |
+
```
|
| 101 |
+
POST /api/v1/x402-tools/rugshield
|
| 102 |
+
{
|
| 103 |
+
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1o",
|
| 104 |
+
"chain": "solana"
|
| 105 |
+
}
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
**Response includes:**
|
| 109 |
+
- Overall safety score (0–100)
|
| 110 |
+
- Category breakdown (liquidity, ownership, holders, contract)
|
| 111 |
+
- Red flags detected
|
| 112 |
+
- Risk level: Low / Medium / High / Critical
|
| 113 |
+
|
| 114 |
+
### Deep Contract Audit
|
| 115 |
+
|
| 116 |
+
For detailed vulnerability analysis:
|
| 117 |
+
|
| 118 |
+
```
|
| 119 |
+
POST /api/v1/x402-tools/audit
|
| 120 |
+
{
|
| 121 |
+
"address": "0x...",
|
| 122 |
+
"chain": "ethereum"
|
| 123 |
+
}
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
**Returns:** Slither analysis, proxy detection, ownership structure, reentrancy risks, access control assessment.
|
| 127 |
+
|
| 128 |
+
### Whale Tracking
|
| 129 |
+
|
| 130 |
+
See what smart money is doing:
|
| 131 |
+
|
| 132 |
+
```
|
| 133 |
+
POST /api/v1/x402-tools/whale_scan
|
| 134 |
+
{
|
| 135 |
+
"chain": "ethereum",
|
| 136 |
+
"min_value": 100000
|
| 137 |
+
}
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
## 4. Understanding Results
|
| 143 |
+
|
| 144 |
+
### Security Scores
|
| 145 |
+
|
| 146 |
+
| Score | Risk Level | Action |
|
| 147 |
+
|-------|-----------|--------|
|
| 148 |
+
| 80–100 | ✅ Low | Safe to interact with caution |
|
| 149 |
+
| 60–79 | ⚠️ Medium | Research further before investing |
|
| 150 |
+
| 40–59 | 🔴 High | Significant risk — proceed with extreme caution |
|
| 151 |
+
| 0–39 | 💀 Critical | Likely scam — do not interact |
|
| 152 |
+
|
| 153 |
+
### Risk Categories
|
| 154 |
+
|
| 155 |
+
- **Liquidity Risk**: Is liquidity locked? Can it be removed?
|
| 156 |
+
- **Ownership Risk**: Is ownership renounced? Can contract be upgraded?
|
| 157 |
+
- **Holder Risk**: Is supply concentrated in few wallets?
|
| 158 |
+
- **Contract Risk**: Are there hidden mint functions? Transfer restrictions?
|
| 159 |
+
- **Social Risk**: Are social signals aligned with on-chain data?
|
| 160 |
+
|
| 161 |
+
---
|
| 162 |
+
|
| 163 |
+
## 5. Tool Categories
|
| 164 |
+
|
| 165 |
+
| Category | Tools | Best For |
|
| 166 |
+
|----------|-------|----------|
|
| 167 |
+
| 🔒 Security | 38 (29 + 9 SENTINEL) | Pre-investment safety checks, deep token scanning |
|
| 168 |
+
| 🧠 Intelligence | 27 | Smart money, whale, insider tracking |
|
| 169 |
+
| 📊 Market | 15 | Price, trends, arbitrage, yields, options |
|
| 170 |
+
| 🔬 Analysis | 14 | Wallet forensics, portfolio, correlation, drawdown |
|
| 171 |
+
| 💬 Social | 11 | Sentiment, Twitter, Discord, Telegram, Reddit |
|
| 172 |
+
| 🚀 Launch | 7 | New token discovery, presale, IDO tracking |
|
| 173 |
+
| 🔎 Premium | 7 | Institutional-grade forensics, OSINT |
|
| 174 |
+
| 💎 DeFi | 4 | Yield scanning, aggregator, impermanent loss |
|
| 175 |
+
| 🖼 NFT | 2 | Wash trading detection, floor analytics |
|
| 176 |
+
|
| 177 |
+
Browse all 210 tools at [rugmunch.io/tools](https://rugmunch.io/tools)
|
| 178 |
+
|
| 179 |
+
---
|
| 180 |
+
|
| 181 |
+
## 6. Payment Options
|
| 182 |
+
|
| 183 |
+
### Free Trials (No Wallet Needed)
|
| 184 |
+
|
| 185 |
+
Every tool offers 1–5 free calls. No sign-up required. Trials reset per device fingerprint.
|
| 186 |
+
|
| 187 |
+
### x402 Micropayments (Per Call)
|
| 188 |
+
|
| 189 |
+
| Tier | Cost | Access |
|
| 190 |
+
|------|------|--------|
|
| 191 |
+
| Free Trial | $0 | 1–5 calls/tool, fingerprint-gated |
|
| 192 |
+
| Wallet Connected | $0 | 3 calls/tool (standard), 1/premium |
|
| 193 |
+
| Pay Per Call | $0.01–$0.40 | Unlimited, x402 micropayment |
|
| 194 |
+
|
| 195 |
+
### Accepted Currencies
|
| 196 |
+
|
| 197 |
+
- **USDC**: Base, Solana, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis
|
| 198 |
+
- **USDT/USDD**: TRON
|
| 199 |
+
- **BTC**: Bitcoin (1-confirmation)
|
| 200 |
+
- **EUR**: SEPA transfer via AsterPay
|
| 201 |
+
|
| 202 |
+
---
|
| 203 |
+
|
| 204 |
+
## 7. Choosing a Facilitator
|
| 205 |
+
|
| 206 |
+
| Facilitator | Chains | Asset | Fee | Best For |
|
| 207 |
+
|------------|--------|-------|-----|----------|
|
| 208 |
+
| Coinbase CDP | Base, Solana | USDC | Free | Everyday use, lowest cost |
|
| 209 |
+
| PayAI | Base, Solana | USDC | Variable | Deferred settlement |
|
| 210 |
+
| EIP-7702 | All EVM | USDC | Low | Any EVM chain |
|
| 211 |
+
| TRON Self-Verify | TRON | USDT/USDC/USDD | Free | TRON users |
|
| 212 |
+
| Bitcoin Self-Verify | Bitcoin | BTC | Free | BTC holders |
|
| 213 |
+
| AsterPay | SEPA | EUR | Variable | European users |
|
| 214 |
+
| x402-rs | Multi-chain | USDC | Low | Self-hosted |
|
| 215 |
+
|
| 216 |
+
**Recommendation**: Use **Coinbase CDP** for Base/Solana USDC (fee-free). For TRON, use TRON Self-Verify. For BTC, use Bitcoin Self-Verify. For European bank transfers, use AsterPay.
|
| 217 |
+
|
| 218 |
+
---
|
| 219 |
+
|
| 220 |
+
## 8. Managing Trials & Credits
|
| 221 |
+
|
| 222 |
+
### Check Your Trial Balance
|
| 223 |
+
|
| 224 |
+
```bash
|
| 225 |
+
# Via fingerprint
|
| 226 |
+
curl https://rugmunch.io/api/v1/x402-tools/trials?fingerprint=<your-id>
|
| 227 |
+
|
| 228 |
+
# Via wallet address
|
| 229 |
+
curl https://rugmunch.io/api/v1/x402-tools/trials?wallet=<your-address>
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
### Understanding Trial Refresh
|
| 233 |
+
|
| 234 |
+
- **Device fingerprint** trials: 1–5 per tool, refresh monthly
|
| 235 |
+
- **Wallet-connected** trials: 3 per standard, 1 per premium, refresh monthly
|
| 236 |
+
- **Paid calls**: No limit while funds are available
|
| 237 |
+
|
| 238 |
+
---
|
| 239 |
+
|
| 240 |
+
## 9. Advanced Usage
|
| 241 |
+
|
| 242 |
+
### Bundle Calls
|
| 243 |
+
|
| 244 |
+
Combine multiple tools for comprehensive analysis:
|
| 245 |
+
|
| 246 |
+
```
|
| 247 |
+
POST /api/v1/x402-tools/unified_scan
|
| 248 |
+
{
|
| 249 |
+
"address": "0x...",
|
| 250 |
+
"chain": "ethereum",
|
| 251 |
+
"checks": ["rugshield", "honeypot_check", "audit", "whale_scan"]
|
| 252 |
+
}
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
### Custom Watchlists
|
| 256 |
+
|
| 257 |
+
Use `risk_monitor` to set alerts for specific wallets or tokens:
|
| 258 |
+
|
| 259 |
+
```
|
| 260 |
+
POST /api/v1/x402-tools/risk_monitor
|
| 261 |
+
{
|
| 262 |
+
"address": "0x...",
|
| 263 |
+
"chain": "ethereum",
|
| 264 |
+
"alerts": ["liquidity_change", "ownership_change", "whale_movement"]
|
| 265 |
+
}
|
| 266 |
+
```
|
| 267 |
+
|
| 268 |
+
### MCP Client Configuration
|
| 269 |
+
|
| 270 |
+
For production agents, set environment variables:
|
| 271 |
+
|
| 272 |
+
```json
|
| 273 |
+
{
|
| 274 |
+
"mcpServers": {
|
| 275 |
+
"rug-munch-intelligence": {
|
| 276 |
+
"command": "npx",
|
| 277 |
+
"args": ["-y", "mcp-remote@latest", "https://rugmunch.io/mcp"],
|
| 278 |
+
"env": {
|
| 279 |
+
"X402_WALLET": "0x...",
|
| 280 |
+
"X402_FACILITATOR": "coinbase_cdp"
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
```
|
| 286 |
+
|
| 287 |
+
---
|
| 288 |
+
|
| 289 |
+
## 10. Refunds & Support
|
| 290 |
+
|
| 291 |
+
### Refund Policy
|
| 292 |
+
|
| 293 |
+
- **Full refund** if a tool returns no data
|
| 294 |
+
- Request within **48 hours** of the call
|
| 295 |
+
- Post to `/api/v1/x402/refund` with your transaction hash
|
| 296 |
+
- Refunds are processed on-chain within 24 hours
|
| 297 |
+
|
| 298 |
+
### Getting Help
|
| 299 |
+
|
| 300 |
+
- **Documentation**: https://rugmunch.io/docs/mcp
|
| 301 |
+
- **FAQ**: https://rugmunch.io/docs/mcp#faq
|
| 302 |
+
- **Email**: mcp@rugmunch.io
|
| 303 |
+
- **GitHub**: https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp
|
| 304 |
+
|
| 305 |
+
---
|
| 306 |
+
|
| 307 |
+
## Quick Reference Card
|
| 308 |
+
|
| 309 |
+
```
|
| 310 |
+
┌─────────────────────────────────────────────────┐
|
| 311 |
+
│ RMI Quick Reference │
|
| 312 |
+
├─────────────────────────────────────────────────┤
|
| 313 |
+
│ MCP Endpoint: https://rugmunch.io/mcp │
|
| 314 |
+
│ Discovery: https://rugmunch.io/.well-known │
|
| 315 |
+
│ API Base: https://rugmunch.io/api/v1 │
|
| 316 |
+
│ Docs: https://rugmunch.io/docs/mcp │
|
| 317 |
+
├─────────────────────────────────────────────────┤
|
| 318 |
+
│ Free Trials: 1-5/tool (no wallet) │
|
| 319 |
+
│ Paid Calls: $0.01-$0.40 via x402 │
|
| 320 |
+
│ Chains: 13 (incl. BTC, TRON, SEPA) │
|
| 321 |
+
│ Tools: 210 across 13 categories │
|
| 322 |
+
├─────────────────────────────────────────────────┤
|
| 323 |
+
│ Refund: Full refund if no data, 48h window │
|
| 324 |
+
│ Support: mcp@rugmunch.io │
|
| 325 |
+
└─────────────────────────────────────────────────┘
|
| 326 |
+
```
|
| 327 |
+
|
| 328 |
+
*© 2024–2026 Rug Munch Media LLC. All rights reserved.*
|
backend/docs/TOOLS-REFERENCE.md
ADDED
|
@@ -0,0 +1,673 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rug Munch Intelligence — Complete Tool Reference
|
| 2 |
+
|
| 3 |
+
> **210 tools · 13 blockchains · $0.01–$0.40/call · Free trials on every tool**
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Security Tools (29 + 9 SENTINEL = 38)
|
| 8 |
+
|
| 9 |
+
### Core Security Tools (29)
|
| 10 |
+
|
| 11 |
+
### `honeypot_check` — Honeypot Detector
|
| 12 |
+
**Price: $0.05 | Free trials: 2**
|
| 13 |
+
Simulates buy and sell transactions to verify you can actually sell a token. Tests transfer taxes, sell locks, blacklists, and trap mechanisms. Essential before aping into any new token.
|
| 14 |
+
- **Detects:** Buy-only mechanics, 99% sell tax, transfer pausability, blacklist traps
|
| 15 |
+
- **Chains:** All 13 supported chains
|
| 16 |
+
|
| 17 |
+
### `rug_pull_predictor` — Rug Pull Predictor
|
| 18 |
+
**Price: $0.10 | Free trials: 1**
|
| 19 |
+
AI-powered risk scoring using 12+ on-chain signals. Analyzes liquidity locks, ownership concentration, holder distribution, social signals, deployer history, and contract patterns.
|
| 20 |
+
- **Risk levels:** Low / Medium / High / Critical
|
| 21 |
+
- **Signals:** Liquidity lock duration, ownership renounce status, mint authority, proxy patterns
|
| 22 |
+
|
| 23 |
+
### `rugshield` — Rug Shield
|
| 24 |
+
**Price: $0.02 | Free trials: 3**
|
| 25 |
+
Fast multi-factor rug protection score. Quick scan ideal for rapid token evaluation.
|
| 26 |
+
- **Score:** 0-100 with breakdown by category
|
| 27 |
+
- **Best for:** Initial screening before deep audit
|
| 28 |
+
|
| 29 |
+
### `audit` — Smart Contract Audit
|
| 30 |
+
**Price: $0.05 | Free trials: 1**
|
| 31 |
+
Deep smart contract audit with Slither analysis. Vulnerability scanning, ownership structure mapping, proxy detection, and function-level risk assessment.
|
| 32 |
+
- **Covers:** Reentrancy, overflow, access control, timelock, upgrade patterns
|
| 33 |
+
- **Chains:** Ethereum, Base, BSC, Polygon, Arbitrum, Optimism
|
| 34 |
+
|
| 35 |
+
### `clone_detect` — Clone Detector
|
| 36 |
+
**Price: $0.02 | Free trials: 3**
|
| 37 |
+
Bytecode similarity analysis comparing contracts against known scam templates. Catches copycat scams before they rug.
|
| 38 |
+
- **Detection:** Exact clones, modified clones, template matches
|
| 39 |
+
- **Database:** 10,000+ known scam contracts
|
| 40 |
+
|
| 41 |
+
### `anomaly` — Market Anomaly Detector
|
| 42 |
+
**Price: $0.08 | Free trials: 0**
|
| 43 |
+
Volume spike detection, price manipulation alerts, liquidity anomalies, sentiment extremes. Market health assessment.
|
| 44 |
+
- **Alerts:** 5x volume spike, 30%+ price deviation, liquidity removal
|
| 45 |
+
|
| 46 |
+
### `risk_monitor` — Risk Monitor
|
| 47 |
+
**Price: $0.05 | Free trials: 1**
|
| 48 |
+
Real-time risk monitoring. Set alerts for wallets, tokens, or chains. Get notified of rug pulls, liquidity removals, whale dumps.
|
| 49 |
+
- **Alert types:** Smart contract changes, liquidity events, whale movements
|
| 50 |
+
|
| 51 |
+
### `mev_protection` — MEV Protection Checker
|
| 52 |
+
**Price: $0.08 | Free trials: 0**
|
| 53 |
+
Verify if your transaction is protected from MEV extraction. Sandwich attack risk assessment and protection recommendations.
|
| 54 |
+
|
| 55 |
+
### `mev_alert` — MEV Alert System
|
| 56 |
+
**Price: $0.08 | Free trials: 0**
|
| 57 |
+
Real-time sandwich attack, frontrun, and arbitrage detection with wallet protection recommendations.
|
| 58 |
+
|
| 59 |
+
### `bridge_security` — Bridge Security Monitor
|
| 60 |
+
**Price: $0.08 | Free trials: 0**
|
| 61 |
+
Cross-chain bridge TVL tracking, recent exploit history, audit status, withdrawal limits, and security scores.
|
| 62 |
+
|
| 63 |
+
### `bridge_health` — Bridge Health & Exploit Monitor
|
| 64 |
+
**Price: $0.10 | Free trials: 2**
|
| 65 |
+
Active exploit surveillance across 12 major bridges. Monitors TVL anomalies, detects suspicious withdrawal patterns, scores trust models (validator sets, optimistic, intent-based), and computes contagion risk when one bridge shows exploit signs. Generates human-readable security bulletins and JSON alerts.
|
| 66 |
+
- **Bridges:** LayerZero, Stargate, Across, Wormhole, Hop, Synapse, Axelar, Celer, DeBridge, Chainlink CCIP, Connext, Orbiter
|
| 67 |
+
- **Detects:** Critical TVL drops (-40%+ in 24h), anomalous outflow patterns, upgrade events, validator set changes
|
| 68 |
+
- **Scoring:** 5-factor security rating (TVL depth, decentralization, audit recency, exploit history, upgrade risk)
|
| 69 |
+
- **Cron mode:** `--alert` flag returns [SILENT] when all bridges healthy, full report on anomaly — ideal for automated monitoring
|
| 70 |
+
|
| 71 |
+
### `wash_trading` — Wash Trading Detector
|
| 72 |
+
**Price: $0.08 | Free trials: 0**
|
| 73 |
+
Identify fake volume patterns, self-trades, and artificial market activity across NFTs and tokens.
|
| 74 |
+
|
| 75 |
+
### `protocol_risk` — Protocol Risk Assessment
|
| 76 |
+
**Price: $0.08 | Free trials: 0**
|
| 77 |
+
TVL stability analysis, admin key review, upgrade patterns, oracle dependency, governance risk scoring.
|
| 78 |
+
|
| 79 |
+
### `scam_database` — Scam Database Lookup
|
| 80 |
+
**Price: $0.03 | Free trials: 0**
|
| 81 |
+
Check addresses against known scam, phishing, honeypot, and rug pull databases.
|
| 82 |
+
|
| 83 |
+
### `urlcheck` — URL Safety Check
|
| 84 |
+
**Price: $0.01 | Free trials: 3**
|
| 85 |
+
URL and domain safety check for crypto projects. Detects phishing sites, fake docs, and malicious redirects.
|
| 86 |
+
|
| 87 |
+
### `bundler_detect` — Bundler Detector
|
| 88 |
+
**Price: $0.05 | Free trials: 2**
|
| 89 |
+
MEV bundler activity detection. Sandwich attacks, frontrunning, backrunning patterns on Solana and EVM.
|
| 90 |
+
|
| 91 |
+
### `fresh_pair` — Fresh Pair Scanner
|
| 92 |
+
**Price: $0.03 | Free trials: 2**
|
| 93 |
+
Detect newly created trading pairs with liquidity depth, ownership concentration, and honeypot risk assessment.
|
| 94 |
+
|
| 95 |
+
### `profile_flip` — Profile Flip Detector
|
| 96 |
+
**Price: $0.03 | Free trials: 2**
|
| 97 |
+
Sudden profile changes before token launches. Twitter/X profile monitoring, domain swaps, branding pivots.
|
| 98 |
+
|
| 99 |
+
### `liquidity_migration` — Liquidity Migration Detector
|
| 100 |
+
**Price: $0.05 | Free trials: 2**
|
| 101 |
+
Detect tokens moving pools, chains, or protocols. Often a rug pull precursor signal.
|
| 102 |
+
|
| 103 |
+
### `deployer_history` — Deployer History
|
| 104 |
+
**Price: $0.05 | Free trials: 2**
|
| 105 |
+
Complete investigation of a contract deployer's history. Previous tokens, success rate, scam patterns across chains.
|
| 106 |
+
|
| 107 |
+
### `token_age` — Token Age Verifier
|
| 108 |
+
**Price: $0.01 | Free trials: 2**
|
| 109 |
+
Verify token creation date, contract age, migration history, proxy upgrades, and deployment patterns.
|
| 110 |
+
|
| 111 |
+
### `flash_loan_detect` — Flash Loan Attack Detector
|
| 112 |
+
**Price: $0.08 | Free trials: 2**
|
| 113 |
+
Detect flash loan attack patterns on any token or pool. Identifies price manipulation sequences, atomic arbitrage exploits, and governance vote flashes before damage occurs.
|
| 114 |
+
|
| 115 |
+
### `governance_attack` — Governance Attack Detector
|
| 116 |
+
**Price: $0.08 | Free trials: 2**
|
| 117 |
+
Detect governance manipulation and voting anomalies. Flags flash-loan voting, proposal hijacking, quorum exploitation, and centralized governance risk in DAO protocols.
|
| 118 |
+
|
| 119 |
+
### `contract_upgrade_monitor` — Contract Upgrade Monitor
|
| 120 |
+
**Price: $0.05 | Free trials: 2**
|
| 121 |
+
Monitor proxy contract upgrades in real-time. Detects malicious implementation swaps, hidden timelock changes, and privilege escalation through upgrade patterns.
|
| 122 |
+
|
| 123 |
+
### `reentrancy_scanner` — Reentrancy Scanner
|
| 124 |
+
**Price: $0.05 | Free trials: 2**
|
| 125 |
+
Scan smart contracts for reentrancy vulnerability patterns. Detects external calls before state updates, callback loops, and cross-function reentrancy attack surfaces.
|
| 126 |
+
|
| 127 |
+
### `dust_attack_detect` — Dust Attack Detector
|
| 128 |
+
**Price: $0.05 | Free trials: 2**
|
| 129 |
+
Identify dusting attacks and address poisoning. Traces micro-transactions from attacker wallets, detects lookalike address generation, and flags contaminated UTXO sets.
|
| 130 |
+
|
| 131 |
+
### `oracle_manipulation` — Oracle Manipulation Detector
|
| 132 |
+
**Price: $0.08 | Free trials: 2**
|
| 133 |
+
Detect oracle price manipulation attack vectors. Analyzes feed latency, stale price windows, single-source dependencies, and historical manipulation events for any DeFi protocol.
|
| 134 |
+
|
| 135 |
+
### `privilege_escalation` — Privilege Escalation Detector
|
| 136 |
+
**Price: $0.05 | Free trials: 2**
|
| 137 |
+
Detect excessive contract owner privileges. Flags unlimited mint functions, emergency_PAUSE backdoors, transfer blocklists, and hidden admin roles in token contracts.
|
| 138 |
+
|
| 139 |
+
### `phantom_mint_detect` — Phantom Mint Detector
|
| 140 |
+
**Price: $0.05 | Free trials: 2**
|
| 141 |
+
Detect phantom minting attacks where hidden mint functions create tokens from nowhere. Scans contract bytecode for unauthorized mint paths, inflation exploits, and supply manipulation vectors.
|
| 142 |
+
|
| 143 |
+
### `wallet_drain_scanner` — Wallet Drain Scanner
|
| 144 |
+
**Price: $0.05 | Free trials: 2**
|
| 145 |
+
Scan wallet for dangerous token approvals and signatures. Identifies unlimited spending approvals, phishing permit signatures, and drain contract vulnerabilities.
|
| 146 |
+
|
| 147 |
+
### SENTINEL Deep Scan Modules (9)
|
| 148 |
+
|
| 149 |
+
### `sentinel_scan` — SENTINEL Full Deep Scan
|
| 150 |
+
**Price: $0.15 | Free trials: 1**
|
| 151 |
+
All 9 SENTINEL modules in parallel with graceful degradation. The most comprehensive token security scan available. Graded risk score from 0-100.
|
| 152 |
+
|
| 153 |
+
### `holder_analysis` — Holder Analysis
|
| 154 |
+
**Price: $0.05 | Free trials: 2**
|
| 155 |
+
HHI concentration, fake diversification detection, whale ratio, holder health score.
|
| 156 |
+
|
| 157 |
+
### `bundle_detect` — Bundle Detection (SENTINEL)
|
| 158 |
+
**Price: $0.08 | Free trials: 2**
|
| 159 |
+
Enhanced bundle/sniper detection, same-block group analysis, MEV exposure.
|
| 160 |
+
|
| 161 |
+
### `exchange_fund_check` — CEX Fund Check
|
| 162 |
+
**Price: $0.05 | Free trials: 2**
|
| 163 |
+
CEX-funded wallet detection, withdrawal clustering, deposit-to-dump patterns.
|
| 164 |
+
|
| 165 |
+
### `liquidity_verify` — Liquidity Verification
|
| 166 |
+
**Price: $0.05 | Free trials: 2**
|
| 167 |
+
Lock verification, fake locker detection, timelock analysis, rug-proof LP assessment.
|
| 168 |
+
|
| 169 |
+
### `dev_reputation` — Developer Reputation
|
| 170 |
+
**Price: $0.05 | Free trials: 2**
|
| 171 |
+
Serial rugg detection, cross-chain deployer tracking, team history analysis.
|
| 172 |
+
|
| 173 |
+
### `wash_trading` — Wash Trading (SENTINEL)
|
| 174 |
+
**Price: $0.08 | Free trials: 2**
|
| 175 |
+
Circular transfer detection, cross-DEX loops, volume anomaly scoring.
|
| 176 |
+
|
| 177 |
+
### `metadata_fingerprint` — Metadata Fingerprint
|
| 178 |
+
**Price: $0.05 | Free trials: 2**
|
| 179 |
+
HTML structure hashing, description similarity, social fingerprinting, clone project detection.
|
| 180 |
+
|
| 181 |
+
### `pumpfun_analysis` — PumpFun Analysis
|
| 182 |
+
**Price: $0.08 | Free trials: 2**
|
| 183 |
+
Bonding curve progress, bot detection, dev wallet concentration, early buyer patterns. Solana only.
|
| 184 |
+
|
| 185 |
+
### `sentiment_check` — SENTINEL Sentiment Check
|
| 186 |
+
**Price: $0.05 | Free trials: 2**
|
| 187 |
+
Social sentiment scoring, bot campaign detection, artificial hype flagging, pump probability.
|
| 188 |
+
|
| 189 |
+
---
|
| 190 |
+
|
| 191 |
+
## Intelligence Tools (27)
|
| 192 |
+
|
| 193 |
+
### `whale` — Whale Wallet Decoder
|
| 194 |
+
**Price: $0.15 | Free trials: 1**
|
| 195 |
+
Advanced whale wallet decoder. Solana/EVM balance, TX pattern analysis, DexScreener pair association, Blockchair multi-chain stats. Identifies whale persona, activity level, and trust score.
|
| 196 |
+
- **Persona types:** Accumulator, Distributor, Market Maker, Degen, Institutional
|
| 197 |
+
- **Data:** Holdings, trade history, PnL, associated wallets, risk profile
|
| 198 |
+
|
| 199 |
+
### `whale_scan` — Whale Scanner
|
| 200 |
+
**Price: $0.03 | Free trials: 2**
|
| 201 |
+
Real-time whale activity across chains. Large transfers, exchange deposits, accumulation signals.
|
| 202 |
+
|
| 203 |
+
### `whale_accumulation` — Whale Accumulation Detector
|
| 204 |
+
**Price: $0.08 | Free trials: 0**
|
| 205 |
+
Track large wallet accumulation and distribution patterns. Know what whales are buying and dumping.
|
| 206 |
+
|
| 207 |
+
### `whale_profile` — Whale Profile
|
| 208 |
+
**Price: $0.05 | Free trials: 1**
|
| 209 |
+
Detailed analysis of a whale wallet: holdings, strategy classification, historical performance, influence score.
|
| 210 |
+
|
| 211 |
+
### `smartmoney` — Smart Money Tracker
|
| 212 |
+
**Price: $0.05 | Free trials: 1**
|
| 213 |
+
Track smart money wallets and whale movements across chains. Find what profitable traders are buying before the crowd.
|
| 214 |
+
- **Metrics:** Win rate, average ROI, trade frequency, token preferences
|
| 215 |
+
|
| 216 |
+
### `smart_money_alpha` — Smart Money Alpha
|
| 217 |
+
**Price: $0.01 | Free trials: 1**
|
| 218 |
+
Real-time alerts when top-performing wallets enter new positions. Copy the best traders.
|
| 219 |
+
|
| 220 |
+
### `insider` — Insider Trading Detection
|
| 221 |
+
**Price: $0.10 | Free trials: 0**
|
| 222 |
+
Track wallet funding patterns, pre-launch accumulation, and coordinated buying before major events.
|
| 223 |
+
- **Signals:** Pre-listing accumulation, team wallet activity, coordinated entry patterns
|
| 224 |
+
|
| 225 |
+
### `insider_network` — Insider Network Mapper
|
| 226 |
+
**Price: $0.10 | Free trials: 0**
|
| 227 |
+
Trace connected wallets, shared funding sources, coordinated trading patterns across addresses.
|
| 228 |
+
|
| 229 |
+
### `cluster` — Wallet Cluster Analysis
|
| 230 |
+
**Price: $0.05 | Free trials: 0**
|
| 231 |
+
Identify linked wallets, Sybil networks, and coordinated manipulation across addresses.
|
| 232 |
+
- **Detection:** Shared funding, transaction correlation, temporal patterns
|
| 233 |
+
|
| 234 |
+
### `syndicate_scan` — Syndicate Scanner
|
| 235 |
+
**Price: $0.08 | Free trials: 0**
|
| 236 |
+
Identify coordinated trading groups, wash trading rings, and pump-and-dump networks.
|
| 237 |
+
|
| 238 |
+
### `syndicate_track` — Syndicate Tracker
|
| 239 |
+
**Price: $0.10 | Free trials: 0**
|
| 240 |
+
Follow known syndicate wallets, monitor their current positions and exit patterns.
|
| 241 |
+
|
| 242 |
+
### `copy_trade_finder` — Copy Trade Finder
|
| 243 |
+
**Price: $0.10 | Free trials: 0**
|
| 244 |
+
Find profitable wallets, their win rates, best performing trades, and current positions. Auto-identifies smart money worth following.
|
| 245 |
+
|
| 246 |
+
### `sniper_detect` — Sniper Detector
|
| 247 |
+
**Price: $0.08 | Free trials: 1**
|
| 248 |
+
Detect sniper bots on token launches. Block-0 buys, MEV bundles, sandwich patterns.
|
| 249 |
+
|
| 250 |
+
### `sniper_alert` — Sniper Alert
|
| 251 |
+
**Price: $0.05 | Free trials: 2**
|
| 252 |
+
Real-time sniper bot detection on new token launches. Get in before or after the snipers.
|
| 253 |
+
|
| 254 |
+
### `wallet_graph` — Wallet Graph Analysis
|
| 255 |
+
**Price: $0.10 | Free trials: 0**
|
| 256 |
+
Visualize transaction flows between wallets. Identify money laundering patterns and entity relationships.
|
| 257 |
+
|
| 258 |
+
### `alpha_digest` — Alpha Digest
|
| 259 |
+
**Price: $0.10 | Free trials: 1**
|
| 260 |
+
Curated crypto alpha from top-performing wallets, on-chain signals, sentiment spikes, and accumulation patterns.
|
| 261 |
+
|
| 262 |
+
### `airdrop_finder` — Airdrop Finder
|
| 263 |
+
**Price: $0.05 | Free trials: 2**
|
| 264 |
+
Discover active and upcoming airdrops across all major chains. Eligibility checks, value estimation, claim deadlines, and Sybil detection.
|
| 265 |
+
|
| 266 |
+
### `airdrop_check` — Airdrop Check
|
| 267 |
+
**Price: $0.05 | Free trials: 2**
|
| 268 |
+
Verify airdrop legitimacy. Contract audit, distribution analysis, scam pattern detection. Know if an airdrop is real or a wallet drainer before connecting.
|
| 269 |
+
|
| 270 |
+
### `cross_chain_whale` — Cross-Chain Whale Tracker
|
| 271 |
+
**Price: $0.08 | Free trials: 2**
|
| 272 |
+
Track whale wallets across multiple blockchains simultaneously. Maps cross-chain capital flows, bridge migrations, and multi-network positioning.
|
| 273 |
+
|
| 274 |
+
### `degen_score` — Degen Score
|
| 275 |
+
**Price: $0.05 | Free trials: 2**
|
| 276 |
+
Calculate degen trading behavior score for any wallet. Evaluates leverage usage, meme token exposure, entry timing quality, and risk-on appetite with percentile ranking.
|
| 277 |
+
|
| 278 |
+
### `dormant_whale_alert` — Dormant Whale Alert
|
| 279 |
+
**Price: $0.05 | Free trials: 2**
|
| 280 |
+
Alert when dormant large wallets become active. Monitors long-inactive top holders for reactivation signals, first transfers, and exchange deposits that precede market moves.
|
| 281 |
+
|
| 282 |
+
### `smart_contract_interactions` — Smart Contract Interactions
|
| 283 |
+
**Price: $0.05 | Free trials: 2**
|
| 284 |
+
Map all contract interactions for a given address. Reconstructs call graphs, identifies frequently-used protocols, and surfaces unknown delegate calls or suspicious relationships.
|
| 285 |
+
|
| 286 |
+
### `token_distribution_health` — Token Distribution Health
|
| 287 |
+
**Price: $0.05 | Free trials: 2**
|
| 288 |
+
Assess the health of token holder distribution. Computes Gini coefficient, Herfindahl index, top-10 concentration risk, and compares distribution trajectory over time.
|
| 289 |
+
|
| 290 |
+
### `token_velocity` — Token Velocity
|
| 291 |
+
**Price: $0.05 | Free trials: 2**
|
| 292 |
+
Analyze token circulation speed and holding patterns. Computes turnover rate, velocity of money, dormant supply ratio, and compares against sector benchmarks.
|
| 293 |
+
|
| 294 |
+
### `wallet_label_registry` — Wallet Label Registry
|
| 295 |
+
**Price: $0.05 | Free trials: 2**
|
| 296 |
+
Enrich wallet addresses with known entity labels. Resolves exchange hot wallets, institutional addresses, MEV bot identities, known scammers, and fund manager tags.
|
| 297 |
+
|
| 298 |
+
### `wallet_cluster_score` — Wallet Cluster Score
|
| 299 |
+
**Price: $0.08 | Free trials: 2**
|
| 300 |
+
Score wallet clusters for manipulation risk probability. Combines funding-source analysis, behavioral correlation, and timing patterns to rate coordinated group threat level.
|
| 301 |
+
|
| 302 |
+
---
|
| 303 |
+
|
| 304 |
+
## Market Tools (15)
|
| 305 |
+
|
| 306 |
+
### `pulse` — Market Pulse
|
| 307 |
+
**Price: $0.01 | Free trials: 3**
|
| 308 |
+
Real-time market dashboard. Token momentum, volume spikes, whale alerts, trending tokens across all major chains.
|
| 309 |
+
|
| 310 |
+
### `market_overview` — Market Overview
|
| 311 |
+
**Price: $0.05 | Free trials: 0**
|
| 312 |
+
Comprehensive crypto market overview. BTC/ETH prices, chain TVL, trending coins, top markets, BTC fees, news sentiment. Aggregates 10+ public sources.
|
| 313 |
+
|
| 314 |
+
### `chain_health` — Chain Health
|
| 315 |
+
**Price: $0.05 | Free trials: 0**
|
| 316 |
+
Chain health metrics. TVL, active protocols, gas fees, block times, network stats for Ethereum, Solana, Base, BSC.
|
| 317 |
+
|
| 318 |
+
### `gas_forecast` — Gas Forecaster
|
| 319 |
+
**Price: $0.05 | Free trials: 0**
|
| 320 |
+
Predicts optimal transaction times across chains. Tracks gas trends, suggests cheapest windows for swaps, mints, and transfers.
|
| 321 |
+
|
| 322 |
+
### `defi_yield_scanner` — DeFi Yield Scanner
|
| 323 |
+
**Price: $0.08 | Free trials: 1**
|
| 324 |
+
Finds best APYs across chains. Detects unsustainable yields, checks protocol TVL trends, impermanent loss risk, smart contract age.
|
| 325 |
+
|
| 326 |
+
### `arbitrage_scan` — Arbitrage Scanner
|
| 327 |
+
**Price: $0.05 | Free trials: 2**
|
| 328 |
+
Cross-chain and cross-DEX arbitrage scanner. Find price discrepancies across exchanges for instant profit opportunities.
|
| 329 |
+
|
| 330 |
+
### `liquidity_depth` — Liquidity Depth Analyzer
|
| 331 |
+
**Price: $0.05 | Free trials: 0**
|
| 332 |
+
Order book depth, slippage estimation, market impact across DEXs and chains.
|
| 333 |
+
|
| 334 |
+
### `liquidity_flow` — Liquidity Flow Tracker
|
| 335 |
+
**Price: $0.08 | Free trials: 0**
|
| 336 |
+
Track where capital is moving across chains, pools, and protocols. Front-run liquidity migrations.
|
| 337 |
+
|
| 338 |
+
### `unlock_calendar` — Token Unlock Calendar
|
| 339 |
+
**Price: $0.03 | Free trials: 2**
|
| 340 |
+
Track vesting schedules, team token unlocks, upcoming dilution events that move prices.
|
| 341 |
+
|
| 342 |
+
### `funding_rate` — Funding Rate Monitor
|
| 343 |
+
**Price: $0.05 | Free trials: 2**
|
| 344 |
+
Monitor and analyze perpetual futures funding rates. Tracks real-time rates across exchanges, identifies extreme positioning, and correlates funding with spot price action.
|
| 345 |
+
|
| 346 |
+
### `options_flow` — Options Flow Tracker
|
| 347 |
+
**Price: $0.08 | Free trials: 2**
|
| 348 |
+
Track unusual options activity and large block trades. Detects smart money positioning through IV skew, put/call ratio anomalies, and outsized OI changes on crypto derivatives.
|
| 349 |
+
|
| 350 |
+
### `dex_volume_rank` — DEX Volume Rank
|
| 351 |
+
**Price: $0.05 | Free trials: 2**
|
| 352 |
+
Rank tokens by decentralized exchange trading volume. Computes volume-weighted momentum scores, compares DEX vs CEX volume distribution, and surfaces volume outliers trending up.
|
| 353 |
+
|
| 354 |
+
### `liquidation_heatmap` — Liquidation Heatmap
|
| 355 |
+
**Price: $0.05 | Free trials: 2**
|
| 356 |
+
Visualize liquidation clusters and cascade risk zones. Maps leveraged position concentrations by price level, estimates cascade threshold prices, and highlights DeFi protocol vulnerability.
|
| 357 |
+
|
| 358 |
+
### `orderbook_imbalance` — Orderbook Imbalance
|
| 359 |
+
**Price: $0.05 | Free trials: 2**
|
| 360 |
+
Detect order book asymmetry signaling directional pressure. Computes bid-ask depth ratio, spoofing probability, and hidden wall detection across major trading venues.
|
| 361 |
+
|
| 362 |
+
### `volatility_surface` — Volatility Surface
|
| 363 |
+
**Price: $0.05 | Free trials: 2**
|
| 364 |
+
Analyze implied and realized volatility across timeframes. Constructs term structure, identifies volatility skew opportunities, and compares current levels to historical percentile ranges.
|
| 365 |
+
|
| 366 |
+
---
|
| 367 |
+
|
| 368 |
+
## Analysis Tools (14)
|
| 369 |
+
|
| 370 |
+
### `wallet` — Wallet Analysis
|
| 371 |
+
**Price: $0.05 | Free trials: 1**
|
| 372 |
+
Comprehensive wallet analysis. Balance, token holdings, transaction history, risk score, behavioral patterns across chains.
|
| 373 |
+
|
| 374 |
+
### `wallet_pnl` — Wallet PnL Calculator
|
| 375 |
+
**Price: $0.10 | Free trials: 0**
|
| 376 |
+
Realized/unrealized gains, win rate, ROI, Sharpe ratio, and complete trade history analysis.
|
| 377 |
+
|
| 378 |
+
### `forensics` — Token Forensics
|
| 379 |
+
**Price: $0.10 | Free trials: 1**
|
| 380 |
+
Deep token forensics report combining DexScreener, GeckoTerminal, CoinGecko, DefiLlama, CryptoPanic. Risk score, liquidity analysis, pair age, verification status, buy/sell recommendation.
|
| 381 |
+
|
| 382 |
+
### `token_deep_dive` — Token Deep Dive
|
| 383 |
+
**Price: $0.10 | Free trials: 0**
|
| 384 |
+
Deep token analysis across chains. CoinGecko data, DexScreener pairs, trending status, market cap rank, exchange listings, TVL in DeFi protocols.
|
| 385 |
+
|
| 386 |
+
### `token_comparison` — Token Comparison
|
| 387 |
+
**Price: $0.08 | Free trials: 0**
|
| 388 |
+
Side-by-side token comparison. Metrics, risk scores, holder distribution, liquidity depth, social sentiment. Compare 2-5 tokens instantly.
|
| 389 |
+
|
| 390 |
+
### `portfolio_tracker` — Portfolio Tracker
|
| 391 |
+
**Price: $0.10 | Free trials: 0**
|
| 392 |
+
Multi-wallet portfolio tracker. Aggregate PnL, asset allocation, top holdings, unrealized gains/losses across chains.
|
| 393 |
+
|
| 394 |
+
### `portfolio_aggregate` — Portfolio Aggregator
|
| 395 |
+
**Price: $0.10 | Free trials: 0**
|
| 396 |
+
Combine multiple wallets into a single dashboard with consolidated PnL and asset allocation.
|
| 397 |
+
|
| 398 |
+
### `nft_wash_detector` — NFT Wash Trading Detector
|
| 399 |
+
**Price: $0.10 | Free trials: 1**
|
| 400 |
+
Identifies fake volume in NFT collections. Tracks floor price manipulation, finds collections with real organic demand vs artificial hype.
|
| 401 |
+
|
| 402 |
+
### `correlation_matrix` — Correlation Matrix
|
| 403 |
+
**Price: $0.05 | Free trials: 2**
|
| 404 |
+
Compute cross-token correlation heatmap for portfolio risk. Generates rolling correlation matrices, identifies regime shifts, and flags pairs with diverging correlation signals.
|
| 405 |
+
|
| 406 |
+
### `drawdown_analyzer` — Drawdown Analyzer
|
| 407 |
+
**Price: $0.05 | Free trials: 2**
|
| 408 |
+
Calculate maximum drawdown and recovery patterns. Computes peak-to-trough metrics, underwater equity curves, recovery time estimates, and stress tests against historical crash scenarios.
|
| 409 |
+
|
| 410 |
+
### `sharpe_ratio_calc` — Sharpe Ratio Calculator
|
| 411 |
+
**Price: $0.05 | Free trials: 2**
|
| 412 |
+
Compute risk-adjusted return metrics for any wallet or token. Calculates Sharpe, Sortino, and Calmar ratios with configurable benchmark and rolling window parameters.
|
| 413 |
+
|
| 414 |
+
### `volume_profile` — Volume Profile
|
| 415 |
+
**Price: $0.05 | Free trials: 2**
|
| 416 |
+
Analyze volume distribution across price levels. Identifies volume nodes, point-of-control zones, high-value nodes, and low-volume gaps that act as price magnets or barriers.
|
| 417 |
+
|
| 418 |
+
### `tax_lot_optimizer` — Tax Lot Optimizer
|
| 419 |
+
**Price: $0.05 | Free trials: 2**
|
| 420 |
+
Optimize tax lot identification for crypto portfolios. Identifies tax-loss harvesting opportunities, computes FIFO/LIFO/Specific ID outcomes, and generates compliant lot assignment recommendations.
|
| 421 |
+
|
| 422 |
+
### `sector_rotation` — Sector Rotation Tracker
|
| 423 |
+
**Price: $0.05 | Free trials: 2**
|
| 424 |
+
Track capital rotation between crypto sectors and narratives. Monitors DeFi, L1/L2, gaming, AI, and meme sector flows, identifying leading and lagging rotation patterns.
|
| 425 |
+
|
| 426 |
+
---
|
| 427 |
+
|
| 428 |
+
## Social Tools (11)
|
| 429 |
+
|
| 430 |
+
### `sentiment` — Sentiment Analysis
|
| 431 |
+
**Price: $0.03 | Free trials: 0**
|
| 432 |
+
Crypto sentiment analysis across Twitter, Telegram, and Discord. Detects bot activity, organic hype, and coordinated shilling.
|
| 433 |
+
|
| 434 |
+
### `sentiment_spike` — Sentiment Spike Detector
|
| 435 |
+
**Price: $0.05 | Free trials: 0**
|
| 436 |
+
Real-time social media volume anomalies and sentiment shifts for any token.
|
| 437 |
+
|
| 438 |
+
### `social_signal` — Social Signal Analyzer
|
| 439 |
+
**Price: $0.10 | Free trials: 0**
|
| 440 |
+
Twitter profile analysis, timeline engagement, CryptoPanic news sentiment, on-chain token correlation. Sentiment score and recommendation.
|
| 441 |
+
|
| 442 |
+
### `tw_profile` — Twitter Profile
|
| 443 |
+
**Price: $0.01 | Free trials: 0**
|
| 444 |
+
Get Twitter/X user profile data. Followers, bio, tweet count, verification status.
|
| 445 |
+
|
| 446 |
+
### `tw_timeline` — Twitter Timeline
|
| 447 |
+
**Price: $0.01 | Free trials: 0**
|
| 448 |
+
Get a user's recent tweets. Text, engagement, timestamps, media flags. Up to 100 tweets.
|
| 449 |
+
|
| 450 |
+
### `tw_search` — Twitter Search
|
| 451 |
+
**Price: $0.01 | Free trials: 0**
|
| 452 |
+
Search Twitter/X for tweets matching a query. Returns text, engagement, timestamps.
|
| 453 |
+
|
| 454 |
+
### `kol_performance` — KOL Performance Tracker
|
| 455 |
+
**Price: $0.10 | Free trials: 0**
|
| 456 |
+
Measure influencer call accuracy, average ROI after calls, follower quality score.
|
| 457 |
+
|
| 458 |
+
### `meme_vibe_score` — Meme Vibe Score
|
| 459 |
+
**Price: $0.01 | Free trials: 1**
|
| 460 |
+
Meme token vibe scoring. Sentiment, community strength, and virality analysis.
|
| 461 |
+
|
| 462 |
+
### `reddit_sentiment` — Reddit Sentiment
|
| 463 |
+
**Price: $0.05 | Free trials: 2**
|
| 464 |
+
Aggregate and score Reddit crypto community sentiment. Analyzes post frequency, comment polarity, subreddit engagement velocity, and identifies narrative shifts across crypto subreddits.
|
| 465 |
+
|
| 466 |
+
### `discord_alpha` — Discord Alpha Monitor
|
| 467 |
+
**Price: $0.05 | Free trials: 2**
|
| 468 |
+
Monitor Discord servers for early alpha signals. Detects project announcements, team member activity spikes, and insider conversation patterns before information reaches public channels.
|
| 469 |
+
|
| 470 |
+
### `influencer_impact_score` — Influencer Impact Score
|
| 471 |
+
**Price: $0.08 | Free trials: 2**
|
| 472 |
+
Quantify specific influencer impact on token prices. Measures post-to-pump latency, 24h post-impact ROI, audience authenticity, and distinguishes organic vs paid shill influence.
|
| 473 |
+
|
| 474 |
+
### `github_developer_activity` — GitHub Developer Activity
|
| 475 |
+
**Price: $0.05 | Free trials: 2**
|
| 476 |
+
Track blockchain project developer commit activity. Monitors code velocity, contributor count trends, issue resolution speed, and flags abandoned or suddenly-resumed repositories.
|
| 477 |
+
|
| 478 |
+
### `telegram_pump_detect` — Telegram Pump Detector
|
| 479 |
+
**Price: $0.05 | Free trials: 2**
|
| 480 |
+
Detect coordinated pump groups on Telegram channels. Identifies pre-pump coordination messages, group call timing patterns, and cross-references with on-chain volume anomalies.
|
| 481 |
+
|
| 482 |
+
---
|
| 483 |
+
|
| 484 |
+
## Launchpad Tools (7)
|
| 485 |
+
|
| 486 |
+
### `launch` — Token Launch Analysis
|
| 487 |
+
**Price: $0.03 | Free trials: 2**
|
| 488 |
+
Bonding curve status, liquidity locks, initial holder distribution, and fair launch verification.
|
| 489 |
+
|
| 490 |
+
### `launch_intel` — Launch Intelligence
|
| 491 |
+
**Price: $0.05 | Free trials: 2**
|
| 492 |
+
PumpFun new tokens, DexScreener trending pairs, bonding curve tracking, market summary, risk alerts for coordinated launches.
|
| 493 |
+
|
| 494 |
+
### `airdrop_finder` — Airdrop Finder
|
| 495 |
+
**Price: $0.05 | Free trials: 2**
|
| 496 |
+
Discover active and upcoming airdrops across all major chains. Eligibility checks, value estimation, claim deadlines, and Sybil detection.
|
| 497 |
+
|
| 498 |
+
### `presale_scanner` — Presale Scanner
|
| 499 |
+
**Price: $0.05 | Free trials: 2**
|
| 500 |
+
Scan and risk-score upcoming token presales. Evaluates team verification, hard cap vs soft cap ratio, vesting terms, contract audit status, and community authenticity signals.
|
| 501 |
+
|
| 502 |
+
### `ido_tracker` — IDO Tracker
|
| 503 |
+
**Price: $0.05 | Free trials: 2**
|
| 504 |
+
Track initial DEX offering launches and participation metrics. Monitors IDO schedules, raise progress, oversubscription rates, and historical post-IDO performance patterns.
|
| 505 |
+
|
| 506 |
+
### `fair_launch_detect` — Fair Launch Detector
|
| 507 |
+
**Price: $0.05 | Free trials: 2**
|
| 508 |
+
Detect and verify fair launch token distribution parameters. Checks for no team allocation, renounced ownership, locked liquidity, and equal-opportunity buy conditions.
|
| 509 |
+
|
| 510 |
+
### `vesting_schedule_analyzer` — Vesting Schedule Analyzer
|
| 511 |
+
**Price: $0.05 | Free trials: 2**
|
| 512 |
+
Analyze token vesting schedules and cliff impacts. Maps unlock timelines, calculates dilution pressure at each vesting event, and correlates scheduled unlocks with historical price impact.
|
| 513 |
+
|
| 514 |
+
---
|
| 515 |
+
|
| 516 |
+
## Premium Tools (7)
|
| 517 |
+
|
| 518 |
+
### `forensic_valuation` — Forensic Valuation
|
| 519 |
+
**Price: $0.25 | Free trials: 1**
|
| 520 |
+
Institutional-grade token valuation. DCF intrinsic value, comparable analysis with outlier detection, scam probability scoring.
|
| 521 |
+
|
| 522 |
+
### `osint_identity_hunt` — OSINT Identity Hunt
|
| 523 |
+
**Price: $0.15 | Free trials: 2**
|
| 524 |
+
Cross-platform OSINT investigation. Hunt usernames across 400+ networks, domain intelligence, stealth page capture.
|
| 525 |
+
|
| 526 |
+
### `investigation_report` — Investigation Report
|
| 527 |
+
**Price: $0.20 | Free trials: 1**
|
| 528 |
+
Full investigation report. On-chain forensics, financial valuation, OSINT findings, scam scoring in one deliverable.
|
| 529 |
+
|
| 530 |
+
### `deep_forensics` — Deep Forensics
|
| 531 |
+
**Price: $0.25 | Free trials: 1**
|
| 532 |
+
Institutional deep-dive forensic analysis. Complete contract bytecode decompilation, variable state reconstruction, hidden function discovery, and multi-vector exploit scenario modeling.
|
| 533 |
+
|
| 534 |
+
### `whale_network_map` — Whale Network Map
|
| 535 |
+
**Price: $0.20 | Free trials: 1**
|
| 536 |
+
Map complete whale wallet interconnection networks. Reveals shared funding sources, coordinated allocation patterns, and influence cascades between top-100 holders across all chains.
|
| 537 |
+
|
| 538 |
+
### `cross_chain_trace` — Cross-Chain Trace
|
| 539 |
+
**Price: $0.15 | Free trials: 1**
|
| 540 |
+
Trace funds across blockchain bridges and mixers. Follows tainted money through bridge hops, mixer obfuscation, DEX swaps, and cross-chain routing with confidence scoring.
|
| 541 |
+
|
| 542 |
+
### `full_wallet_dossier` — Full Wallet Dossier
|
| 543 |
+
**Price: $0.30 | Free trials: 1**
|
| 544 |
+
Complete dossier on any wallet combining all intelligence. Behavioral profiling, P&L history, counterparty network, risk scoring, cross-chain footprint, and OSINT identity correlation.
|
| 545 |
+
|
| 546 |
+
---
|
| 547 |
+
|
| 548 |
+
## DeFi Tools (4)
|
| 549 |
+
|
| 550 |
+
### `defi_yield_scanner` — DeFi Yield Scanner
|
| 551 |
+
**Price: $0.08 | Free trials: 1**
|
| 552 |
+
Finds best APYs across chains. Detects unsustainable yields, checks protocol TVL trends, impermanent loss risk, smart contract age.
|
| 553 |
+
|
| 554 |
+
### `yield_aggregator` — Yield Aggregator
|
| 555 |
+
**Price: $0.05 | Free trials: 2**
|
| 556 |
+
Aggregate and compare yields across DeFi protocols. Ranks staking, lending, and LP opportunities by risk-adjusted APY, accounting for impermanent loss, smart contract risk, and fee structure.
|
| 557 |
+
|
| 558 |
+
### `impermanent_loss` — Impermanent Loss Calculator
|
| 559 |
+
**Price: $0.05 | Free trials: 2**
|
| 560 |
+
Calculate impermanent loss for liquidity provision positions. Computes current IL, projects worst-case scenarios, compares IL versus hold returns, and recommends optimal rebalancing intervals.
|
| 561 |
+
|
| 562 |
+
### `protocol_risk` — Protocol Risk Assessment
|
| 563 |
+
**Price: $0.08 | Free trials: 0**
|
| 564 |
+
TVL stability analysis, admin key review, upgrade patterns, oracle dependency, governance risk scoring.
|
| 565 |
+
|
| 566 |
+
### `liquidation_cascade` — Liquidation Cascade Risk Analyzer
|
| 567 |
+
**Price: $0.15 | Free trials: 1**
|
| 568 |
+
Cross-chain DeFi position monitoring across Aave, Compound, and Radiant. Computes health factors, identifies liquidation clusters, simulates cascade scenarios under 10%/25%/worst-case market drops. Reveals hidden systemic risk before liquidations trigger.
|
| 569 |
+
- **Risk tiers:** SAFE / WATCH / DANGER / CRITICAL with health factor thresholds
|
| 570 |
+
- **Scenarios:** 10% collateral drop, 25% flash crash, worst-case cascade
|
| 571 |
+
- **Chains:** Ethereum, Base, Arbitrum, Optimism, Polygon, BSC
|
| 572 |
+
|
| 573 |
+
---
|
| 574 |
+
|
| 575 |
+
## NFT Tools (2)
|
| 576 |
+
|
| 577 |
+
### `nft_wash_detector` — NFT Wash Trading Detector
|
| 578 |
+
**Price: $0.10 | Free trials: 1**
|
| 579 |
+
Identifies fake volume in NFT collections. Tracks floor price manipulation, finds collections with real organic demand vs artificial hype.
|
| 580 |
+
|
| 581 |
+
### `nft_floor_analytics` — NFT Floor Analytics
|
| 582 |
+
**Price: $0.05 | Free trials: 2**
|
| 583 |
+
Analyze NFT collection floor price trends and health. Tracks floor price support levels, wash trading indicators, unique holder growth, and listing-to-sale ratio dynamics.
|
| 584 |
+
|
| 585 |
+
---
|
| 586 |
+
|
| 587 |
+
## Bundles (4)
|
| 588 |
+
|
| 589 |
+
### `security_pack` — Security Pack
|
| 590 |
+
**Price: $0.10 (23% savings) | Free trials: 1**
|
| 591 |
+
honeypot_check + rug_pull_predictor + audit + clone_detect
|
| 592 |
+
|
| 593 |
+
### `intelligence_pack` — Intelligence Pack
|
| 594 |
+
**Price: $0.25 (29% savings) | Free trials: 1**
|
| 595 |
+
whale + smartmoney + cluster
|
| 596 |
+
|
| 597 |
+
### `all_in_one` — All-in-One Audit
|
| 598 |
+
**Price: $0.35 (30% savings) | Free trials: 1**
|
| 599 |
+
Complete security scan combining all security tools in a single comprehensive report.
|
| 600 |
+
|
| 601 |
+
### `forensic_pack` — Forensic Pack
|
| 602 |
+
**Price: $0.40 (33% savings) | Free trials: 1**
|
| 603 |
+
forensic_valuation + osint_identity_hunt + investigation_report
|
| 604 |
+
|
| 605 |
+
---
|
| 606 |
+
|
| 607 |
+
## API / Meta Tools (3)
|
| 608 |
+
|
| 609 |
+
### `catalog` — Tool Catalog
|
| 610 |
+
**Price: $0.00 | Free trials: 999**
|
| 611 |
+
Browse available tools, pricing, and chain support.
|
| 612 |
+
|
| 613 |
+
### `mcp-proxy` — MCP Protocol Proxy
|
| 614 |
+
**Price: $0.01 | Free trials: 5**
|
| 615 |
+
Route MCP tool calls through the x402 payment layer.
|
| 616 |
+
|
| 617 |
+
### `human-execute` — Human-in-the-Loop Execution
|
| 618 |
+
**Price: $0.02 | Free trials: 2**
|
| 619 |
+
Wallet-based payment for manual crypto investigation tasks.
|
| 620 |
+
|
| 621 |
+
---
|
| 622 |
+
|
| 623 |
+
## Per-Chain Variants (80)
|
| 624 |
+
|
| 625 |
+
Each of the 20 most popular tools is available in per-chain variants for Solana, Base, Ethereum, and BSC. These are accessed by appending the chain name (e.g., `honeypot_check_solana`, `wallet_base`, `whale_scan_ethereum`).
|
| 626 |
+
|
| 627 |
+
| Base Tool | Solana | Base | Ethereum | BSC |
|
| 628 |
+
|:---|:---:|:---:|:---:|:---:|
|
| 629 |
+
| `honeypot_check` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 630 |
+
| `rug_pull_predictor` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 631 |
+
| `rugshield` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 632 |
+
| `scam_database` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 633 |
+
| `wallet` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 634 |
+
| `wallet_pnl` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 635 |
+
| `whale_scan` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 636 |
+
| `smart_money_alpha` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 637 |
+
| `forensics` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 638 |
+
| `audit` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 639 |
+
| `fresh_pair` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 640 |
+
| `sniper_alert` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 641 |
+
| `liquidity_depth` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 642 |
+
| `arbitrage_scan` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 643 |
+
| `sentiment_spike` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 644 |
+
| `cluster` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 645 |
+
| `insider` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 646 |
+
| `deployer_history` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 647 |
+
| `alpha_digest` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 648 |
+
| `urlcheck` | ✅ $0.03 | ✅ $0.03 | ✅ $0.04 | ✅ $0.04 |
|
| 649 |
+
|
| 650 |
+
---
|
| 651 |
+
|
| 652 |
+
## Discovery Endpoints
|
| 653 |
+
|
| 654 |
+
Six discovery and tool-format endpoints are available:
|
| 655 |
+
|
| 656 |
+
| Endpoint | Format | URL |
|
| 657 |
+
|:---|:---|:---|
|
| 658 |
+
| Discovery | x402 v2 | `GET /api/v1/x402-tools/discovery` |
|
| 659 |
+
| Catalog | JSON | `GET /api/v1/x402-tools/catalog` |
|
| 660 |
+
| OpenAI | Function calling | `GET /api/v1/x402-tools/openai-tools` |
|
| 661 |
+
| Anthropic | Tool use | `GET /api/v1/x402-tools/anthropic-tools` |
|
| 662 |
+
| Gemini | Function declarations | `GET /api/v1/x402-tools/gemini-tools` |
|
| 663 |
+
| LangChain | Tool schema | `GET /api/v1/x402-tools/langchain-tools` |
|
| 664 |
+
|
| 665 |
+
All endpoints return the complete list of **210 tools** in their respective formats.
|
| 666 |
+
|
| 667 |
+
---
|
| 668 |
+
|
| 669 |
+
## Payment
|
| 670 |
+
|
| 671 |
+
All tools support free trials (1-5 calls) then x402 micropayments.
|
| 672 |
+
Pay with USDC on 13 chains, USDT on TRON/BSC, BTC, or EUR via SEPA.
|
| 673 |
+
Full refund if tool returns no data within 48 hours.
|
backend/docs/adr/001-003-core-architecture.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ═══════════════════════════════════════════════════════════════
|
| 2 |
+
# ADR-001-003: Core Architecture (COMBINED FILE)
|
| 3 |
+
# ═══════════════════════════════════════════════════════════════
|
| 4 |
+
# Date: 2026-06-15
|
| 5 |
+
# Status: SUPERSEDED 2026-06-21
|
| 6 |
+
#
|
| 7 |
+
# This combined ADR has been SPLIT into individual files with updated
|
| 8 |
+
# reasoning reflecting the v3 rebuild:
|
| 9 |
+
#
|
| 10 |
+
# - ADR-0001: 0001-why-fastapi.md — framework choice
|
| 11 |
+
# - ADR-0002: 0002-why-five-databases.md — multi-DB strategy
|
| 12 |
+
# - ADR-0003: 0003-strangler-fig-not-rewrite.md — migration pattern
|
| 13 |
+
#
|
| 14 |
+
# Kept here for historical reference. New readers should start with the
|
| 15 |
+
# individual ADRs above. ADR-0003 (strangler-fig) is the most important
|
| 16 |
+
# for understanding the v3 architecture.
|
| 17 |
+
#
|
| 18 |
+
# ────────────────────────────────────────────────────────────────
|
| 19 |
+
|
| 20 |
+
# Original 2026-06-15 content follows:
|
| 21 |
+
|
| 22 |
+
# ═══════════════════════════════════════════════════════════════
|
| 23 |
+
# ADR-001: DataBus as the Single Data Layer
|
| 24 |
+
# ═══════════════════════════════════════════════════════════════
|
| 25 |
+
# Date: 2026-06-15
|
| 26 |
+
# Status: Accepted
|
| 27 |
+
|
| 28 |
+
## Context
|
| 29 |
+
RMI needs to serve data from 112 chains across 135 providers to multiple
|
| 30 |
+
products (RugCharts, RugMaps, News, SENTINEL, Telegram bots). Each product
|
| 31 |
+
has different access patterns, rate limits, and caching requirements.
|
| 32 |
+
|
| 33 |
+
## Decision
|
| 34 |
+
All data access goes through a single DataBus layer (`app/databus/`).
|
| 35 |
+
Products never call external APIs directly. DataBus handles:
|
| 36 |
+
- Provider selection and fallback (free → freemium → paid)
|
| 37 |
+
- 3-layer caching (L1 memory → L2 Redis → L3 R2 cold storage)
|
| 38 |
+
- Request deduplication (same query within 5s shares one API call)
|
| 39 |
+
- Circuit breakers (3 failures → 30s open)
|
| 40 |
+
- Credit-aware provider routing (prioritize free when quota low)
|
| 41 |
+
|
| 42 |
+
## Alternatives Considered
|
| 43 |
+
1. **Each product calls APIs directly** — rejected: duplicate caching logic,
|
| 44 |
+
no credit pooling, harder to track API costs
|
| 45 |
+
2. **GraphQL federation** — rejected: overengineered for our scale, adds
|
| 46 |
+
latency, 78 chains would be 78 subgraphs
|
| 47 |
+
|
| 48 |
+
## Consequences
|
| 49 |
+
- All new features must go through databus.fetch()
|
| 50 |
+
- Provider chains need 4-file sync when adding new chains
|
| 51 |
+
- Single bottleneck risk mitigated by caching and dedup
|
| 52 |
+
|
| 53 |
+
# ═══════════════════════════════════════════════════════════════
|
| 54 |
+
# ADR-002: Monolith over Microservices
|
| 55 |
+
# ═══════════════════════════════════════════════════════════════
|
| 56 |
+
# Date: 2026-06-15
|
| 57 |
+
# Status: Accepted
|
| 58 |
+
|
| 59 |
+
## Context
|
| 60 |
+
RMI backend started as a FastAPI monolith and has grown to 243K lines across
|
| 61 |
+
495 files. The question: should we split into microservices?
|
| 62 |
+
|
| 63 |
+
## Decision
|
| 64 |
+
Stay monolithic. Extract into well-organized modules (`app/routers/`,
|
| 65 |
+
`app/databus/`, `app/core/`) but keep a single deployable. Reasons:
|
| 66 |
+
- Team of 1 (solo dev). Microservices would multiply operational burden
|
| 67 |
+
- Shared DataBus layer means every service would depend on it anyway
|
| 68 |
+
- FastAPI + async already handles concurrency well
|
| 69 |
+
- Docker deployment is a single container — simpler CI/CD
|
| 70 |
+
|
| 71 |
+
## When to Revisit
|
| 72 |
+
- When the team grows to 3+ developers working on isolated domains
|
| 73 |
+
- When DataBus becomes a throughput bottleneck (unlikely with current caching)
|
| 74 |
+
- When we need independent scaling (scanner vs API vs bot)
|
| 75 |
+
|
| 76 |
+
## Consequences
|
| 77 |
+
- main.py needs continuous extraction (see ADR-003)
|
| 78 |
+
- All routers share the same process/memory space
|
| 79 |
+
- Deployment restarts affect all features simultaneously
|
| 80 |
+
|
| 81 |
+
# ═══════════════════════════════════════════════════════════════
|
| 82 |
+
# ADR-003: Redis for Hot Cache, Postgres for Cold Storage
|
| 83 |
+
# ═══════════════════════════════════════════════════════════════
|
| 84 |
+
# Date: 2026-06-15
|
| 85 |
+
# Status: Accepted
|
| 86 |
+
|
| 87 |
+
## Context
|
| 88 |
+
DataBus needs fast lookups for wallet labels (190K entries), token prices,
|
| 89 |
+
and scam patterns. Write-heavy for webhooks (Arkham, Helius, Moralis).
|
| 90 |
+
|
| 91 |
+
## Decision
|
| 92 |
+
- **Redis** for L1/L2 caching: sub-ms lookups, TTL-based expiry, sorted sets
|
| 93 |
+
for alerts and OHLCV candles. Protocol=2 for Redis 7.2 compatibility.
|
| 94 |
+
- **Postgres** for persistent data: wallet labels source of truth, scan
|
| 95 |
+
results, user auth. Redis is loaded from Postgres on startup.
|
| 96 |
+
- **R2/S3** for cold storage: RAG document backups, model weights.
|
| 97 |
+
|
| 98 |
+
## Alternatives Considered
|
| 99 |
+
1. **Postgres-only** — rejected: too slow for real-time lookups, would need
|
| 100 |
+
complex caching layer anyway
|
| 101 |
+
2. **Redis-only** — rejected: no persistence guarantees, data loss on restart
|
| 102 |
+
3. **Memcached** — rejected: simpler than Redis but lacks sorted sets needed
|
| 103 |
+
for OHLCV and alert pipelines
|
| 104 |
+
|
| 105 |
+
## Consequences
|
| 106 |
+
- Dual-write pattern: every write goes to both Postgres and Redis
|
| 107 |
+
- Redis protocol=2 required for Python 3.11 + Redis 7.2 (RESP3 HELLO issue)
|
| 108 |
+
- Cache invalidation: TTL-based, not event-based. Accepts eventual consistency
|
backend/docs/dex_pool_manipulation.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEX Pool Manipulation Analyzer
|
| 2 |
+
|
| 3 |
+
**Tool:** `dex_pool_manipulation`
|
| 4 |
+
**Tier:** Premium
|
| 5 |
+
**Price:** $0.10 (100,000 atoms)
|
| 6 |
+
**Trial:** 1 free check per 24h
|
| 7 |
+
**Endpoint:** `POST /api/v1/x402-tools/dex_pool_manipulation`
|
| 8 |
+
**File:** `app/dex_pool_manipulation_analyzer.py`
|
| 9 |
+
**Router:** `app/routers/x402_dex_pool_manipulation.py`
|
| 10 |
+
**Tests:** `app/test_dex_pool_manipulation.py` (20 tests, all passing)
|
| 11 |
+
|
| 12 |
+
## Overview
|
| 13 |
+
|
| 14 |
+
Analyzes DEX liquidity pools for manipulation, fake liquidity, and attack vectors. Works with Uniswap V2/V3, PancakeSwap, Raydium, Orca, and other major DEXes across EVM and Solana chains.
|
| 15 |
+
|
| 16 |
+
## Analysis Signals
|
| 17 |
+
|
| 18 |
+
| Category | Weight | Description |
|
| 19 |
+
|----------|--------|-------------|
|
| 20 |
+
| Liquidity Concentration | 25% | Top positions controlling >70% of liquidity |
|
| 21 |
+
| Sandwich Vulnerability | 15% | Pool thinness + detected sandwich patterns |
|
| 22 |
+
| Pool Owner Risk | 20% | Owner privileges, fee manipulation, age |
|
| 23 |
+
| Fake/Wash Liquidity | 25% | Single-owner, zero-swap liquidity, wash pairs |
|
| 24 |
+
| Price Manipulation | 30% | Abnormal price swings, thin pool impacts |
|
| 25 |
+
| MEV Exposure | 10% | Rapid same-block trading patterns |
|
| 26 |
+
| Fee Tier Abuse | 15% | Unusual fee configurations for pair type |
|
| 27 |
+
|
| 28 |
+
## Risk Scoring
|
| 29 |
+
|
| 30 |
+
- **0-9:** Minimal risk
|
| 31 |
+
- **10-24:** Low risk
|
| 32 |
+
- **25-44:** Medium risk
|
| 33 |
+
- **45-69:** High risk
|
| 34 |
+
- **70-100:** Critical risk
|
| 35 |
+
|
| 36 |
+
## Metrics Returned
|
| 37 |
+
|
| 38 |
+
- `price_impact`: Simulated impact for 1/10/100 ETH trades
|
| 39 |
+
- `top_5_concentration_pct`: % of liquidity controlled by top 5 positions
|
| 40 |
+
- `liquidity_depth_1pct_change_usd`: Trade volume to cause 1% slippage
|
| 41 |
+
- `sandwich_profit_estimate_usd`: Estimated sandwich bot profit
|
| 42 |
+
|
| 43 |
+
## Input Parameters
|
| 44 |
+
|
| 45 |
+
```json
|
| 46 |
+
{
|
| 47 |
+
"pool_address": "0x...",
|
| 48 |
+
"chain": "ethereum",
|
| 49 |
+
"dex": "uniswap_v3",
|
| 50 |
+
"recent_swaps": [
|
| 51 |
+
{
|
| 52 |
+
"tx_hash": "0x...",
|
| 53 |
+
"block": 12345,
|
| 54 |
+
"timestamp": 1700000000,
|
| 55 |
+
"amount_in": 5.0,
|
| 56 |
+
"amount_out": 4950.0,
|
| 57 |
+
"price_before": 1000.0,
|
| 58 |
+
"price_after": 1005.0
|
| 59 |
+
}
|
| 60 |
+
],
|
| 61 |
+
"positions": [
|
| 62 |
+
{
|
| 63 |
+
"owner": "0x...",
|
| 64 |
+
"tick_lower": -100,
|
| 65 |
+
"tick_upper": 100,
|
| 66 |
+
"liquidity": 500000,
|
| 67 |
+
"usd_value": 1000000.0
|
| 68 |
+
}
|
| 69 |
+
],
|
| 70 |
+
"pool_metadata": {
|
| 71 |
+
"chain": "ethereum",
|
| 72 |
+
"dex": "uniswap_v3",
|
| 73 |
+
"version": "v3",
|
| 74 |
+
"token0_symbol": "WETH",
|
| 75 |
+
"token1_symbol": "USDC",
|
| 76 |
+
"fee_tier": 500,
|
| 77 |
+
"total_liquidity_usd": 5000000.0
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
```
|
backend/docs/x402_API_REFERENCE.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI x402 API Documentation
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
|
| 5 |
+
RMI (Rug Munch Intelligence) provides 270+ crypto intelligence tools via x402 micropayment.
|
| 6 |
+
Every tool routes through our DataBus pipeline — 38 data chains, 67 providers, multi-layer caching.
|
| 7 |
+
If a primary data source fails, DataBus automatically falls back to the next provider in the chain.
|
| 8 |
+
|
| 9 |
+
**Base URL:** `https://mcp.rugmunch.io`
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## Authentication & Payment
|
| 14 |
+
|
| 15 |
+
All paid endpoints require an `X-PAYMENT` header with a valid x402 payment receipt,
|
| 16 |
+
or an `X-WALLET` header for free trial calls.
|
| 17 |
+
|
| 18 |
+
### Payment Flow
|
| 19 |
+
1. Call any tool endpoint without payment → get `402 Payment Required`
|
| 20 |
+
2. Send USDC payment to the provided address on Base/Solana/Ethereum/etc.
|
| 21 |
+
3. Include payment receipt in `X-PAYMENT` header on retry
|
| 22 |
+
|
| 23 |
+
### Free Trials
|
| 24 |
+
Every tool has 1-5 free trial calls per wallet (24h reset):
|
| 25 |
+
- Basic tier: 3-5 free calls
|
| 26 |
+
- Premium tier: 1-2 free calls
|
| 27 |
+
- Elite tier: 0 free calls
|
| 28 |
+
|
| 29 |
+
Check remaining trials: `GET /api/v1/x402-databus/trials/{wallet_address}`
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## Tool Tiers
|
| 34 |
+
|
| 35 |
+
| Tier | Price Range | Free Trials | Best For |
|
| 36 |
+
|------|-------------|-------------|----------|
|
| 37 |
+
| **Basic** | $0.01-$0.02 | 3-5 calls | Quick lookups, market data, prices |
|
| 38 |
+
| **Premium** | $0.05-$0.10 | 1-2 calls | Wallet intel, smart money, deep scans |
|
| 39 |
+
| **Elite** | $0.15-$0.25 | 0 calls | Institutional forensics, Arkham, Nansen |
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## DataBus Direct Endpoints
|
| 44 |
+
|
| 45 |
+
These endpoints route directly through DataBus with automatic fallback chains.
|
| 46 |
+
|
| 47 |
+
### `GET /api/v1/x402-databus/catalog`
|
| 48 |
+
Full catalog of tools with pricing, tier access, and descriptions.
|
| 49 |
+
|
| 50 |
+
### `GET /api/v1/x402-databus/access-matrix`
|
| 51 |
+
Which data types each x402 tier can access.
|
| 52 |
+
|
| 53 |
+
### `GET /api/v1/x402-databus/trials/{wallet}`
|
| 54 |
+
Check remaining free trials for a wallet.
|
| 55 |
+
|
| 56 |
+
### `POST /api/v1/x402-databus/fetch`
|
| 57 |
+
Universal DataBus endpoint. Pass `data_type` + parameters.
|
| 58 |
+
|
| 59 |
+
**Request:**
|
| 60 |
+
```json
|
| 61 |
+
{
|
| 62 |
+
"data_type": "token_price",
|
| 63 |
+
"mint": "So11111111111111111111111111111111111111112",
|
| 64 |
+
"chain": "solana"
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Basic Tier Tools ($0.01-$0.02)
|
| 69 |
+
|
| 70 |
+
| Endpoint | Data Type | Price | Description |
|
| 71 |
+
|----------|-----------|-------|-------------|
|
| 72 |
+
| `/token-price` | token_price | $0.01 | Get real-time token price |
|
| 73 |
+
| `/token-detail` | token_detail | $0.02 | Full token intelligence |
|
| 74 |
+
| `/trending` | trending | $0.01 | Trending tokens across chains |
|
| 75 |
+
| `/market-overview` | market_overview | $0.02 | Crypto market landscape |
|
| 76 |
+
| `/market-movers` | market_movers | $0.01 | Top gainers, losers, movers |
|
| 77 |
+
| `/tvl` | tvl | $0.01 | DeFi TVL data |
|
| 78 |
+
| `/news` | news | $0.01 | Crypto news feed |
|
| 79 |
+
| `/social-feed` | social_feed | $0.01 | Social sentiment feed |
|
| 80 |
+
| `/dex-data` | dex_data | $0.01 | DEX pool data |
|
| 81 |
+
| `/defi-protocols` | defi_protocols | $0.01 | DeFi protocol tracker |
|
| 82 |
+
| `/prediction-markets` | prediction_markets | $0.02 | Prediction market odds |
|
| 83 |
+
| `/prediction-signals` | prediction_signals | $0.02 | Trading signals |
|
| 84 |
+
| `/bubble-map` | bubble_map | $0.02 | Holder concentration map |
|
| 85 |
+
| `/rugmaps-analysis` | rugmaps_analysis | $0.02 | Holder distribution analysis |
|
| 86 |
+
| `/wallet-balance` | wallet_balance | $0.01 | Multi-chain wallet balance |
|
| 87 |
+
| `/wallet-labels` | wallet_labels | $0.02 | Wallet entity identification |
|
| 88 |
+
| `/risk-scan` | risk_scan | $0.02 | Quick rug risk scan |
|
| 89 |
+
| `/threat-check` | threat_check | $0.02 | Threat intelligence check |
|
| 90 |
+
| `/socialfi-resolve` | socialfi_resolve | $0.01 | Social identity resolver |
|
| 91 |
+
|
| 92 |
+
### Premium Tier Tools ($0.05-$0.10)
|
| 93 |
+
|
| 94 |
+
| Endpoint | Data Type | Price | Description |
|
| 95 |
+
|----------|-----------|-------|-------------|
|
| 96 |
+
| `/wallet-profile` | wallet_profile | $0.05 | Complete wallet profile |
|
| 97 |
+
| `/smart-money` | smart_money | $0.05 | Smart money tracker |
|
| 98 |
+
| `/gmgn-smart-money` | gmgn_smart_money | $0.05 | Smart money narratives |
|
| 99 |
+
| `/funding-source` | funding_source | $0.08 | Fund origin tracer |
|
| 100 |
+
| `/cross-chain` | cross_chain | $0.08 | Cross-chain activity |
|
| 101 |
+
| `/wallet-cluster` | wallet_cluster | $0.08 | Syndicate mapper |
|
| 102 |
+
| `/bundle-detect` | bundle_detect | $0.08 | Bot detector |
|
| 103 |
+
| `/wallet-tokens` | wallet_tokens | $0.05 | Token holdings breakdown |
|
| 104 |
+
| `/wallet-pnl` | wallet_pnl | $0.05 | Wallet profit & loss |
|
| 105 |
+
| `/contract-scan` | contract_scan | $0.08 | Deep contract audit |
|
| 106 |
+
| `/sentinel-deep` | sentinel_deep | $0.10 | Full threat scan |
|
| 107 |
+
| `/entity-intel` | entity_intel | $0.10 | Entity intelligence |
|
| 108 |
+
| `/arkham-labels` | arkham_labels | $0.10 | Institutional entity labels |
|
| 109 |
+
| `/arkham-entity` | arkham_entity | $0.10 | Entity resolution |
|
| 110 |
+
| `/rag-search` | rag_search | $0.05 | Knowledge search |
|
| 111 |
+
|
| 112 |
+
### Elite Tier Tools ($0.15-$0.25)
|
| 113 |
+
|
| 114 |
+
| Endpoint | Data Type | Price | Description |
|
| 115 |
+
|----------|-----------|-------|-------------|
|
| 116 |
+
| `/arkham-portfolio` | arkham_portfolio | $0.25 | Institutional portfolio intel |
|
| 117 |
+
| `/arkham-transfers` | arkham_transfers | $0.20 | Cross-chain transfer tracer |
|
| 118 |
+
| `/arkham-counterparties` | arkham_counterparties | $0.20 | Counterparty intelligence |
|
| 119 |
+
| `/nansen-labels` | nansen_labels | $0.15 | Smart money labels |
|
| 120 |
+
| `/nansen-smart-money` | nansen_smart_money | $0.15 | Top trader tracking |
|
| 121 |
+
| `/portfolio` | portfolio | $0.15 | Multi-wallet portfolio |
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## Legacy x402-tools Endpoints
|
| 126 |
+
|
| 127 |
+
All `/api/v1/x402-tools/*` endpoints work identically. 230+ tools covering security,
|
| 128 |
+
intelligence, market, social, DeFi, and more. If a primary data source fails,
|
| 129 |
+
the DataBus fallback middleware automatically routes to the next available provider.
|
| 130 |
+
|
| 131 |
+
---
|
| 132 |
+
|
| 133 |
+
## MCP Server
|
| 134 |
+
|
| 135 |
+
`GET /mcp/tools` — Full tool catalog with MCP-compliant schemas (270+ tools)
|
| 136 |
+
|
| 137 |
+
`POST /mcp/call/{tool_id}` — Execute any tool via MCP protocol
|
| 138 |
+
|
| 139 |
+
`GET /mcp/capabilities` — Server capabilities and payment info
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## Supported Chains
|
| 144 |
+
|
| 145 |
+
Base, Solana, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis,
|
| 146 |
+
Tron, Bitcoin (12 chains for payments)
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## Error Codes
|
| 151 |
+
|
| 152 |
+
| Code | Meaning | Action |
|
| 153 |
+
|------|---------|--------|
|
| 154 |
+
| 402 | Payment Required | Send x402 payment or use trial wallet |
|
| 155 |
+
| 400 | Bad Request | Check required parameters |
|
| 156 |
+
| 502 | No Data Available | All providers exhausted — retry later |
|
| 157 |
+
| 429 | Rate Limited | Wait and retry |
|
| 158 |
+
|
| 159 |
+
---
|
| 160 |
+
|
| 161 |
+
## DataBus Architecture
|
| 162 |
+
|
| 163 |
+
Every data request flows through our 38-chain pipeline:
|
| 164 |
+
|
| 165 |
+
```
|
| 166 |
+
Request → Primary Provider → (fail) → Fallback Provider → (fail) → Cache → Response
|
| 167 |
+
↓ success
|
| 168 |
+
Cache + Respond
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
- **Local cache**: Sub-second response for repeated queries (Redis-backed)
|
| 172 |
+
- **Multi-provider fallback**: Each data type has 2-5 providers ranked by reliability
|
| 173 |
+
- **Consumer-aware access control**: x402_free/basic/premium/enterprise tiers control data depth
|
| 174 |
+
- **Zero source names in responses**: Clients never see which provider supplied data
|
backend/docs/x402_FAQ.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RMI x402 Platform — Complete FAQ
|
| 2 |
+
|
| 3 |
+
## General
|
| 4 |
+
|
| 5 |
+
**What is Rug Munch Intelligence (RMI)?**
|
| 6 |
+
A unified crypto intelligence platform with 270+ tools for token security, wallet forensics, whale tracking, market data, and blockchain queries. Every tool routes through our DataBus pipeline with 38 data chains and 67 providers for maximum reliability.
|
| 7 |
+
|
| 8 |
+
**How many tools are free?**
|
| 9 |
+
Every paid tool includes 1-5 free trial calls. Connecting a wallet unlocks full trial allotment. Basic tools get 3-5 trials, premium tools get 1-2, elite tools have no free tier.
|
| 10 |
+
|
| 11 |
+
**What chains are supported?**
|
| 12 |
+
Base, Solana, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis, TRON, Bitcoin (12 chains for payments; 38 for data queries).
|
| 13 |
+
|
| 14 |
+
## Pricing & Payments
|
| 15 |
+
|
| 16 |
+
**How does x402 pricing work?**
|
| 17 |
+
You pay per tool call in USDC. Prices range from $0.01 (basic lookups) to $0.25 (institutional forensics). Payment happens automatically via the x402 protocol — no accounts, no subscriptions, no prepayment.
|
| 18 |
+
|
| 19 |
+
**For Bots (x402 protocol):**
|
| 20 |
+
1. Call any paid tool endpoint → get `402 Payment Required` response
|
| 21 |
+
2. Send USDC payment to the provided address on any supported chain
|
| 22 |
+
3. Include payment receipt in `X-PAYMENT` header on retry
|
| 23 |
+
4. For trials: include `X-Device-Id` header for 1 free trial, `X-WALLET` header for full allotment
|
| 24 |
+
|
| 25 |
+
**For Humans (wallet connect):**
|
| 26 |
+
1. Connect wallet via MetaMask, Phantom, or WalletConnect
|
| 27 |
+
2. Send USDC payment directly
|
| 28 |
+
3. Include `X-WALLET` header for full trial allotment (3-5 free calls per tool)
|
| 29 |
+
|
| 30 |
+
**Which chains can I pay on?**
|
| 31 |
+
Base, Solana, Ethereum, BSC, TRON, Bitcoin, Polygon, Arbitrum, Optimism, Avalanche, Fantom, Gnosis. Base and Solana offer instant settlement.
|
| 32 |
+
|
| 33 |
+
**What if a paid tool returns no data?**
|
| 34 |
+
Full automatic refund within 48 hours via POST `/api/v1/x402/refund`.
|
| 35 |
+
|
| 36 |
+
**Do free trials reset?**
|
| 37 |
+
Yes — every 24 hours. Anti-abuse fingerprinting ensures fair usage. Bot fingerprints get 1 trial per tool; connected wallets get the full allotment.
|
| 38 |
+
|
| 39 |
+
## DataBus Architecture
|
| 40 |
+
|
| 41 |
+
**What is DataBus?**
|
| 42 |
+
Our single-source data pipeline. Every tool — whether bot or human — routes through DataBus. It provides:
|
| 43 |
+
- **38 data chains** with automatic provider failover
|
| 44 |
+
- **67 providers** ranked by reliability (local → free → paid)
|
| 45 |
+
- **Multi-layer caching** (memory → Redis → R2 cold storage)
|
| 46 |
+
- **6-tier access control** (public, authenticated, basic, premium, admin, x402_paid)
|
| 47 |
+
|
| 48 |
+
**What happens when a data source fails?**
|
| 49 |
+
DataBus automatically falls back to the next provider in the chain. For example, token_price tries: local cache → Jupiter → DexScreener → Binance → CoinGecko. You always get data.
|
| 50 |
+
|
| 51 |
+
**Do I need to specify which provider to use?**
|
| 52 |
+
No. DataBus handles provider selection automatically. You specify WHAT data you want, not WHERE it comes from.
|
| 53 |
+
|
| 54 |
+
## DataBus Direct Endpoints (40 tools)
|
| 55 |
+
|
| 56 |
+
### Basic Tier ($0.01-$0.02)
|
| 57 |
+
| Endpoint | Price | Description |
|
| 58 |
+
|----------|-------|-------------|
|
| 59 |
+
| POST /token-price | $0.01 | Real-time token price |
|
| 60 |
+
| POST /token-detail | $0.02 | Full token intelligence |
|
| 61 |
+
| POST /trending | $0.01 | Trending tokens feed |
|
| 62 |
+
| POST /market-overview | $0.02 | Market landscape |
|
| 63 |
+
| POST /market-movers | $0.01 | Top gainers/losers |
|
| 64 |
+
| POST /tvl | $0.01 | DeFi TVL data |
|
| 65 |
+
| POST /news | $0.01 | Crypto news feed |
|
| 66 |
+
| POST /social-feed | $0.01 | Social sentiment |
|
| 67 |
+
| POST /dex-data | $0.01 | DEX pool data |
|
| 68 |
+
| POST /defi-protocols | $0.01 | Protocol tracker |
|
| 69 |
+
| POST /prediction-markets | $0.02 | Prediction market odds |
|
| 70 |
+
| POST /prediction-signals | $0.02 | Trading signals |
|
| 71 |
+
| POST /bubble-map | $0.02 | Holder concentration map |
|
| 72 |
+
| POST /rugmaps-analysis | $0.02 | Holder distribution |
|
| 73 |
+
| POST /wallet-balance | $0.01 | Multi-chain wallet balance |
|
| 74 |
+
| POST /wallet-labels | $0.02 | Wallet entity identification |
|
| 75 |
+
| POST /risk-scan | $0.02 | Rug risk scan |
|
| 76 |
+
| POST /threat-check | $0.02 | Threat intelligence |
|
| 77 |
+
| POST /socialfi-resolve | $0.01 | Social identity resolver |
|
| 78 |
+
|
| 79 |
+
### Premium Tier ($0.05-$0.10)
|
| 80 |
+
| Endpoint | Price | Description |
|
| 81 |
+
|----------|-------|-------------|
|
| 82 |
+
| POST /wallet-profile | $0.05 | Complete wallet profile |
|
| 83 |
+
| POST /smart-money | $0.05 | Smart money tracker |
|
| 84 |
+
| POST /gmgn-smart-money | $0.05 | Smart money narratives |
|
| 85 |
+
| POST /funding-source | $0.08 | Fund origin tracer |
|
| 86 |
+
| POST /cross-chain | $0.08 | Cross-chain activity |
|
| 87 |
+
| POST /wallet-cluster | $0.08 | Syndicate mapper |
|
| 88 |
+
| POST /bundle-detect | $0.08 | Bot activity detector |
|
| 89 |
+
| POST /wallet-tokens | $0.05 | Token holdings breakdown |
|
| 90 |
+
| POST /wallet-pnl | $0.05 | Wallet PnL |
|
| 91 |
+
| POST /contract-scan | $0.08 | Deep contract audit |
|
| 92 |
+
| POST /sentinel-deep | $0.10 | Full threat scan |
|
| 93 |
+
| POST /entity-intel | $0.10 | Entity intelligence |
|
| 94 |
+
| POST /arkham-labels | $0.10 | Institutional entity labels |
|
| 95 |
+
| POST /arkham-entity | $0.10 | Entity resolution |
|
| 96 |
+
| POST /rag-search | $0.05 | Knowledge search |
|
| 97 |
+
|
| 98 |
+
### Elite Tier ($0.15-$0.25)
|
| 99 |
+
| Endpoint | Price | Description |
|
| 100 |
+
|----------|-------|-------------|
|
| 101 |
+
| POST /arkham-portfolio | $0.25 | Institutional portfolio |
|
| 102 |
+
| POST /arkham-transfers | $0.20 | Cross-chain transfers |
|
| 103 |
+
| POST /arkham-counterparties | $0.20 | Counterparty intelligence |
|
| 104 |
+
| POST /nansen-labels | $0.15 | Smart money labels |
|
| 105 |
+
| POST /nansen-smart-money | $0.15 | Top trader tracking |
|
| 106 |
+
| POST /portfolio | $0.15 | Multi-wallet portfolio |
|
| 107 |
+
|
| 108 |
+
### Universal Endpoints
|
| 109 |
+
| Endpoint | Description |
|
| 110 |
+
|----------|-------------|
|
| 111 |
+
| POST /fetch | Universal DataBus fetch (any data_type) |
|
| 112 |
+
| GET /catalog | Full tool catalog with pricing |
|
| 113 |
+
| GET /access-matrix | Data type access by tier |
|
| 114 |
+
| GET /trials/{identifier} | Trial status for wallet/fingerprint |
|
| 115 |
+
|
| 116 |
+
## MCP Server
|
| 117 |
+
|
| 118 |
+
**GET /mcp/tools** — Full catalog with MCP-compliant schemas (270+ tools)
|
| 119 |
+
**POST /mcp/call/{tool_id}** — Execute any tool via MCP protocol
|
| 120 |
+
**GET /mcp/capabilities** — Server capabilities and payment info
|
| 121 |
+
**GET /.well-known/x402** — x402 discovery document (12 chains, 8 facilitators)
|
| 122 |
+
|
| 123 |
+
## Security & Privacy
|
| 124 |
+
|
| 125 |
+
**Is my data safe?**
|
| 126 |
+
- All API keys are stored in an encrypted vault (GPG pass store), never in .env
|
| 127 |
+
- No source provider names are exposed in responses
|
| 128 |
+
- Wallet addresses are hashed for trial tracking
|
| 129 |
+
- Fingerprinting is VPN-resistant (canvas/WebGL/font, not just IP)
|
| 130 |
+
- 24-hour trial reset with per-tool limits
|
| 131 |
+
|
| 132 |
+
**What access control is used?**
|
| 133 |
+
6 consumer types with granular data packaging:
|
| 134 |
+
- **public_web**: Summary data only, no raw internals
|
| 135 |
+
- **authenticated**: Summary for basic, denied for premium
|
| 136 |
+
- **premium**: Full data for most types, summary for Arkham
|
| 137 |
+
- **admin**: Full access including raw data
|
| 138 |
+
- **mcp_tool**: Scoped per tool_id permissions
|
| 139 |
+
- **x402_paid**: Scoped per pricing tier (free/basic/premium/enterprise)
|
backend/hf-model-card.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: proprietary
|
| 4 |
+
license_link: https://rugmunch.io/terms
|
| 5 |
+
tags:
|
| 6 |
+
- x402
|
| 7 |
+
- mcp
|
| 8 |
+
- crypto-security
|
| 9 |
+
- blockchain-intelligence
|
| 10 |
+
- scam-detection
|
| 11 |
+
- rug-pull-detector
|
| 12 |
+
- wallet-analysis
|
| 13 |
+
- whale-tracking
|
| 14 |
+
- smart-money
|
| 15 |
+
- defi
|
| 16 |
+
- nft-analysis
|
| 17 |
+
- honeypot-detector
|
| 18 |
+
- ai-agents
|
| 19 |
+
- model-context-protocol
|
| 20 |
+
- fastapi
|
| 21 |
+
- micropayments
|
| 22 |
+
- usdc
|
| 23 |
+
- usdt
|
| 24 |
+
- bitcoin
|
| 25 |
+
- solana
|
| 26 |
+
- ethereum
|
| 27 |
+
- base
|
| 28 |
+
- arbitrum
|
| 29 |
+
- optimism
|
| 30 |
+
- polygon
|
| 31 |
+
- bsc
|
| 32 |
+
- avalanche
|
| 33 |
+
- fantom
|
| 34 |
+
- gnosis
|
| 35 |
+
- tron
|
| 36 |
+
pipeline_tag: other
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
# 🛡️ Rug Munch Intelligence — x402 MCP Server
|
| 40 |
+
|
| 41 |
+
**210 AI-powered crypto security & intelligence tools · 13 blockchains · x402 micropayments**
|
| 42 |
+
|
| 43 |
+
[](https://modelcontextprotocol.io)
|
| 44 |
+
[](https://x402.org)
|
| 45 |
+
[](https://rugmunch.io)
|
| 46 |
+
[](https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence)
|
| 47 |
+
|
| 48 |
+
## What Is This?
|
| 49 |
+
|
| 50 |
+
Rug Munch Intelligence (RMI) is the most comprehensive crypto security & intelligence API server ever built. It exposes **210 tools** across **13 blockchains** via the **x402 micropayment protocol** and **Model Context Protocol (MCP)** — giving any AI agent, script, or application instant access to scam detection, whale tracking, wallet forensics, market analysis, and more.
|
| 51 |
+
|
| 52 |
+
> 🧠 **One endpoint. 210 tools. Zero API keys. Free trials on every tool.**
|
| 53 |
+
|
| 54 |
+
## Key Features
|
| 55 |
+
|
| 56 |
+
- **210 tools** across 12 categories: Security (38), Intelligence (27), Market (15), Analysis (14), Social (11), Launchpad (7), Premium (7), DeFi (4), NFT (2), Bundles (4), API (3), + 80 per-chain variants
|
| 57 |
+
- **13 blockchains**: Solana, Base, Ethereum, BSC, Arbitrum, Optimism, Polygon, Avalanche, Fantom, Gnosis, TRON, Bitcoin, SEPA/EUR
|
| 58 |
+
- **x402 v2 protocol**: Per-call micropayments ($0.01–$0.40) via 8 facilitators across USDC, USDT, BTC, and EUR
|
| 59 |
+
- **Free trials**: 1–5 calls per tool with no signup, gated by device fingerprint
|
| 60 |
+
- **MCP compatible**: Use with Claude Desktop, Cursor, Windsurf, ChatGPT, or any MCP client
|
| 61 |
+
- **6 discovery endpoints**: OpenAI, Anthropic, Gemini, LangChain, x402 discovery, and catalog formats
|
| 62 |
+
|
| 63 |
+
## Quick Start
|
| 64 |
+
|
| 65 |
+
### MCP Connection
|
| 66 |
+
|
| 67 |
+
```json
|
| 68 |
+
{
|
| 69 |
+
"mcpServers": {
|
| 70 |
+
"rug-munch-intelligence": {
|
| 71 |
+
"url": "https://rugmunch.io/mcp",
|
| 72 |
+
"transport": "http"
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### Raw HTTP
|
| 79 |
+
|
| 80 |
+
```bash
|
| 81 |
+
# List all 210 tools in OpenAI format
|
| 82 |
+
curl https://rugmunch.io/api/v1/x402-tools/openai-tools
|
| 83 |
+
|
| 84 |
+
# Free trial call — no payment needed
|
| 85 |
+
curl -X POST https://rugmunch.io/api/v1/x402-tools/rugshield \
|
| 86 |
+
-H "Content-Type: application/json" \
|
| 87 |
+
-d '{"address": "So11111111111111111111111111111111111111112", "chain": "solana"}'
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Tool Categories
|
| 91 |
+
|
| 92 |
+
| Category | Count | Top Tools |
|
| 93 |
+
|:---|:---:|:---|
|
| 94 |
+
| 🔐 Security + SENTINEL | 38 | `honeypot_check`, `rugshield`, `sentinel_scan`, `holder_analysis`, `flash_loan_detect` |
|
| 95 |
+
| 🧠 Intelligence | 27 | `whale`, `smartmoney`, `insider`, `cross_chain_whale`, `wallet_label_registry` |
|
| 96 |
+
| 📈 Market | 15 | `pulse`, `market_overview`, `funding_rate`, `options_flow`, `liquidation_heatmap` |
|
| 97 |
+
| 🔬 Analysis | 14 | `wallet`, `forensics`, `portfolio_tracker`, `correlation_matrix`, `drawdown_analyzer` |
|
| 98 |
+
| 🐦 Social | 11 | `sentiment`, `social_signal`, `meme_vibe_score`, `discord_alpha`, `telegram_pump_detect` |
|
| 99 |
+
| 🚀 Launchpad | 7 | `launch_intel`, `airdrop_finder`, `presale_scanner`, `ido_tracker`, `fair_launch_detect` |
|
| 100 |
+
| 💎 Premium | 7 | `forensic_valuation`, `deep_forensics`, `whale_network_map`, `full_wallet_dossier` |
|
| 101 |
+
| 💸 DeFi | 4 | `defi_yield_scanner`, `yield_aggregator`, `impermanent_loss`, `protocol_risk` |
|
| 102 |
+
| 🔄 Variants | 80 | Per-chain overrides for Solana, Base, Ethereum, BSC |
|
| 103 |
+
|
| 104 |
+
## Discovery Endpoints
|
| 105 |
+
|
| 106 |
+
All endpoints return the full 210-tool catalog in their respective format:
|
| 107 |
+
|
| 108 |
+
| Endpoint | Format |
|
| 109 |
+
|:---|:---|
|
| 110 |
+
| `/api/v1/x402-tools/discovery` | x402 v2 protocol |
|
| 111 |
+
| `/api/v1/x402-tools/catalog` | Human-readable JSON |
|
| 112 |
+
| `/api/v1/x402-tools/openai-tools` | OpenAI function calling |
|
| 113 |
+
| `/api/v1/x402-tools/anthropic-tools` | Anthropic tool use |
|
| 114 |
+
| `/api/v1/x402-tools/gemini-tools` | Google Gemini declarations |
|
| 115 |
+
| `/api/v1/x402-tools/langchain-tools` | LangChain tool schema |
|
| 116 |
+
|
| 117 |
+
## SENTINEL Deep Scan
|
| 118 |
+
|
| 119 |
+
The SENTINEL suite provides 9 specialized security scanner modules that can run individually or as a full parallel scan:
|
| 120 |
+
|
| 121 |
+
| Module | Price | Description |
|
| 122 |
+
|:---|:---|:---|
|
| 123 |
+
| `holder_analysis` | $0.05 | HHI concentration, fake diversification |
|
| 124 |
+
| `bundle_detect` | $0.08 | Bundle/sniper detection |
|
| 125 |
+
| `exchange_fund_check` | $0.05 | CEX-funded wallet detection |
|
| 126 |
+
| `liquidity_verify` | $0.05 | Lock verification, fake locker detection |
|
| 127 |
+
| `dev_reputation` | $0.05 | Serial rugg detection |
|
| 128 |
+
| `wash_trading` | $0.08 | Circular transfer detection |
|
| 129 |
+
| `metadata_fingerprint` | $0.05 | HTML/description similarity |
|
| 130 |
+
| `pumpfun_analysis` | $0.08 | Bonding curve, bot detection (Solana) |
|
| 131 |
+
| `sentiment_check` | $0.05 | Social sentiment scoring |
|
| 132 |
+
| **`sentinel_scan`** | **$0.15** | **All 9 modules in parallel** |
|
| 133 |
+
|
| 134 |
+
## Payment Facilitators
|
| 135 |
+
|
| 136 |
+
8 facilitators across 13 chains:
|
| 137 |
+
|
| 138 |
+
1. 🪙 **Coinbase CDP** — Base, Solana, Ethereum, Polygon (USDC)
|
| 139 |
+
2. 🤖 **PayAI** — Base, Solana (USDC, deferred settlement)
|
| 140 |
+
3. ☁️ **Cloudflare x402** — Base (USDC)
|
| 141 |
+
4. ⚡ **EIP-7702** — Universal EVM (USDC)
|
| 142 |
+
5. 🔶 **TRON Self-Verify** — TRON (USDT/USDC/USDD)
|
| 143 |
+
6. 🟠 **Bitcoin Self-Verify** — Bitcoin (BTC)
|
| 144 |
+
7. 🌐 **AsterPay** — SEPA (EUR)
|
| 145 |
+
8. 🦀 **x402-rs** — Multi-chain (USDC)
|
| 146 |
+
|
| 147 |
+
## Links
|
| 148 |
+
|
| 149 |
+
- 🌐 Website: [rugmunch.io](https://rugmunch.io)
|
| 150 |
+
- 📖 Docs: [rugmunch.io/docs/mcp](https://rugmunch.io/docs/mcp)
|
| 151 |
+
- 🔗 MCP Endpoint: [rugmunch.io/mcp](https://rugmunch.io/mcp)
|
| 152 |
+
- 🔍 x402 Discovery: [rugmunch.io/.well-known/x402](https://rugmunch.io/.well-known/x402)
|
| 153 |
+
- 📦 GitHub: [github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp](https://github.com/Rug-Munch-Media-LLC/rug-munch-intelligence-mcp)
|
| 154 |
+
- 🛠️ Smithery: [smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence](https://smithery.ai/server/@cryptorugmuncher/rug-munch-intelligence)
|
| 155 |
+
|
| 156 |
+
## License
|
| 157 |
+
|
| 158 |
+
Proprietary — © 2024–2026 Rug Munch Media LLC. All rights reserved.
|
| 159 |
+
Commercial use requires a license. See [rugmunch.io/terms](https://rugmunch.io/terms).
|
backend/pytest.ini
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[pytest]
|
| 2 |
+
python_files = test_*.py *_test.py
|
| 3 |
+
python_functions = test_*
|
| 4 |
+
python_classes = Test*
|
| 5 |
+
asyncio_mode = auto
|
| 6 |
+
testpaths = tests
|
| 7 |
+
markers =
|
| 8 |
+
integration: marks tests as integration tests (require running services)
|
| 9 |
+
slow: marks tests as slow
|
backend/test_news.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
from datetime import datetime, UTC, timedelta
|
| 3 |
+
from app.catalog.service import get_catalog
|
| 4 |
+
|
| 5 |
+
async def test():
|
| 6 |
+
cat = get_catalog()
|
| 7 |
+
await cat._init_stores()
|
| 8 |
+
cutoff = datetime.now(UTC) - timedelta(hours=720)
|
| 9 |
+
cutoff_epoch = cutoff.timestamp()
|
| 10 |
+
print("cutoff_epoch:", cutoff_epoch)
|
| 11 |
+
print("data newest:", 1781438495.8452277)
|
| 12 |
+
print("data > cutoff:", 1781438495.8452277 > cutoff_epoch)
|
| 13 |
+
async with cat._pg_pool.acquire() as conn:
|
| 14 |
+
rows = await conn.fetch("SELECT COUNT(*) FROM crypto_news WHERE ingested_at > $1", cutoff_epoch)
|
| 15 |
+
print("count after cutoff:", rows[0][0])
|
| 16 |
+
asyncio.run(test())
|
backend/test_trending2.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
from datetime import datetime, UTC, timedelta
|
| 3 |
+
from app.catalog.service import get_catalog
|
| 4 |
+
from app.domain.news.router import _adapt_legacy_row, trend_score, NewsListResponse
|
| 5 |
+
import json
|
| 6 |
+
|
| 7 |
+
async def test():
|
| 8 |
+
cat = get_catalog()
|
| 9 |
+
await cat._init_stores()
|
| 10 |
+
cutoff_epoch = (datetime.now(UTC) - timedelta(hours=720)).timestamp()
|
| 11 |
+
async with cat._pg_pool.acquire() as conn:
|
| 12 |
+
rows = await conn.fetch(
|
| 13 |
+
"SELECT id, title, content, url, source, sentiment, tickers, "
|
| 14 |
+
"published, ingested_at, category FROM crypto_news "
|
| 15 |
+
"WHERE ingested_at > $1 ORDER BY ingested_at DESC LIMIT 5",
|
| 16 |
+
cutoff_epoch,
|
| 17 |
+
)
|
| 18 |
+
print("row count:", len(rows))
|
| 19 |
+
items = []
|
| 20 |
+
for r in rows:
|
| 21 |
+
d = dict(r)
|
| 22 |
+
print("source:", repr(d.get("source"))[:50], "content type:", type(d.get("content")).__name__)
|
| 23 |
+
item = _adapt_legacy_row(d)
|
| 24 |
+
items.append(item)
|
| 25 |
+
print(" adapted ok, news_id:", item.news_id, "title:", item.title[:30])
|
| 26 |
+
print("items:", len(items))
|
| 27 |
+
response = NewsListResponse(items=items, total=len(items), offset=0)
|
| 28 |
+
print("response type:", type(response).__name__)
|
| 29 |
+
j = response.model_dump(mode="json")
|
| 30 |
+
print("json keys:", list(j.keys()), "item count:", len(j["items"]))
|
| 31 |
+
asyncio.run(test())
|
backend/tests/unit/test_governance_attack_detector.py
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tests for Governance Attack & Concentration Risk Detector
|
| 3 |
+
==========================================================
|
| 4 |
+
Tests holder concentration analysis, governance parameter extraction,
|
| 5 |
+
flash-loan feasibility assessment, and risk scoring.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import sys
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
| 12 |
+
|
| 13 |
+
from app.governance_attack_detector import (
|
| 14 |
+
DEXSCREENER_API,
|
| 15 |
+
LOW_QUORUM_PCT,
|
| 16 |
+
TOP_10_CRITICAL_PCT,
|
| 17 |
+
TOP_HOLDER_CRITICAL_PCT,
|
| 18 |
+
GovernanceParams,
|
| 19 |
+
_parse_holders,
|
| 20 |
+
_score_governance_risk,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class TestHolderParsing:
|
| 25 |
+
"""Holder data parsing tests."""
|
| 26 |
+
|
| 27 |
+
def test_parse_empty(self):
|
| 28 |
+
holders = _parse_holders([])
|
| 29 |
+
assert holders == []
|
| 30 |
+
|
| 31 |
+
def test_parse_single_holder(self):
|
| 32 |
+
raw = [{"address": "0xabc", "percentage": "50.5"}]
|
| 33 |
+
holders = _parse_holders(raw)
|
| 34 |
+
assert len(holders) == 1
|
| 35 |
+
assert holders[0].address == "0xabc"
|
| 36 |
+
assert holders[0].percentage == 50.5
|
| 37 |
+
|
| 38 |
+
def test_parse_exchange_label(self):
|
| 39 |
+
raw = [
|
| 40 |
+
{"address": "0xbinance1", "percentage": "10.0", "label": "Binance"},
|
| 41 |
+
{"address": "0xrandom", "percentage": "5.0", "label": ""},
|
| 42 |
+
]
|
| 43 |
+
holders = _parse_holders(raw)
|
| 44 |
+
assert holders[0].is_exchange is True
|
| 45 |
+
assert holders[1].is_exchange is False
|
| 46 |
+
|
| 47 |
+
def test_parse_sorted(self):
|
| 48 |
+
raw = [
|
| 49 |
+
{"address": "0xsmall", "percentage": "1.0"},
|
| 50 |
+
{"address": "0xbig", "percentage": "50.0"},
|
| 51 |
+
{"address": "0xmedium", "percentage": "10.0"},
|
| 52 |
+
]
|
| 53 |
+
holders = _parse_holders(raw)
|
| 54 |
+
assert holders[0].address == "0xbig"
|
| 55 |
+
assert holders[1].address == "0xmedium"
|
| 56 |
+
assert holders[2].address == "0xsmall"
|
| 57 |
+
|
| 58 |
+
def test_parse_etherscan_format(self):
|
| 59 |
+
raw = [{"TokenHolderAddress": "0xdef", "TokenHolderQuantity": "25.0"}]
|
| 60 |
+
holders = _parse_holders(raw)
|
| 61 |
+
assert len(holders) == 1
|
| 62 |
+
assert holders[0].address == "0xdef"
|
| 63 |
+
assert holders[0].percentage == 25.0
|
| 64 |
+
|
| 65 |
+
def test_parse_contract_flag(self):
|
| 66 |
+
raw = [{"address": "0xcontract", "percentage": 30, "is_contract": True}]
|
| 67 |
+
holders = _parse_holders(raw)
|
| 68 |
+
assert holders[0].is_contract is True
|
| 69 |
+
|
| 70 |
+
def test_parse_malformed_pct(self):
|
| 71 |
+
raw = [{"address": "0xbad", "percentage": "N/A"}]
|
| 72 |
+
holders = _parse_holders(raw)
|
| 73 |
+
assert holders[0].percentage == 0.0
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class TestRiskScoring:
|
| 77 |
+
"""Governance risk scoring tests."""
|
| 78 |
+
|
| 79 |
+
def test_no_holders_no_gov(self):
|
| 80 |
+
score, level, _flags = _score_governance_risk(0.0, 0.0, None)
|
| 81 |
+
assert score >= 0 # No risk with no holders
|
| 82 |
+
assert level in ("LOW", "MEDIUM")
|
| 83 |
+
|
| 84 |
+
def test_critical_top_holder(self):
|
| 85 |
+
score, level, flags = _score_governance_risk(51.0, 60.0, None)
|
| 86 |
+
assert score >= 35
|
| 87 |
+
assert level == "CRITICAL" or level == "HIGH"
|
| 88 |
+
assert any("CRITICAL" in f for f in flags)
|
| 89 |
+
|
| 90 |
+
def test_high_top_holder(self):
|
| 91 |
+
score, level, _flags = _score_governance_risk(35.0, 55.0, None)
|
| 92 |
+
assert score >= 20
|
| 93 |
+
assert level == "HIGH" or level == "MEDIUM"
|
| 94 |
+
|
| 95 |
+
def test_top_10_cartel(self):
|
| 96 |
+
score, _level, flags = _score_governance_risk(10.0, 85.0, None)
|
| 97 |
+
assert score >= 20
|
| 98 |
+
assert any("cartel" in f.lower() for f in flags)
|
| 99 |
+
|
| 100 |
+
def test_no_timelock_critical(self):
|
| 101 |
+
params = GovernanceParams(is_governance_contract=True, has_timelock=False)
|
| 102 |
+
score, _level, flags = _score_governance_risk(5.0, 10.0, params)
|
| 103 |
+
assert score >= 25
|
| 104 |
+
assert any("CRITICAL" in f or "No timelock" in f for f in flags)
|
| 105 |
+
|
| 106 |
+
def test_low_quorum(self):
|
| 107 |
+
params = GovernanceParams(
|
| 108 |
+
is_governance_contract=True,
|
| 109 |
+
has_timelock=True,
|
| 110 |
+
quorum_threshold_pct=0.5,
|
| 111 |
+
timelock_delay_seconds=86400,
|
| 112 |
+
)
|
| 113 |
+
score, _level, flags = _score_governance_risk(5.0, 10.0, params)
|
| 114 |
+
assert score >= 20
|
| 115 |
+
assert any("quorum" in f.lower() for f in flags)
|
| 116 |
+
assert any("flash" in f.lower() for f in flags)
|
| 117 |
+
|
| 118 |
+
def test_safe_governance(self):
|
| 119 |
+
params = GovernanceParams(
|
| 120 |
+
is_governance_contract=True,
|
| 121 |
+
has_timelock=True,
|
| 122 |
+
quorum_threshold_pct=4.0,
|
| 123 |
+
timelock_delay_seconds=172800,
|
| 124 |
+
voting_period_blocks=50000,
|
| 125 |
+
proposal_threshold_pct=1.0,
|
| 126 |
+
)
|
| 127 |
+
score, level, _flags = _score_governance_risk(5.0, 20.0, params)
|
| 128 |
+
assert score < 30
|
| 129 |
+
assert level == "LOW" or level == "MEDIUM"
|
| 130 |
+
|
| 131 |
+
def test_very_short_voting(self):
|
| 132 |
+
params = GovernanceParams(
|
| 133 |
+
is_governance_contract=True,
|
| 134 |
+
has_timelock=True,
|
| 135 |
+
voting_period_blocks=50,
|
| 136 |
+
quorum_threshold_pct=5.0,
|
| 137 |
+
timelock_delay_seconds=86400,
|
| 138 |
+
)
|
| 139 |
+
score, _level, flags = _score_governance_risk(5.0, 10.0, params)
|
| 140 |
+
assert score >= 15
|
| 141 |
+
assert any("voting period" in f.lower() for f in flags)
|
| 142 |
+
|
| 143 |
+
def test_short_timelock(self):
|
| 144 |
+
params = GovernanceParams(
|
| 145 |
+
is_governance_contract=True,
|
| 146 |
+
has_timelock=True,
|
| 147 |
+
timelock_delay_seconds=3600, # 1 hour
|
| 148 |
+
quorum_threshold_pct=5.0,
|
| 149 |
+
)
|
| 150 |
+
_score, _level, flags = _score_governance_risk(5.0, 20.0, params)
|
| 151 |
+
assert any("timelock" in f.lower() for f in flags)
|
| 152 |
+
|
| 153 |
+
def test_flash_loan_flag(self):
|
| 154 |
+
params = GovernanceParams(
|
| 155 |
+
is_governance_contract=True,
|
| 156 |
+
has_timelock=True,
|
| 157 |
+
quorum_threshold_pct=0.3,
|
| 158 |
+
timelock_delay_seconds=86400,
|
| 159 |
+
)
|
| 160 |
+
score, _level, flags = _score_governance_risk(5.0, 15.0, params)
|
| 161 |
+
# Should have flash-loan governance attack flag
|
| 162 |
+
assert any("flash-loan" in f.lower() for f in flags)
|
| 163 |
+
assert score >= 30 # Flash-loan governance attack detected
|
| 164 |
+
|
| 165 |
+
def test_score_capped_at_100(self):
|
| 166 |
+
params = GovernanceParams(
|
| 167 |
+
is_governance_contract=True,
|
| 168 |
+
has_timelock=False,
|
| 169 |
+
quorum_threshold_pct=0.1,
|
| 170 |
+
timelock_delay_seconds=0,
|
| 171 |
+
voting_period_blocks=50,
|
| 172 |
+
proposal_threshold_pct=0.01,
|
| 173 |
+
)
|
| 174 |
+
score, level, _flags = _score_governance_risk(TOP_HOLDER_CRITICAL_PCT + 10, TOP_10_CRITICAL_PCT + 10, params)
|
| 175 |
+
assert score <= 100
|
| 176 |
+
assert level == "CRITICAL"
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
class TestGovernanceParams:
|
| 180 |
+
"""Governance parameters data class tests."""
|
| 181 |
+
|
| 182 |
+
def test_defaults(self):
|
| 183 |
+
p = GovernanceParams()
|
| 184 |
+
assert p.has_timelock is False
|
| 185 |
+
assert p.timelock_delay_seconds == 0
|
| 186 |
+
assert p.quorum_threshold_pct == 0.0
|
| 187 |
+
assert p.voting_period_blocks == 0
|
| 188 |
+
|
| 189 |
+
def test_governance_contract_detected(self):
|
| 190 |
+
p = GovernanceParams(
|
| 191 |
+
is_governance_contract=True,
|
| 192 |
+
quorum_threshold_pct=4.0,
|
| 193 |
+
voting_period_blocks=10000,
|
| 194 |
+
)
|
| 195 |
+
assert p.is_governance_contract is True
|
| 196 |
+
assert p.quorum_threshold_pct > 0
|
| 197 |
+
assert p.voting_period_blocks > 0
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
class TestConstants:
|
| 201 |
+
"""Constant threshold tests."""
|
| 202 |
+
|
| 203 |
+
def test_low_quorum_under_1_pct(self):
|
| 204 |
+
assert LOW_QUORUM_PCT == 1.0
|
| 205 |
+
|
| 206 |
+
def test_critical_holder_50_pct(self):
|
| 207 |
+
assert TOP_HOLDER_CRITICAL_PCT == 50.0
|
| 208 |
+
|
| 209 |
+
def test_top_10_critical_80_pct(self):
|
| 210 |
+
assert TOP_10_CRITICAL_PCT == 80.0
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
class TestEndpointReferences:
|
| 214 |
+
"""Verify API endpoint constants are well-formed."""
|
| 215 |
+
|
| 216 |
+
def test_dexscreener_url(self):
|
| 217 |
+
assert "{}" in DEXSCREENER_API
|
| 218 |
+
assert DEXSCREENER_API.startswith("https://")
|
backend/x402-gateway/base
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 9fba267825db866a2ff426324a89408b07362b56
|
backend/x402-gateway/solana
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 2057bfecc3b3bc4ef762d870e776351f802f6f84
|