4-minute walkthrough: live scoring, instant learning, drift detection, self-healing adaptation, and anomaly detection — all on real Bitcoin mempool data.
The Problem
A regulated Bitcoin exchange needs to screen every transaction for illicit activity, estimate optimal fees, analyze Lightning network health, and score onboarding risk — all with full explainability for regulators and an audit trail for every decision. Most ML projects stop at a notebook. This one is deployed live with real data flowing through it.
The System
Four ML models share one platform: Prefect Cloud orchestrates training, Cloudflare R2 stores models, FastHTML on Railway serves the dashboard and JSON API, Postgres logs every prediction for audit. Live Bitcoin mempool data flows through continuously. Analysts review flagged transactions, and their verdicts feed back into online learning.
mempool.space (live Bitcoin data)
-> Scoring Service (cascade: online -> batch -> heuristic)
-> SHAP explanation + Claude narrative
-> Analyst review (TP / FP / escalate)
-> Online model learns immediately
-> Drift detection triggers self-healing Each section explains one part of the system in detail — the problem, the approach, and the design decisions.
Key Decisions
Prefect over Airflow: Python-native, no YAML, better for small teams. FastHTML over React: Python full-stack, HTMX for interactivity without JS build step. XGBoost for production speed + SHAP explainability. River for online learning from streaming analyst feedback. Claude API for translating SHAP values into compliance-ready narratives.
Infrastructure
Railway (app hosting + Postgres), Cloudflare R2 (S3-compatible model storage), Prefect Cloud (pipeline orchestration), mempool.space (live Bitcoin data). Everything is Python 3.13 — training, serving, dashboard, API, and online learning.
Training: Prefect Cloud -> XGBoost / LightGBM / GCN Storage: Cloudflare R2 (S3 API) Serving: FastHTML + uvicorn on Railway Database: PostgreSQL (audit trail + feedback) Live Data: mempool.space API LLM: Claude Haiku (compliance narratives) Online ML: River (incremental learning)