Skip to content

Zohaibarif69/Bitcoin-Mempool-Fee-Analyzer

Repository files navigation

Bitcoin Mempool Fee Analyzer

A developer-focused Bitcoin mempool dashboard that turns real-time network data into clear fee guidance, alerts, and transaction/address exploration.

Problem It Solves

Bitcoin users often overpay fees or get stuck transactions because mempool data is hard to interpret. This dashboard provides:

  • What fee to use — tailored recommendations for fast/standard/slow confirmation
  • Confirmation time estimates — block targets based on current network state
  • Live network view — mempool visualization, alerts, and historical trends

Core Features

  • Live Dashboard — Real-time fees, mempool stats, fee histogram, alerts
  • Fee Recommendations — Three-tier (fast/standard/slow) with confidence scores
  • Alert System — Threshold-based notifications on fee/mempool changes
  • Transaction Explorer (/tx/[txid]) — View inputs, outputs, fees, confirmations
  • Address Explorer (/address/[address]) — UTXO set, balance, history
  • Block Tracker (/blocks, /block/[hash]) — Browse latest blocks and details
  • Historical Data (/history) — Mempool & fee trends (1-720 hours)
  • Search (/explorer) — Find transactions or addresses
  • Mainnet + Testnet — Full network isolation support
  • Caching & Rate Limiting — Fast responses, efficient API usage

Pages

Route Purpose
/ Dashboard with live analytics
/blocks List of latest 20-50 blocks
/block/[hash] Block details + transactions
/tx/[txid] Transaction details
/address/[address] Address balance & history
/explorer Search for TX or address
/history Historical trends
/settings Configuration

API Endpoints

All accept ?network=mainnet|testnet (default: mainnet)

Core:

  • GET /api/mempool — Live mempool & fee data
  • GET /api/fees — Fee analysis with histogram
  • GET /api/history?type=full|mempool|fees|stats&hours=1-720 — Historical snapshots
  • GET /api/alerts — Alert indicators & active alerts

Explorer:

  • GET /api/blocks?limit=20 — Latest blocks
  • GET /api/block/[hash]?start=0 — Block details + paginated txs
  • GET /api/tx/[txid] — Transaction details
  • GET /api/address/[address] — Address balance & UTXOs

Tech Stack

Layer Technology
Framework Next.js 14+ (React, TypeScript)
State TanStack React Query
Styling Tailwind CSS v4
Database PostgreSQL + Prisma
Charts Recharts
Data Sources mempool.space, blockstream.info

Quick Start

1. Install & Setup

git clone https://github.com/yourusername/bitcoin-mempool-analyzer.git
cd bitcoin-mempool-analyzer
npm install

2. Configure Database

Create .env.local:

DATABASE_URL="postgresql://user:password@localhost:5432/bitcoinmempoolanalyzer?schema=public"

3. Initialize Database

npx prisma migrate dev
npx prisma generate

4. Start Dev Server

npm run dev
# Open http://localhost:3000

Development Commands

npm run dev      # Start dev server
npm run build    # Build for production
npm start        # Start production server
npm run lint     # Run linting

# Database
npx prisma studio      # Open DB GUI
npx prisma migrate dev # Run migrations
npx prisma generate    # Regenerate Prisma client

Performance Strategy

  • Polling: 10-second client-side refresh
  • Caching: In-memory TTL (10-30s) + HTTP cache headers
  • Rate Limiting: 10 req/sec (mempool.space), 5 req/sec (blockstream)
  • Fallback: Auto-switches to blockstream.info if mempool.space unavailable
  • Database: Async snapshots every 10 seconds (non-blocking)

Known Limitations

  • Miner names — Often unavailable from public APIs (shows "N/A")
  • Block fee totals — Not reliably provided (shows "N/A")
  • Difficulty — Requires Bitcoin Core RPC (not from public APIs)
  • Polling — Less efficient than WebSockets (but simpler architecture)
  • History — Only persisted while app running (no backfill)

Architecture & Design

See docs/architecture.md for:

  • Data flow diagrams
  • Caching & rate limiting strategy
  • Database persistence design
  • Serverless considerations
  • Scaling roadmap

License

MIT — See LICENSE

About

Bitcoin mempool dashboard with smart fee estimation, transaction tracking, and mainnet/testnet support

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors