3
Explorer
Codex Bot edited this page 2026-03-24 02:00:25 +01:00

Explorer

Goal

Build a modern Peya explorer for live diagnostics and public visibility without carrying forward the structural debt of the old salstats stack.

This explorer is intended to surface:

  • current block flow
  • merge-mining status
  • miner / protocol / burn amounts
  • staking unlocks and inferred yield
  • network-yield posture from daemon RPC

Active Repo

  • local: /mnt/duzy/sal11v4/peya-explorer
  • remote: http://54.38.205.168:3000/tiamak/peya-explorer

Stack

  • Apache as public reverse proxy
  • Next.js frontend on localhost
  • Fastify API on localhost
  • MySQL as the primary explorer database
  • Redis available for cache use
  • dedicated RPC indexer process

Schema Direction

The explorer is intentionally not reusing the old PHP-era schema as the foundation.

Main tables:

  • blocks
  • transactions
  • transaction_outputs
  • protocol_events
  • yield_metrics
  • explorer_meta

The principle is:

  • store enough normalized data for fast UI queries
  • keep raw JSON where later reinterpretation may be necessary
  • avoid promoting low-value legacy payloads just because the old stats stack stored them

Current Runtime Logic

Merge-Mining Detection

  • current live Peya RPC exposes merge-mined blocks through has_aux_header and aux_header
  • the explorer now treats aux-header presence as the primary merge-mining signal
  • miner_tx.extra merge-mining-tag detection remains only as a fallback compatibility heuristic
  • exact badge semantics are now split:
    • aux-mm can be inferred from chain data
    • dual-mm is only assigned from pool submit telemetry
    • plain blocks carry no MM badge

Yield / Stake Linkage

  • index raw protocol outputs first
  • infer locked_at_height = block_height - 21601
  • match to the closest STAKE tx on that height by amount
  • compute:
    • yield_atomic = unlocked_amount - staked_amount
    • yield_percent = yield_atomic / staked_amount

This is deliberately isolated so it can be improved after live-RPC verification.

Live RPC Notes

Verified against the current fake-mainnet public RPC:

  • /getheight returns the next height, so the top block is height - 1
  • gettransactions is served on /gettransactions
  • get_block includes:
    • has_aux_header
    • aux_header.parent_chain
    • raw parent blobs
  • transaction JSON currently uses vin / vout
  • get_yield_info may return BUSY during early/fake-mainnet operation

Pool Telemetry Integration

  • peya-nodejs-pool now persists MM block classification with candidate and matured block entries in Redis
  • pool API exposes /get_mm_blocks
  • explorer indexer can ingest pool-side MM telemetry into MySQL
  • current intended badge meanings:
    • plain
    • aux-mm
    • dual-mm

Current UI Scope

Implemented:

  • dashboard
  • recent blocks
  • block list
  • block detail
  • protocol event table on block detail

Still pending:

  • search
  • tx detail polish
  • charts
  • deployment snippets for Apache
  • live tuning after RPC verification