Skip to content

Bortlesboat/bitcoin-fee-observatory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin Fee Observatory

FP&A-grade analytics dashboard for Bitcoin on-chain fee markets, block space economics, and mining revenue.

Free, open-source alternative to Glassnode/CryptoQuant — runs against your own Bitcoin node with full data sovereignty.

Features

  • Fee Market Analysis — mempool as order book, fee rate time-series, congestion monitoring
  • Block Explorer — recent blocks with pool attribution, weight utilization, fee statistics
  • Adoption Curves — SegWit and Taproot adoption tracking over time
  • Mining Economics — subsidy vs fee revenue breakdown, pool profitability analysis
  • Node Status — health monitoring and database statistics

Architecture

Bitcoin Node (RPC, localhost only)
    │
    ├──► collector (daemon, 60s poll → SQLite)
    │         ↓
    │    ~/.bitcoin-fee-observatory/observatory.db
    │         ↓
    └──► Streamlit dashboard (reads SQLite + live RPC)

Requirements

  • Python 3.10+
  • Bitcoin Core or Bitcoin Knots node with RPC enabled
  • bitcoinlib-rpc

Quick Start

# Clone and install
git clone https://github.com/Bortlesboat/bitcoin-fee-observatory.git
cd bitcoin-fee-observatory
pip install -e .

# Start the data collector (keep this running in a terminal)
python -m fee_observatory.collector

# In another terminal, launch the dashboard
python -m streamlit run src/fee_observatory/app.py

The dashboard opens at http://localhost:8505. The collector auto-detects your Bitcoin node using cookie auth.

Configuration

All settings work via CLI flags (collector) or environment variables (both):

Environment Variables

Variable Default Description
BITCOIN_RPC_HOST 127.0.0.1 Bitcoin node RPC host
BITCOIN_RPC_PORT 8332 Bitcoin node RPC port
BITCOIN_COOKIE_PATH auto-detect Path to .cookie file
OBSERVATORY_DB ~/.bitcoin-fee-observatory/observatory.db SQLite database path
OBSERVATORY_INTERVAL 60 Collector poll interval (seconds)

Collector CLI

python -m fee_observatory.collector --help

# Custom node and interval:
python -m fee_observatory.collector --host 192.168.1.50 --port 8332 --interval 30

# Custom database location:
python -m fee_observatory.collector --db /path/to/my/observatory.db

Pages

1. Fee Market

The flagship page. Treats the mempool as a supply/demand order book:

  • Stacked area chart of fee bucket sizes over time
  • Fee estimate trends (1-block through 1-day targets)
  • Next block minimum fee with congestion coloring
  • "Best time to send" recommendation

2. Block Explorer

Recent blocks table with analytics overlay:

  • Pool attribution, weight utilization, adoption percentages
  • Revenue breakdown: subsidy vs fees per block
  • Pool distribution pie chart

3. Adoption Curves

Script type transition tracking:

  • Legacy → SegWit → Taproot stacked area
  • Taproot adoption trend with moving average

4. Mining Economics

Revenue analysis with FP&A framing:

  • Subsidy vs fee revenue over time
  • Fee revenue as % of total (the long-term sustainability metric)
  • Pool profitability comparison
  • Block profitability scatter (fees vs weight utilization)

5. Node Status

Health dashboard:

  • Chain, height, sync progress, peers
  • Database statistics (rows, time range, disk usage)

Development

pip install -e ".[dev]"
pytest tests/ -v
ruff check src/ tests/

Security

  • RPC is localhost-only — the dashboard never exposes RPC credentials
  • Dashboard binds to localhost — not accessible from the network by default
  • All SQL queries are parameterized — no injection surface
  • No secrets in the repo.cookie auth is auto-detected at runtime
  • Read-only analytics — the dashboard and collector only read from the Bitcoin node, never write

Warning: Do not expose the dashboard to the internet without authentication. It is designed for local use.

Data Storage

All data is stored locally in ~/.bitcoin-fee-observatory/observatory.db (SQLite with WAL mode). The database has three tables:

  • mempool_snapshots — mempool state every 60 seconds
  • blocks — analyzed block data (detected on arrival)
  • fee_estimates — fee rate estimates every 60 seconds

The database accumulates value over time — the longer you run the collector, the richer your time-series data.

License

MIT

About

Bitcoin fee market analytics dashboard — block economics, mining revenue, adoption curves. Streamlit + SQLite + Plotly.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages