Skip to content

Show the expected monthly cost of the project donation before it is enabled #3705

Open

Description

@pithead-developer

What's the problem

Part of #2476. Owner priority (2026-10-27): build the opt-in donation feature now, shipping dark. The first report requires "the expected monthly XMR cost shown before enabling". Nothing computes it. The pieces exist but are not combined:

  • The earnings model gives expected XMR per 1 H/s per day from the block reward and network difficulty (dashboard/mining_dashboard/service/xvb/earnings.py:41, used by web/views/xvb_views.py:496-564, field coeff_day).
  • Recorded payouts, when the view-only feature is on, are rolled into totals by confirmed_payouts_summary (earnings.py:112), including a 30-day figure.
  • The existing estimate is explicitly P2Pool-only and excludes XvB (xvb_views.py:505-510), which is the right basis for what a donor gives up.

Add dashboard/mining_dashboard/service/donation/estimate.py and fill the estimate field of the donation state block from {{A4}}:

{"basis": "payouts" | "model" | "unknown", "xmr_month": float | null, "as_of": ts}

  • payouts: the configured percentage times the last 30 days of recorded payouts, scaled for the share already donated in that period, when a view key is set and at least 30 days of tracking exist.
  • model: the configured percentage times the P2Pool hashrate average times coeff_day times 30, when the network figures are available. The percentage used is the configured one even while the feature is off, so the number is shown before enabling.
  • unknown: neither basis is available; xmr_month is null. A stale or missing input is never turned into a number.

The model path depends on the dynamic PPLNS window question in #2479; the payload carries basis so the UI can say which one it used.

What it impacts

The settings section's cost line and the Earnings line (UI children). Operators see a number before enabling that is honest about its basis.

How I found it

Read-only scan of origin/develop-v2.1.0 at 02852bd on 2026-10-27 from the paths above. Nothing was executed. Unknown: how accurate the model path is until #2479 lands, and the exact scaling for "share already donated" in the payouts path (the PR states its formula and tests it).

How important is it

Medium. Required by the first report's requirements; low risk because it only reads.

Acceptance criteria

  • New dashboard/tests/service/donation/test_estimate.py: payouts basis with 30 days of rows returns the formula's value; fewer than 30 days or no view key falls to the model; no network figures fall to unknown with xmr_month null; percentages 1, 2, 5 and 10 scale linearly; with the feature off the estimate is still produced.
  • The state block carries estimate; its as_of equals the newest input timestamp; a stale feed (xvb_stats_are_stale-style staleness) yields unknown, not the last value.
  • The PR states its formulas in docs/donation.md ({{A5}}) in one paragraph and the test pins them.
  • Reads payouts through the existing accessors and edits no module whose path names payouts or wallets; new code lives under service/donation/.
  • make test, make test-patch-coverage (90 % of changed lines) and make lint-file-budget pass. No new explanatory code comments.

Possible solutions

Part of #2476. Depends on {{A4}}; soft dependency on #2479.

Activity

  1. added this to the v2.1.0 milestone on Oct 27, 2026
  2. added
    enhancement
    dashboard
    on Oct 27, 2026
  3. added
    blocked
    on Oct 27, 2026
  4. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #3697.

    Dependency marker for the dashboard. The native blocked-by links on this issue already name these open blockers, and the tick removes blocked when every one of them closes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockeddashboardenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions