Skip to content

feat: Add mempool-based fee estimation dashboard#1

Closed
b-l-u-e wants to merge 8 commits intomasterfrom
feature/mempool-fee-estimation-dashboard
Closed

feat: Add mempool-based fee estimation dashboard#1
b-l-u-e wants to merge 8 commits intomasterfrom
feature/mempool-fee-estimation-dashboard

Conversation

@b-l-u-e
Copy link
Copy Markdown
Collaborator

@b-l-u-e b-l-u-e commented Sep 24, 2025

Overview

This PR implements a comprehensive mempool-based fee estimation dashboard for Bitcoin Core.

Features Added

  • Dashboard: Real-time mempool visualization with block templates
  • Analytics: Detailed fee estimation metrics and comparisons

Key Components using dummy data for now

  • Block template visualization showing KWU (Kiloweight Units)
  • Real-time fee rate estimation using mempool data
  • Performance metrics comparing current vs mempool-based methods

Technical Details

  • Frontend: Next.js 14, TypeScript, Tailwind CSS

Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Copy link
Copy Markdown
Collaborator

@ismaelsadeeq ismaelsadeeq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work.

High-Level Feedback

  • The initial page feels redundant; the landing page should just be the live dashboard.
  • The performance metrics currently on the landing page should be moved to the analytics page.

Dashboard

  • The heading and text on the dashboard are also redundant.
  • I also noticed tt’s challenging to differentiate between the block weight and the removed mempool transaction weight; the numbers are not easy to parse for users 3.8 KWU 3.6KWU what are they? (thinking as the user).
  • The blocks height should be more than the width. Hence the blocks can remain rectangular but oriented vertically. Let’s try two blocks: the actual block weight at the bottom and the removed transactions weight at the top. When hovering over or clicking the bottom block, it should become the focus point.
  • Low priority, but note: the blocks can be shown as a set of six (similar to what the fee estimator keeps). We could save that data and allow the user to view as many as they want.
  • I like the inclusion of transaction size, total fees, size, and block height fields.

Analytics

  • For some reason, the analytics page crashes.

Once the approach is finalized, commits should be atomic, with each individual feature separated for easier review.

@b-l-u-e
Copy link
Copy Markdown
Collaborator Author

b-l-u-e commented Sep 24, 2025

Thank you for your feedback.. I will work on the changes suggested

@ismaelsadeeq
Copy link
Copy Markdown
Collaborator

Thanks for the update.

  • I think overall this approach looks good. I like the current update the top of the rectangle should display the block heights instead of the current texts,

  • The live fee estimate is missing the forecaster.

  • Replace "current" with Block Weight, "target" should be something like (Block Txs In Mempool, In Mempool) or similar.

  • Better percentages should be in green I think :), and red should indicate lower percentages.

-Anyway, we can spend more time on the nitty-gritty of the page later. For now, this looks good. Feel free to move on to implementing the analytics page. You also choose to integrate it the initial page with the API :) and suggest ways to make it better.

- Merge backend-analytics into Flask app with /analytics/mempool-health endpoint
- Remove dummy data from frontend, connect to signet node
- Fix estimatesmartfee params and getblocktemplate for signet compatibility
- Add collector block coverage and high-fee inclusion metrics
- Simplify UI with dark/amber theme, display live performance metrics
@b-l-u-e
Copy link
Copy Markdown
Collaborator Author

b-l-u-e commented Dec 20, 2025

Referencing PR#2 done by @mercie-ux : relocated the backend-analytics code into the main backend (Flask) in this PR. The new /analytics/mempool-health endpoint now lives in backend/app.py (local mode via getblockstats, optional external source), and the shared DB helpers (database.py) and collector continue to feed fee_analysis.db

Fixed estimatesmartfee calls to use the correct signature and include warnings.
Adjusted getblocktemplate to use {"mode":"template","rules":["segwit","signet"]} for signet.
json_rpc_request.py mempool estimator now returns structured results (with warnings) when templates are empty instead of 500s.
Collector hardening: removed unused imports, ensured percentiles are padded, kept DB helpers (database.py) for init/insert/summary.

Frontend
Dashboard: simplified dark/amber theme, shows chain, mempool/historical components, and clearer warnings.
Stats: simplified layout, mempool health controls, performance metrics now display whenever summary is present (even small data); removed bulky analysis/roadmap panels.
Block template visuals now show “n/a sat/vB” if fee rates are missing.

for the performance metrics should Run the collector.py (from backend/):
source .venv/bin/activate (if you use the venv)
python collector.py
First run does an initial few-block fill, then continuous updates.
Watch the log for [COLLECTOR] Processed Block … lines.
After it processes blocks, hit /analytics/summary?window=1000 (or refresh the stats page). The cards will show real percentages once rows exist.

Introduced D3.js library and create four new interactive chart components:
- FeeRateTimeline: real-time fee rate timeline with area chart
- MempoolSizeChart: mempool size bar chart over time
- FeeDistributionChart: percentile distribution visualization
- BlockStatsChartD3: enhanced block statistics with dual-axis chart
UI/UX Improvements:
- Consolidate stats and dashboard into unified single-page dashboard
- Add logarithmic scale Y-axis for fee rate visualization
- Plot 25th-75th percentile band per block height
- Overlay fee estimate line spanning target block heights
- Improve Y-axis tick formatting with round numbers
@ismaelsadeeq
Copy link
Copy Markdown
Collaborator

Superseded by https://github.com/ismaelsadeeq/bitcoin-core-fees/pull/4, thanks.

@ismaelsadeeq ismaelsadeeq deleted the feature/mempool-fee-estimation-dashboard branch March 9, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants