Adds `/:chain/about`, linked from the header just before the connection light and the theme toggle — it is about the site rather than the chain, so it sits there instead of in the section nav, and `header: true` on its `SECTIONS` entry keeps it out while still letting the URL parse. The page says what the observer is, that it and the CUDA-optimised miner are built and freely sourced by a member of the Quantus user community rather than by the project, and takes donations in QTC. **The QR is generated in the browser from the address printed beside it, never shipped as an image.** A supplied PNG next to a typed address is two independent claims about where money goes, and nothing on the page could tell a reader if they ever stopped agreeing — a mismatch sends funds somewhere unrecoverable. Verified rather than trusted. The address was put through this crate's own SS58 decoder: checksum and network prefix both hold, and it round-trips to the same string. The QR matrix was then decoded from first principles — function-pattern map, mask 3 unapplied, codewords de-interleaved across version 4-M's two blocks — and reads back the address exactly. A note for whoever checks this again: an independent encoder produces a different matrix for the same string at every mask, because mode segmentation differs, so comparing matrices proves nothing and only a decode does. `the_donation_address_on_the_site_is_a_valid_quantus_address` reads the literal out of the frontend source and validates it, so a typo fails CI rather than costing somebody their money. Confirmed to fail on one changed character. Also on the vesting page, from verifying it live: a "claimable now" figure and a per-grant claimable column. Two grants began vesting at launch while the other forty-six wait for 2027, so 68,871 QTC is already claimable and none of it has been taken — a page that only said "first claimable" would have missed it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
432 lines
18 KiB
TypeScript
432 lines
18 KiB
TypeScript
/**
|
|
* The page.
|
|
*
|
|
* A chain and a window, with at most one of a block, a miner or an account in
|
|
* focus above the standings. All of it lives in the path — see `lib/routes` for
|
|
* the grammar and why it is a path rather than a hash — so every view here can
|
|
* be linked to, opened in a new tab, and returned to with the back button.
|
|
*/
|
|
|
|
import { useCallback, useEffect, useMemo } from 'react'
|
|
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
|
|
|
import { AccountPanel } from './components/AccountPanel'
|
|
import { AccountsIndex } from './components/AccountsIndex'
|
|
import { BlockPanel } from './components/BlockPanel'
|
|
import { BlocksIndex } from './components/BlocksIndex'
|
|
import { CallPanel } from './components/CallPanel'
|
|
import { CallsIndex } from './components/CallsIndex'
|
|
import { EventPanel } from './components/EventPanel'
|
|
import { EventsIndex } from './components/EventsIndex'
|
|
import { BlockTicker } from './components/BlockTicker'
|
|
import { ChainSwitcher } from './components/ChainSwitcher'
|
|
import { Leaderboard } from './components/Leaderboard'
|
|
import { MinerPanel } from './components/MinerPanel'
|
|
import { RuntimePanel } from './components/RuntimePanel'
|
|
import { NetworkPanel } from './components/NetworkPanel'
|
|
import { WormholePanel } from './components/WormholePanel'
|
|
import { NodeRoute } from './components/NodeRoute'
|
|
import { NodesIndex } from './components/NodesIndex'
|
|
import { RuntimesIndex } from './components/RuntimesIndex'
|
|
import { ReversibleIndex } from './components/ReversibleIndex'
|
|
import { SectionNav } from './components/SectionNav'
|
|
import { ThemeToggle } from './components/ThemeToggle'
|
|
import { StateIndex } from './components/StateIndex'
|
|
import { StatBar } from './components/StatBar'
|
|
import { AboutPanel } from './components/AboutPanel'
|
|
import { VestingPanel } from './components/VestingPanel'
|
|
import { WormholeStage } from './components/WormholeStage'
|
|
import { measuredSpan, seconds, windowSpan } from './lib/format'
|
|
import { href, isStandings, parse, WINDOWS } from './lib/routes'
|
|
import { useObserver, usePinnedMiners, useWatch } from './lib/store'
|
|
|
|
export default function App() {
|
|
const state = useObserver()
|
|
const location = useLocation()
|
|
const navigate = useNavigate()
|
|
const { pinned } = usePinnedMiners()
|
|
|
|
const route = useMemo(() => parse(location.pathname), [location.pathname])
|
|
|
|
// Default to the busiest chain we can actually track — the list is ordered
|
|
// by node count, and an untracked chain has nothing behind it.
|
|
const fallbackChain = state.chains.find((c) => c.tracking === 'full')?.id ?? null
|
|
const chain = route.chain ?? fallbackChain
|
|
const info = useMemo(
|
|
() => state.chains.find((c) => c.id === chain) ?? null,
|
|
[state.chains, chain],
|
|
)
|
|
|
|
// `/` is not a page, it is "whichever chain the operator put first" — a
|
|
// question only the backend can answer, and only once it has answered the
|
|
// chain list. Replacing rather than pushing keeps the bare domain out of the
|
|
// back stack, where it would bounce the user straight forward again.
|
|
useEffect(() => {
|
|
if (!route.chain && fallbackChain) {
|
|
navigate(href({ chain: fallbackChain, window: route.window }), { replace: true })
|
|
}
|
|
}, [route.chain, route.window, fallbackChain, navigate])
|
|
|
|
// The standings and a miner's page, which is one row of them. Everything
|
|
// else is about a thing that happened once.
|
|
// The window means something on the standings and on a miner's page — which
|
|
// is one row of those same standings — and nowhere else.
|
|
const windowApplies = isStandings(route) || route.miner !== null
|
|
|
|
// Normalise a path that resolves to the standings but is not spelled like
|
|
// them: `/quantus`, `/quantus/miner` (the standings *are* the miner index),
|
|
// and anything unrecognised, which `parse` degrades to the front page rather
|
|
// than a 404. Without this the address bar keeps saying something the page is
|
|
// not, and the section nav cannot mark where the reader is.
|
|
useEffect(() => {
|
|
if (!chain) return
|
|
const standings = isStandings(route)
|
|
const canonical = href({ chain, window: route.window })
|
|
if (standings && location.pathname !== canonical) {
|
|
navigate(canonical, { replace: true })
|
|
}
|
|
}, [chain, route, location.pathname, navigate])
|
|
|
|
useWatch(chain, route.window)
|
|
|
|
/**
|
|
* A height has resolved to its hash; put the hash in the address bar.
|
|
*
|
|
* `replace`, not a navigation: it is the same block under the name that will
|
|
* still mean this block after a reorg, so it belongs in place of the height
|
|
* rather than on top of it in the back stack. The panel keeps rendering from
|
|
* the height it was given — `BlockPanel` keys on its own prop — so this does
|
|
* not refetch.
|
|
*/
|
|
const blockResolved = useCallback(
|
|
(hash: string) => {
|
|
if (!chain) return
|
|
navigate(href({ chain, block: hash }), { replace: true })
|
|
},
|
|
[chain, navigate],
|
|
)
|
|
|
|
const interval =
|
|
state.summary?.block_interval_seconds ?? state.summary?.target_block_time_seconds ?? 6
|
|
const activeWindow = WINDOWS.find((w) => w.id === route.window) ?? WINDOWS[1]!
|
|
|
|
return (
|
|
<div className="shell">
|
|
<header className="masthead">
|
|
<div className="mark">
|
|
<Sigil />
|
|
<div>
|
|
<div className="mark-name">
|
|
blackbeard<span>.observer</span>
|
|
</div>
|
|
<div className="mark-tagline">quantus mining · this is sparta</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="masthead-right">
|
|
{/* Only where a window means something. It sets the span the ranks
|
|
are computed over, so it belongs on the standings and on a
|
|
miner's page — which is one row of those same standings. A block,
|
|
an account, a runtime and the three indexes have no window: a
|
|
block happened once, a balance has no span, and a control that
|
|
does nothing where it sits teaches a reader to distrust it. */}
|
|
{windowApplies && (
|
|
<nav className="segmented" aria-label="Leaderboard window">
|
|
{WINDOWS.map((w) => (
|
|
<Link
|
|
key={w.id}
|
|
// Carried onto whatever page this is, not back to the
|
|
// standings: changing the span of a miner's rank is not a
|
|
// reason to stop looking at that miner.
|
|
to={href({ ...route, chain, window: w.id })}
|
|
aria-current={w.id === route.window ? 'page' : undefined}
|
|
// The active window's span is measured; the others can only
|
|
// be estimated from the current interval, and say so with a
|
|
// `~`. Both beat a label that names a duration it is not.
|
|
title={`${w.blocks.toLocaleString('en-US')} blocks — ${
|
|
w.id === route.window
|
|
? measuredSpan(state.windowSeconds, w.blocks, interval)
|
|
: windowSpan(w.blocks, interval)
|
|
}`}
|
|
>
|
|
{w.label}
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
)}
|
|
|
|
{/* Before the connection light and the toggle, as the last thing in
|
|
the header that is about the site rather than about the chain. */}
|
|
{chain && (
|
|
<Link
|
|
to={href({ chain, index: 'about' })}
|
|
className="about-link"
|
|
aria-current={route.index === 'about' ? 'page' : undefined}
|
|
>
|
|
About
|
|
</Link>
|
|
)}
|
|
|
|
<div className={`status status-${state.connection}`}>
|
|
<span className="status-dot" />
|
|
{state.connection}
|
|
</div>
|
|
|
|
{/* Last, and outside the window selector's conditional: the theme
|
|
applies to every route, including the ones where a window means
|
|
nothing. */}
|
|
<ThemeToggle />
|
|
</div>
|
|
</header>
|
|
|
|
<ChainSwitcher chains={state.chains} active={chain} window={route.window} />
|
|
|
|
<SectionNav chain={chain} route={route} window={route.window} />
|
|
|
|
{info?.status === 'awaiting' && (
|
|
<div className="banner banner-warn">
|
|
<strong>{info.display_name}</strong> has not started producing blocks yet. This page will
|
|
come alive on its own the moment it does — no refresh needed.
|
|
</div>
|
|
)}
|
|
{info?.status === 'unreachable' && (
|
|
<div className="banner banner-warn">
|
|
The observer has lost contact with the {info.display_name} node. The standings below are
|
|
the last it saw.
|
|
</div>
|
|
)}
|
|
{info?.status === 'syncing' && (
|
|
<div className="banner banner-warn">
|
|
The node is still importing history. Block interval — and therefore every hashrate on this
|
|
page — is nominal until it reaches the tip.
|
|
</div>
|
|
)}
|
|
|
|
{/* The wormhole page trades the headline row for the live stage. Hashrate,
|
|
difficulty, block time, miners and height are on every other page and
|
|
say nothing about the pool; the stage is the one thing that can only
|
|
be shown here, and it wants the width. */}
|
|
{route.index === 'wormhole' ? (
|
|
<WormholeStage
|
|
chain={chain}
|
|
lastBlock={state.blocks[0] ?? null}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
) : (
|
|
<StatBar summary={state.summary} windowName={route.window} />
|
|
)}
|
|
|
|
{route.block && chain && (
|
|
<BlockPanel
|
|
chain={chain}
|
|
block={route.block}
|
|
targetSeconds={info?.target_block_time_seconds ?? 6}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
onResolved={blockResolved}
|
|
/>
|
|
)}
|
|
|
|
{route.account && chain && (
|
|
<AccountPanel
|
|
chain={chain}
|
|
address={route.account}
|
|
// Read from the chain rather than assumed: 12 is what Quantus
|
|
// reports, but a chain that said otherwise would render every
|
|
// balance on this page wrong and look entirely plausible doing it.
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
|
|
{route.miner && chain && (
|
|
<MinerPanel chain={chain} miner={route.miner} windowName={route.window} />
|
|
)}
|
|
|
|
{/* Every one of these is a page, not something opened over the board. A
|
|
URL that names one thing has that thing as its whole subject, and
|
|
leaving eleven unrelated mining rows underneath is the site failing to
|
|
notice which page it is on. The board is what `/:chain/:window` is
|
|
for. */}
|
|
{route.runtime !== null && chain && <RuntimePanel chain={chain} spec={route.runtime} />}
|
|
{route.node && chain && <NodeRoute chain={chain} peer={route.node} />}
|
|
|
|
{route.index === 'block' && chain && <BlocksIndex chain={chain} />}
|
|
{route.index === 'call' && chain && <CallsIndex chain={chain} />}
|
|
{route.index === 'event' && chain && <EventsIndex chain={chain} />}
|
|
{route.event && chain && (
|
|
<EventPanel
|
|
chain={chain}
|
|
pallet={route.event[0]}
|
|
variant={route.event[1]}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.call && chain && (
|
|
<CallPanel
|
|
chain={chain}
|
|
pallet={route.call[0]}
|
|
call={route.call[1]}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.index === 'account' && chain && (
|
|
<AccountsIndex
|
|
chain={chain}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.index === 'reversible' && chain && (
|
|
<ReversibleIndex
|
|
chain={chain}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.index === 'state' && chain && (
|
|
<StateIndex
|
|
chain={chain}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.index === 'runtime' && chain && (
|
|
<RuntimesIndex chain={chain} current={state.summary?.spec_version ?? null} />
|
|
)}
|
|
{route.index === 'node' && chain && <NodesIndex chain={chain} />}
|
|
{route.index === 'about' && <AboutPanel />}
|
|
{route.index === 'vesting' && chain && (
|
|
<VestingPanel
|
|
chain={chain}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.index === 'wormhole' && chain && (
|
|
<WormholePanel
|
|
chain={chain}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
{route.index === 'network' && chain && (
|
|
<NetworkPanel
|
|
chain={chain}
|
|
decimals={info?.token_decimals ?? 12}
|
|
symbol={info?.token_symbol ?? ''}
|
|
/>
|
|
)}
|
|
|
|
{/* The standings and the live ticker belong to the standings route and
|
|
nowhere else. A page that names one subject has that subject as its
|
|
whole subject; leaving thirty unrelated mining rows underneath is the
|
|
site failing to notice which page it is on. This was the fourth place
|
|
spelling out "is this the standings?" by hand — and the one that kept
|
|
showing the board under a node. */}
|
|
{isStandings(route) && (
|
|
<div className="two-col">
|
|
<section className="panel">
|
|
<div className="panel-head">
|
|
<h2 className="panel-title">The Standings</h2>
|
|
<span className="eyebrow">
|
|
last {activeWindow.blocks.toLocaleString('en-US')} blocks ·{' '}
|
|
{measuredSpan(state.windowSeconds, activeWindow.blocks, interval)}
|
|
{pinned.length > 0 && ` · ${pinned.length} marked yours`}
|
|
</span>
|
|
</div>
|
|
<Leaderboard rows={state.leaderboard} chain={chain} ready={state.ready} />
|
|
</section>
|
|
|
|
<section className="panel">
|
|
<div className="panel-head">
|
|
<h2 className="panel-title">Live Blocks</h2>
|
|
<span className="eyebrow">
|
|
{state.summary?.block_interval_seconds
|
|
? `${seconds(state.summary.block_interval_seconds)} apart`
|
|
: 'measuring'}
|
|
</span>
|
|
</div>
|
|
<BlockTicker blocks={state.blocks} chain={chain} />
|
|
</section>
|
|
</div>
|
|
)}
|
|
|
|
<footer className="footer">
|
|
<span>
|
|
Every miner on this board is derived from the <code>pow_</code> digest in each block
|
|
header — no registration, no opt-in, no way to be left out.
|
|
</span>
|
|
<span>
|
|
Hashrates are estimates over a finite window, not measurements of anyone's hardware. A
|
|
miner's figure is the difficulty of the blocks it won — expected hashes, by definition —
|
|
divided by the time they spanned, so a miner that won while the network was smaller is
|
|
credited with the work it actually did rather than a share of what the network is now.
|
|
</span>
|
|
<span>
|
|
Node names are a best-effort mapping, inferred from which node reported a block to
|
|
telemetry first — never a claim the miner made. A <code>node?</code> tag marks one resting
|
|
on a single block or a narrow lead; later blocks correct it. The reward preimage beside it
|
|
is the only identity the chain itself asserts. An <code>elsewhere</code> tag means the
|
|
name was earned by the same reward preimage on another chain, not observed on this one.
|
|
</span>
|
|
{state.summary?.spec_version !== null && state.summary?.spec_version !== undefined && (
|
|
<span>
|
|
{/* "Decoded how?" has an answer, and it is a page. Every event and
|
|
reward on this site was read against this runtime's own type
|
|
registry rather than against anything written here, so the
|
|
runtime is a load-bearing part of the explanation and not a
|
|
footnote. */}
|
|
Rewards and transfers are decoded against the chain's own metadata — the type registry
|
|
the node produces by running the runtime WASM in each block's state, not a schema
|
|
written here. This chain is on{' '}
|
|
<Link to={href({ chain, runtime: state.summary.spec_version })}>
|
|
{state.summary.spec_name ?? 'runtime'} v{state.summary.spec_version}
|
|
</Link>
|
|
.
|
|
</span>
|
|
)}
|
|
<span className="colophon">
|
|
{/* Its own line rather than a fourth item in the `space-between`
|
|
flow: the three above are caveats about the numbers, this is
|
|
where to go and check them. Opens in a tab of its own so the
|
|
socket behind this page keeps its connection. */}
|
|
Every number here is derived from public block headers, and the code that derives them is
|
|
public too —{' '}
|
|
<a
|
|
href="https://git.lair.cafe/quantus/blackbeard.observer"
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
>
|
|
git.lair.cafe/quantus/blackbeard.observer
|
|
</a>
|
|
.
|
|
</span>
|
|
</footer>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
/** The mark: a spear-point shield, drawn rather than shipped as an asset. */
|
|
function Sigil() {
|
|
return (
|
|
<svg width="34" height="40" viewBox="0 0 34 40" aria-hidden="true">
|
|
<path
|
|
d="M17 1 L32 7 V20 C32 29 25 35 17 39 C9 35 2 29 2 20 V7 Z"
|
|
fill="none"
|
|
stroke="var(--data)"
|
|
strokeWidth="1.6"
|
|
/>
|
|
<path
|
|
d="M17 8 L24 12 V21 C24 26 20.5 29.5 17 31.5 C13.5 29.5 10 26 10 21 V12 Z"
|
|
fill="var(--data-wash)"
|
|
/>
|
|
<path d="M17 11 V28" stroke="var(--accent)" strokeWidth="1.6" />
|
|
<path d="M13 15 L17 11 L21 15" fill="none" stroke="var(--accent)" strokeWidth="1.6" />
|
|
</svg>
|
|
)
|
|
}
|