Files
gashboard/apps/web/src/strings.ts
2026-05-06 18:09:58 +01:00

72 lines
2.8 KiB
TypeScript

// All user-facing copy. Lean into the futility — these are 4 hobby boards
// trying to hit a 1-in-quadrillions lottery. Take the piss with affection.
export const ROASTS: Record<string, string> = {
nerdqaxe: "wired together by a guy on Telegram. somehow still hashing.",
bitaxe: "single chip, single mum, one in 10²² odds. heart of gold.",
"avalon-nano-3": "USB-stick miner. AliExpress's revenge on the network hashrate.",
"avalon-mini-3": "the only one of you that pays for itself. don't get a big head.",
unknown: "we don't know what this is. we love it anyway.",
};
export const STATUS_LINES = {
hashing: "hashing",
stale: "thinking real hard",
idle: "having a lie down",
};
export const LOTTERY_LINES = [
(oddsPerDay: number) =>
`today: ${formatPct(oddsPerDay)}. A rounding error wearing a cape.`,
(oddsPerDay: number) =>
`expected wait: ${humanYears(1 / Math.max(oddsPerDay, 1e-30) / 365)}. Your descendants' descendants will still be checking the fan noise.`,
() =>
`the math says no in every language, including ones we haven't invented yet.`,
(oddsPerDay: number) =>
`versus lightning today: ${ratioVsLightning(oddsPerDay)}x. Even the sky has a better business plan.`,
() =>
`four little heaters bullying SHA-256 and calling it a retirement strategy.`,
() =>
`every share is proof of work. Not useful work. Let's not get carried away.`,
() =>
`solo mining: where hope goes to become server logs.`,
() =>
`this is not financial advice. It is barely electrical advice.`,
];
export const BLOCK_CELEBRATION_LINES = [
"WAIT. WHAT. CHECK THE LOG. YOU FOUND A — actually let me check that twice.",
"no but seriously, one of these little boards just won the lottery.",
"the network has been notified. so have your friends. so has god.",
];
export const STALE_LINES = [
"hasn't submitted in a while. either thinking really hard or the breaker tripped.",
"currently meditating. has been for some time.",
"not dead, just resting. probably.",
];
function formatPct(p: number): string {
if (!isFinite(p) || p <= 0) return "ε";
if (p >= 0.01) return `${(p * 100).toFixed(4)}%`;
return `${(p * 100).toExponential(2)}%`;
}
function humanYears(years: number): string {
if (!isFinite(years)) return "forever";
if (years < 1) return `${(years * 365).toFixed(1)} days`;
if (years < 100) return `${years.toFixed(1)} years`;
if (years < 1e6) return `${(years / 1e3).toFixed(1)} thousand years`;
if (years < 1e9) return `${(years / 1e6).toFixed(1)} million years`;
return `${(years / 1e9).toFixed(1)} billion years`;
}
function ratioVsLightning(oddsPerDay: number): string {
const lightning = 0.00000028;
const r = oddsPerDay / lightning;
if (r < 0.001) return r.toExponential(1);
if (r < 1) return r.toFixed(3);
if (r < 1000) return r.toFixed(1);
return r.toExponential(1);
}