feat: account flows, and a distribution table for mining rewards

Reported concern: one pool's balance is disproportionately large, and it is not
clear whether rewards are reaching miners. This makes the question answerable
from the chain rather than from impressions.

Measured on mainnet while building it, blocks 1–42,274:

    account            mined   received     sent  recipients
    QUANPOOL          10,171      5,207        0           0
    qzomrwjT…              0     11,382    4,071          90
    qzo1Pr3X…              0      3,875    7,528         986
    qzo4QjZz…              0      1,257    2,448         742
    qznbesUc…              0      1,600        0           0

Direction comes from each transfer event's own `from` and `to` — `Wormhole::
NativeTransferred` and `Balances::Transfer` both carry them — so every figure is
something the chain recorded.

**A nonce cannot answer this, and reaching for one is the obvious mistake.**
Wormhole transfers dispatch unsigned: `verify_private_batch` and
`verify_public_batch` have no signer at all. An address here can move a fortune
with a nonce of zero, and I nearly reported one as proof that nothing had ever
been sent.

The presentation reports flows and does not judge them, because the data cannot
settle what they mean. Two facts in the table above are why: several large
accounts send nothing — ordinary for a solo miner keeping what it earned — and
the accounts distributing to hundreds of recipients have never mined a block, so
payout wallets here are funded from somewhere other than mining addresses. There
is also no such thing as a "pool" on this chain: the word appears only in a name
its operator reports over telemetry, which `MinerFlow::attribution` carries so a
reader can weigh it.

What earns the feature its place is comparison. One miner's recipient count says
little; beside its neighbours' it says a great deal, and the reader draws the
conclusion rather than the site.

Refs #17

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jp6a8EDar9ueEhAxzep4V5
This commit is contained in:
2026-09-14 08:59:55 +03:00
co-authored by Claude Opus 5
parent aaf37baaca
commit 06f3ece228
11 changed files with 608 additions and 11 deletions
+10 -1
View File
@@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AccountEvent } from "./AccountEvent";
import type { AccountFlows } from "./AccountFlows";
import type { AccountRoleEntry } from "./AccountRoleEntry";
import type { BigUintDec } from "./BigUintDec";
import type { ChainId } from "./ChainId";
@@ -80,4 +81,12 @@ indexed_from: number,
/**
* The highest block whose events have been read.
*/
indexed_to: number, };
indexed_to: number,
/**
* What this account has received and sent on, over the indexed range.
*
* Facts rather than a verdict — see [`crate::AccountFlows`]. An account
* that has sent nothing is the ordinary case for a miner keeping what it
* earned; the figure is worth showing because it is worth *comparing*.
*/
flows: AccountFlows | null, };
+45
View File
@@ -0,0 +1,45 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BigUintDec } from "./BigUintDec";
/**
* What one account has received and sent on, over the indexed range.
*
* **Facts, not a verdict.** Direction comes from the transfer events'
* own `from` and `to` fields, so these are what the chain recorded. What they
* cannot tell you is what the numbers *mean*: an operator may hold several
* addresses, may settle off-chain, or may simply be a solo miner keeping what
* it earned — which is the ordinary case and not remarkable in the slightest.
*
* A nonce cannot substitute for any of this. Wormhole transfers dispatch
* unsigned, so an address on this chain can move a fortune with a nonce of
* zero.
*/
export type AccountFlows = {
/**
* Total sent, smallest unit.
*/
sent: BigUintDec,
/**
* Total received.
*/
received: BigUintDec,
/**
* Transfers out.
*/
sends: number,
/**
* Transfers in.
*/
receipts: number,
/**
* Distinct addresses it has sent to.
*
* The number that separates an account distributing to many from one that
* has moved nothing — and the one figure here a reader can compare across
* accounts without knowing anything about any of them.
*/
recipients: number,
/**
* Distinct addresses it has received from.
*/
senders: number, };
+31
View File
@@ -0,0 +1,31 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ChainId } from "./ChainId";
import type { MinerFlow } from "./MinerFlow";
/**
* How the chain's mining is shared, and where the rewards went.
*
* Assembled so the comparison is possible at all: one miner's recipient count
* means little alone, and means a great deal beside its neighbours'.
*/
export type Distribution = {
/**
* Which chain.
*/
chain: ChainId,
/**
* The window the shares were computed over, in blocks.
*/
window_blocks: number,
/**
* Miners, most blocks first.
*/
miners: Array<MinerFlow>,
/**
* Lowest block whose events this observer has read.
*/
indexed_from: number,
/**
* Highest.
*/
indexed_to: number, };
+48
View File
@@ -0,0 +1,48 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AccountFlows } from "./AccountFlows";
import type { AttributionSource } from "./AttributionSource";
import type { BigUintDec } from "./BigUintDec";
import type { MinerId } from "./MinerId";
/**
* One miner's share of the chain's mining, and what it has done with it.
*/
export type MinerFlow = {
/**
* The reward preimage.
*/
miner: MinerId,
/**
* The address the chain pays it at.
*/
address: string | null,
/**
* What to call it. **Self-reported over telemetry, or the address** — the
* chain asserts no names. A name containing "pool" is a claim its operator
* made about itself and nothing more.
*/
display: string,
/**
* How that name was arrived at, so a reader can weigh it.
*/
attribution: AttributionSource,
/**
* Blocks won in the window.
*/
blocks: number,
/**
* Its share of the window's blocks, 0.0–1.0.
*/
share: number,
/**
* What the chain has paid it in rewards, over the indexed range.
*/
mined: BigUintDec | null,
/**
* What it holds now, read from chain state.
*/
balance: BigUintDec | null,
/**
* Flows in and out.
*/
flows: AccountFlows | null, };