Add a page which proves the best share PoW
This commit is contained in:
13 files changed
+2708
-10
No files matched your search
@@ -14,6 +14,7 @@
|
||||
import AcceleratorPage from "./lib/AcceleratorPage.svelte";
|
||||
import StatsPage from "./lib/StatsPage.svelte";
|
||||
import BestSharePage from "./lib/BestSharePage.svelte";
|
||||
import SharePowPage from "./lib/SharePowPage.svelte";
|
||||
import SharesBar from "./lib/SharesBar.svelte";
|
||||
import BlockFoundAnimation from "./lib/BlockFoundAnimation.svelte";
|
||||
import QRCode from "qrcode";
|
||||
@@ -64,6 +65,12 @@
|
||||
<BestSharePage />
|
||||
</div>
|
||||
{/key}
|
||||
{:else if selection.page === "bestshare-pow"}
|
||||
{#key 'bestshare-pow'}
|
||||
<div class="page-enter">
|
||||
<SharePowPage />
|
||||
</div>
|
||||
{/key}
|
||||
{:else if selection.worker}
|
||||
{#key selection.worker}
|
||||
<div class="page-enter">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { clearSelection } from "../stores/selection.svelte";
|
||||
import { clearSelection, selectBestSharePow } from "../stores/selection.svelte";
|
||||
import { snap } from "../stores/snapshot.svelte";
|
||||
import { formatDifficulty } from "../format";
|
||||
|
||||
@@ -179,6 +179,19 @@
|
||||
<button type="button" class="back" onclick={clearSelection}>
|
||||
← Back to dashboard
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pow-btn"
|
||||
onclick={selectBestSharePow}
|
||||
title="Show the block header and raw data that reproduce this share's proof of work"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="14" height="14">
|
||||
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
|
||||
<polyline points="3.27 6.96 12 12.01 20.73 6.96"/>
|
||||
<line x1="12" y1="22.08" x2="12" y2="12"/>
|
||||
</svg>
|
||||
Show PoW
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<header class="head">
|
||||
@@ -350,6 +363,10 @@
|
||||
}
|
||||
.crumbs {
|
||||
margin-bottom: 0.25rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.back {
|
||||
font: inherit;
|
||||
@@ -365,6 +382,23 @@
|
||||
border-color: var(--accent);
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
.pow-btn {
|
||||
font: inherit;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.45em;
|
||||
color: var(--accent);
|
||||
background: transparent;
|
||||
border: 1px solid var(--accent-dim);
|
||||
border-radius: 6px;
|
||||
padding: 0.4em 0.85em;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pow-btn:hover {
|
||||
border-color: var(--accent);
|
||||
background: var(--bg-hover);
|
||||
text-shadow: 0 0 8px rgba(255, 122, 58, 0.4);
|
||||
}
|
||||
|
||||
/* Difficulty view toggle */
|
||||
.toggle-bar {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -14,6 +14,7 @@ const WORKER_PREFIX = "#/worker/";
|
||||
const ACCELERATOR_HASH = "#/accelerator";
|
||||
const STATS_HASH = "#/stats";
|
||||
const BESTSHARE_HASH = "#/bestshare";
|
||||
const BESTSHARE_POW_HASH = "#/bestshare/pow";
|
||||
|
||||
type Selection = { user: string | null; worker: string | null; page: string | null };
|
||||
|
||||
@@ -28,6 +29,9 @@ function readHash(): Selection {
|
||||
if (h === STATS_HASH) {
|
||||
return { user: null, worker: null, page: "stats" };
|
||||
}
|
||||
if (h === BESTSHARE_POW_HASH) {
|
||||
return { user: null, worker: null, page: "bestshare-pow" };
|
||||
}
|
||||
if (h === BESTSHARE_HASH) {
|
||||
return { user: null, worker: null, page: "bestshare" };
|
||||
}
|
||||
@@ -73,6 +77,10 @@ export function selectBestShare(): void {
|
||||
window.location.hash = BESTSHARE_HASH;
|
||||
}
|
||||
|
||||
export function selectBestSharePow(): void {
|
||||
window.location.hash = BESTSHARE_POW_HASH;
|
||||
}
|
||||
|
||||
export function clearSelection(): void {
|
||||
window.location.hash = "";
|
||||
}
|
||||
@@ -113,6 +113,26 @@ export type HashratePoint = {
|
||||
v: number; // H/s
|
||||
};
|
||||
|
||||
// PoW reproduction data for the best share seen since ckpool patch 0008
|
||||
// went live (logged by ckpool, ingested from the log by kamado-api).
|
||||
// `header` is the raw 80-byte block header in hashing byte order —
|
||||
// double-SHA256 it and reverse the digest to get `hash`. `coinbase` plus
|
||||
// `merklebranches` reproduce the merkle root committed in the header.
|
||||
export type BestSharePow = {
|
||||
sdiff: number;
|
||||
netdiff: number;
|
||||
height: number;
|
||||
hash: string; // display-order (big-endian) block header hash
|
||||
header: string; // 160 hex chars
|
||||
coinbase: string; // full serialized coinbase tx, hex
|
||||
cb1len: number; // bytes preceding extranonce1 within the coinbase
|
||||
merklebranches: string[] | null;
|
||||
enonce1: string;
|
||||
nonce2: string;
|
||||
workername: string;
|
||||
seen_at: string; // RFC 3339, when kamado-api ingested the record
|
||||
};
|
||||
|
||||
// One entry per ckpool serverurl[] bind, declared by the deployment via
|
||||
// the STRATUM_SERVERS env. `kind` is the stable tag the UI switches on;
|
||||
// `label` is free text shown on hover.
|
||||
@@ -137,6 +157,11 @@ export type Snapshot = {
|
||||
best_diff: number;
|
||||
best_share_hash?: string;
|
||||
best_share_net_diff?: number;
|
||||
// Full header/coinbase/merkle-branch record for the best share seen
|
||||
// since ckpool patch 0008 was deployed. May describe a lower-diff
|
||||
// share than best_diff when the all-time best predates the patch —
|
||||
// compare hashes and disclose.
|
||||
best_share_pow?: BestSharePow;
|
||||
acked_best_diff: number;
|
||||
cumulative_shares: number;
|
||||
next_block_reward_btc: number;
|
||||
|
||||
Reference in new issue
Block a user