Marchelo23/mempool
0
1---2title: Bitcoin Mempool Fee Predictor3emoji: ⚡4colorFrom: yellow5colorTo: yellow6sdk: docker7pinned: true8license: mit9short_description: ML Bitcoin fee predictions (XGBoost + LightGBM)10---11 12# ⚡ Bitcoin Mempool Fee Predictor API13 14**ML-powered real-time fee predictions for Bitcoin block inclusion.**15 16Uses an **XGBoost + LightGBM ensemble** trained on live mempool data to predict the optimal fee rate (sats/vByte) needed to get your transaction confirmed in the next 1, 3, or 6 blocks.17 18## 🔗 API Endpoints19 20| Endpoint | Description |21|---|---|22| `GET /` | API info & status |23| `GET /health` | Health check |24| `GET /fees/predict` | **ML fee predictions** (1, 3, 6 blocks) |25| `GET /fees/current` | Current mempool fees (from mempool.space) |26| `GET /mempool/blocks` | Projected mempool blocks |27| `GET /models` | Loaded model information |28| `GET /model-metadata` | Model training metrics & metadata |29| `GET /docs` | Interactive API docs (Swagger UI) |30 31## 📡 Example32 33```bash34curl https://marchelo23-mempool.hf.space/fees/predict35```36 37### Response38 39```json40{41 "timestamp": "2026-04-23T12:00:00",42 "mempool_snapshot": {43 "tx_count": 45000,44 "vsize_mb": 120.5,45 "total_fee_btc": 1.23446 },47 "fee_predictions": {48 "1_block": {49 "predicted_fee_sat_vb": 42,50 "confidence_interval": [36, 48],51 "priority": "high"52 },53 "3_blocks": {54 "predicted_fee_sat_vb": 28,55 "priority": "medium"56 },57 "6_blocks": {58 "predicted_fee_sat_vb": 15,59 "priority": "low"60 }61 },62 "recommendation": "NORMAL"63}64```65 66## 🧠 Models67 68- **XGBoost** (v2.1+): Primary model, 0.6 ensemble weight69- **LightGBM** (v4.5+): Secondary model, 0.4 ensemble weight70- **Training**: Automated retraining on live mempool snapshots71- **Features**: 100+ engineered features from mempool state, fee landscape, block timing, and network metrics72 73## 🏗️ Architecture74 75```76mempool.space API → Feature Engineering → Ensemble (XGB + LGB) → Fee Predictions77```78 79Built with FastAPI, deployed as a Docker container on Hugging Face Spaces.80 81## 📊 Data Source82 83All data is fetched in real-time from the [mempool.space](https://mempool.space) public API (Bitcoin mainnet).84 