Skip to content

Feature/analytics: Implementation for mempool-based fee statistics + API stats endpoint#2

Closed
mercie-ux wants to merge 5 commits into2140-dev:masterfrom
mercie-ux:feature/analytics
Closed

Feature/analytics: Implementation for mempool-based fee statistics + API stats endpoint#2
mercie-ux wants to merge 5 commits into2140-dev:masterfrom
mercie-ux:feature/analytics

Conversation

@mercie-ux
Copy link
Copy Markdown
Contributor

Description:

This pr implements the backend foundation for the mempool-based fee statistics feature
and exposes a clean, API-driven interface for the frontend to consume.

What's implemented

  • added a new /stats endpoint that:
    • accepts a start_height query parameter
    • automatically derives the internal [start_height, start_height + 1000]
    • caps the range using the latest known blockheight
    • fetches fee-ratedata using the external source
https://bitcoincorefeerate.com/fees/2/economical/2
  • computes block-level statistics: p25, p75, average fee rate
  • classifies each block as:
    • overpaid
    • underpaid
    • within_range
  • Returns a fully structured JSON response ready for frontend intergration
  • The backend defines block range, summary and plotting inputs.
  • The frontend is expected to consume latest_block_height, request data using start_height render charts and summaries without local assumptions.

Current limitation

Analytics summary and charts do not render for any block height due to frontend rendering/state issue. However the API responses are successful.

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

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

Should we migrate from Flask to FastAPI? Current implementation ismaelsadeeq#1 uses Flask with synchronous RPC calls. FastAPI would provide: Built-in async support for concurrent RPC requests
However, the current Flask setup is working well for our use case. What are your thoughts on the trade-offs? @ismaelsadeeq @mercie-ux

@ismaelsadeeq
Copy link
Copy Markdown
Collaborator

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

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.

3 participants