Docs

Verify

Independent replay

Recompute a generation from its archive, in the browser or with Node, and check every output and the hash.

What replay checks#

Replay takes a generation archive (record, hash, quotes, trades), runs the engine again on the same inputs, and compares every output. These are the checks, in order:

CheckPasses when
ETH-USDC prices match sqrtPriceX96Every quote's price equals the price recomputed from sqrt_price
BTC-USDC prices match sqrtPriceX96Same, for BTC
Hash of the published recordsha256(prev_hash + "\n" + canonical(record)) equals the published hash
Seed from the previous hashThe recomputed seed equals record.seed
ETH-USDC quotes hash / BTC-USDC quotes hashThe recomputed quotes_hash matches for each market
Results (return, drawdown, fitness, rank)All 24 results are byte-identical
Culls and survivorsEvery outcome matches
Offspring and mutationsEvery child, genome and diff matches
Paper tradestrades_hash matches and the trade list is identical
Null result flagnull matches
Recomputed hashThe hash of the recomputed record equals the published hash

A generation verifies only if every check passes.

In the browser#

Open https://dapp.forgeus.science/verify. Pick a generation and run the replay. The page downloads the archive and runs the same engine.ts the server uses, inside your browser. It also checks the hash chain. See Verify page.

With Node#

You need Node 22.18 or newer (it can run TypeScript files directly) and a copy of the engine source, engine.ts. The public repository link is TBD. The file has no dependencies.

replay.mjs·js
// Usage: node replay.mjs <generation number>
import { replay } from "./engine.ts";

const API = process.env.FORGEUS_API ?? "https://dapp.forgeus.science";
const n = process.argv[2];
if (!n) throw new Error("usage: node replay.mjs <n>");

const res = await fetch(`${API}/v1/generations/${n}/archive`);
if (!res.ok) throw new Error(`archive ${n}: HTTP ${res.status}`);
const archive = await res.json();

const { ok, checks } = await replay(archive);
for (const c of checks) console.log(c.ok ? "ok  " : "FAIL", c.name, "|", c.detail);
console.log(ok ? "generation verified" : "generation did NOT verify");
process.exit(ok ? 0 : 1);
bash
node replay.mjs 1

On older Node versions add --experimental-strip-types. The script only reads public data.

Check the chain#

Replay proves one generation. To prove none were removed or edited, check that every record points at the one before it.

chain.mjs·js
const API = process.env.FORGEUS_API ?? "https://dapp.forgeus.science";
const { items } = await (await fetch(`${API}/v1/chain`)).json();
items.sort((a, b) => a.n - b.n);

let prev = "0".repeat(64);
let ok = true;
for (const g of items) {
  if (g.prev_hash !== prev) {
    console.log(`break at generation ${g.n}`);
    ok = false;
  }
  prev = g.hash;
}
console.log(ok ? `chain ok: ${items.length} generations` : "chain broken");

This checks the links. Replaying a generation checks that its hash is really the hash of its record. Together they cover the whole history.

Going further#

Replay trusts the quotes in the archive. To check them against the chain itself, read the same pools at the same blocks. See Checking quotes on-chain.

Paper only. No funds are traded. $FOUS is not launched. Nothing here is financial advice.