Explorer API, network stats, and energy-spend price oracle
On this page
Status: active development draft, promoting and extending the /v1/explorer contract (implementation plan) with canonical network statistics, circulation/burn accounting, hosted pool telemetry (Issue #47), and the PoW energy-spend XPI price oracle.
Representation and common envelope
All Explorer data endpoints live under /v1/explorer (where v1 is the Explorer API major version; Lotus Legacy endpoints, if ever added, use /legacy/explorer).
- Hashes: 64 lowercase hex characters in native digest/wire order (never reversed).
- Integers and amounts: All integers in new routes (heights, counts, flags, atom amounts) are canonical unsigned decimal strings. Fixed-point ratios and prices (
avu_per_xpi,usd_per_xpi,usd_per_kwh,inflation_pct) are canonical decimal strings with explicit units. Booleans remain JSON booleans; unavailable values arenull(never0). - Common success envelope:
{
"api_version": "1",
"snapshot_token": "<opaque-string>",
"snapshot": {
"chain_id": "<hex32>",
"genesis": "<hex32>",
"profile_id": "<hex32>",
"tip": "<hex32>",
"height": "1401052",
"service_epoch": "<opaque-string>",
"generation": "42"
},
"coverage": {
"from_height": "0",
"through_height": "1401052",
"complete": true,
"scope": "canonical_confirmed"
},
"data": {}
}
Every data route accepts optional snapshot_token to pin multi-request views to one canonical tip and Avalanche-finalized boundary. A reorg or finalized-boundary change invalidates stale pins with 409 (or 503 while in flight).
Capabilities (/status)
/v1/explorer/status reports capabilities booleans so clients degrade honestly:
blocks, transactions, transaction_wire, outputs, assets, asset_events, branches, accepted_pool, detached_history, finality, stats, pool_telemetry, price_oracle.
Core chain routes
| Route | Query / Body | Description |
|---|---|---|
GET /status |
none | Readiness, anchors, binding, coverage, capabilities, limits. |
GET /blocks |
before_height, page_size, cursor |
Descending canonical block summaries. |
GET /blocks/by-height/:height |
none | Canonical block detail at height. |
GET /blocks/:block_id |
none | Canonical block detail by block ID. |
GET /blocks/:block_id/transactions |
page_size, cursor |
Block transaction summaries in native index order. |
GET /transactions/by-id/:txid |
none | Transaction detail by TxID (returns both TxID and TxHash). |
GET /transactions/by-hash/:txhash |
none | Transaction detail by wire TxHash. |
GET /transactions/by-id/:txid/inputs |
page_size, cursor |
Input descriptors in native order. |
GET /transactions/by-id/:txid/outputs |
page_size, cursor |
Output records in native order. |
GET /transactions/by-id/:txid/witnesses |
input_index, page_size, cursor |
Witness descriptors for an input. |
GET /transactions/by-id/:txid/wire |
offset, length |
Bounded raw transaction byte chunk. |
GET /outputs/:txid/:out_idx |
none | Historical output record (unspent, spent, or burned). |
GET /assets |
page_size, cursor |
Known native token IDs in lexicographic native-byte order. |
GET /assets/:token_id |
none | Token detail and metadata availability. |
GET /assets/:token_id/events |
page_size, cursor |
Aggregate token events ordered by (height, tx_index). |
GET /assets/:token_id/outputs |
view=history|unspent, page_size, cursor |
Token output records. |
POST /branches/outputs |
JSON filter body | Branch output history with snapshot-bound cursor. |
POST /branches/utxos |
JSON filter body | Branch UTXO set with snapshot-bound cursor. |
Network stats, circulation, burns, and pool telemetry
These routes satisfy the canonical network dashboard requirements (Issue #47) without exposing private daemon RPCs. All chain-derived aggregates are bound to (profile_id, genesis, tip, height) and must replace affected ranges atomically on reorg.
| Route | Query | Description |
|---|---|---|
GET /stats |
window_blocks (optional, default "144", max "720") |
Current canonical network statistics, exact native-XPI supply/burns, mempool summary, and read-only pool telemetry. |
GET /stats/history |
from, to (height or UNIX timestamp), interval ("1h" | "1d"), page_size, cursor |
Reorg-safe time-series buckets for supply, burns, difficulty, hashrate, inflation, non-coinbase tx volume, and reward distribution. |
GET /stats data schema
| Field | Type | Accounting rule |
|---|---|---|
observed_at |
RFC 3339 string | UTC timestamp when the snapshot was computed. |
window_blocks |
u64 string | Block window used for hashrate and interval averages. |
difficulty |
decimal string | Current tip difficulty derived from compact target nBits. |
hashrate_hs |
decimal string | Estimated network hashrate in hashes/sec over window_blocks. |
avg_block_interval_secs |
decimal string | Observed mean inter-block interval over window_blocks. |
supply.circulating_atoms |
u64 string | Exact spendable native-XPI UTXO sum (flags native spendable only; excludes token units and burned outputs). null if not yet reconciled against canonical history. |
supply.cumulative_burned_atoms |
u64 string | Exact cumulative protocol-burned native XPI (50% base fee burns, explicit native burn outputs flags=0x02, and expiry sweeps). Does not conflate unspendable script errors with protocol burns. |
supply.gross_issuance_atoms |
u64 string | Cumulative minted subsidy through snapshot.height. |
supply.annualized_inflation_pct |
decimal string | null |
Net annualized issuance rate over window_blocks relative to circulating_atoms. |
rewards |
object | Latest block's total_subsidy_atoms, miner_atoms, staker_atoms, treasury_atoms, and burned_fees_atoms. |
activity.non_coinbase_tx_count |
u64 string | Non-coinbase transactions in window_blocks. |
mempool |
object | null |
{ tx_count, bytes, min_fee_per_kb_atoms } when a public mempool source is configured; null otherwise. |
mining_pool |
object | null |
Read-only aggregate telemetry for the hosted browser mining pool (fee_bps, active_workers, share_window_secs, blocks_found, payout_count, observed_at); null when unavailable. Never inferred from coinbase text and never exposes worker identities. |
Energy-spend XPI price oracle
The Explorer exposes a deterministic energy-spend reference price oracle for XPI derived from Proof-of-Work difficulty and block reward, aligned with the thermodynamic Arbitrary Value Unit standard ($1\text{ AVU} \equiv 1\text{ kWh}$). Other Lotus services (wallets, payment servers, auctions, and DEX UIs) may query these endpoints as an objective energy-cost reference price without depending on centralized exchange orderbooks.
Mathematical derivation
Over a canonical trailing window of $W$ blocks ending at snapshot.height:
- Expected hashes per block: From each block's compact target $T_i$, $$H_i = \frac{2^{256}}{T_i + 1}$$
- Energy per XPI mined (
AVU/XPI$\equiv$kWh/XPI): Given the versioned fleet hardware efficiency $\eta(t)$ in hashes per kWh ($\eta = \frac{3.6 \times 10^6\text{ J/kWh}}{e\text{ [J/hash]}}$) and the miner's effective block reward $R_i$ in XPI (miner subsidy share plus miner fee share, in XPI): $$\text{AVU/XPI}_i = \frac{H_i}{\eta(t_i) \cdot R_i}$$ The rolling window quote aggregates total expected work over total miner reward across the $W$ blocks: $$\text{AVU/XPI}(W) = \frac{\sum_{i} H_i}{\eta(t_{\text{tip}}) \cdot \sum_{i} R_i}$$ - Optional USD reference (
USD/XPI): Multiplies the thermodynamic energy cost by a versioned, dated electricity rate $E(t)$ in $\$/\text{kWh}$ (for example the EIA industrial/residential benchmark or an AVU/USD conversion rate): $$\text{USD/XPI}(W) = \text{AVU/XPI}(W) \times E(t_{\text{tip}})$$
Because $H_i$ and $R_i$ are committed directly in canonical block history, both current and historical energy-spend prices are reproducibly computable from canonical blocks plus the versioned assumption table, and automatically re-compute on reorg.
Routes
| Route | Query | Description |
|---|---|---|
GET /price |
window_blocks (optional, default "144", max "720") |
Current energy-spend XPI reference price in AVU (kWh) and USD, with full methodology provenance. |
GET /price/history |
from, to (height or UNIX timestamp), interval ("1h" | "1d"), window_blocks (optional), page_size, cursor |
Optional historical energy-spend XPI price series using the historical efficiency and electricity-rate schedule effective at each bucket. |
GET /price response data
{
"asset": "XPI",
"kind": "energy_spend_reference",
"methodology_version": "pow-avu-v1",
"observed_at": "2026-12-02T19:40:00Z",
"window_blocks": "144",
"avu_per_xpi": "0.00012500",
"usd_per_xpi": "0.00001050",
"kwh_per_block": "0.62500000",
"expected_hashes_per_block": "123456789012345",
"hashrate_hs": "1028806575102",
"avg_miner_reward_atoms": "5000000000",
"assumptions": {
"algorithm": "BLAKE3",
"hardware_profile": "reference-blake3-miner-2026",
"efficiency_j_per_gh": "45.4545",
"usd_per_kwh": "0.0840",
"rate_source": "EIA US industrial average (2026)",
"rate_effective_date": "2026-09-01"
}
}
GET /price/history item fields
Each item in data.items returns:
bucket_start(RFC 3339 UTC timestamp),from_height,through_height(u64 strings)avu_per_xpi,usd_per_xpi(decimal strings;usd_per_xpimay benullif no electricity rate is configured for that date)avg_difficulty,hashrate_hs,avg_miner_reward_atoms(decimal / u64 strings)efficiency_j_per_gh,usd_per_kwh(the exact assumption values applied to that bucket)
Consumer guidance and non-goals
- Reference floor, not spot orderbook:
kind: "energy_spend_reference"reflects marginal PoW electricity cost under the declared hardware/electricity assumptions. It is not a centralized exchange spot price and does not guarantee liquidity at that price. - Provenance required: Consumers (Explorer UI, wallets, payment servers) should display or log
methodology_version,window_blocks,assumptions.usd_per_kwh, andsnapshot.heightalongside any quoted value. - No silent fallbacks: If
capabilities.price_oracleisfalseor the chain history is incomplete,/priceand/price/historyreturn503witherror.code = "index_unavailable"rather than fabricated numbers.