Skip to content
QLab
On this page

Verify it yourself

You don't need our API, our packages or our word for any of this. This page has three levels:

  1. A self-contained verifier (Node, node:crypto only) that checks hypertree signatures and vault signatures and rebuilds protocol digests, tested against all three committed vector files.
  2. The full launch verification with our TypeScript packages (verifyLaunchAttestation).
  3. Verifying a live coin end to end from IPFS and the chain: a single-file verify.html you open from disk, or the qlab-verify command line.

Every file on this page can be downloaded below, each with its SHA-256.

Downloads

  • qlab-verify.html680 KB

    Single-file coin verifier. Open it from disk, paste a token address, and give it an RPC endpoint, the launch factory and the anchor contract. Built from packages/verifier; no external scripts.

    SHA-256847a1e927d6a40a672bf33b048e017d4bfcdae89ec713c7da6cac4ae1dab99db

    Download
  • verify-standalone.mjs4 KB

    Dependency-free verifier. Hypertree signatures, vault signatures and canonical digests with node:crypto only.

    SHA-2569205da2ca4e10f1527fb611bc532dfa0bcb0a52720e766e347ccc4257b774ddc

    Download
  • verify-vectors.mjs5 KB

    Vector check. Runs the verifier against the three vector files; place all five files in one folder.

    SHA-256cd24368716b449ff5ca44f477426077d01617fc40cb4f63578faa4b953834271

    Download
  • pq-crypto.json40 KB

    Cryptography vectors. Known-answer vectors for encoding, key derivation, WOTS and the hypertree.

    SHA-2560dc894ec067e0d47726cba59aa1cf862552ff7bf109176dd451d835c73544a04

    Download
  • protocol.json4 KB

    Protocol vectors. Known-answer vectors for every signed message on BNB Chain (chain id 56).

    SHA-25625f1f507e91321cb9bcee65ba6d2a8a6a60e9ae2c795a9014f79011d965e9b72

    Download
  • vault.json21 KB

    Vault vectors. A vault key, its address and four signed withdrawals. The contract tests replay the same file.

    SHA-256d3cc0c9c9c4f88fc7f0c79de37b15824535b99076bf6228ac67f54033955cb04

    Download
  • SHA256SUMS1 KB

    Checksums. SHA-256 of every file above; check them all with sha256sum -c SHA256SUMS.

    SHA-256de017f0e5d3996a6c74833cd6757ab1a97d7d4626dc597c29c87f9342d8b4d9e

    Download

1. A verifier with no dependencies#

Save this as verify-standalone.mjs, or download it above. About 90 lines, SHA-256 only.

JavaScript
// QLab hypertree, vault-signature and canonical-digest verifier. Dependencies: node:crypto only.
import { createHash } from "node:crypto";

const N = 32, W = 16, LEN = 67, H = 8, CAPACITY = 65_536, SIG_BYTES = 4_804, WOTS_BYTES = 2_144, VAULT_SIG_BYTES = 2_401;
const sha256 = (...parts) => { const h = createHash("sha256"); for (const p of parts) h.update(p); return h.digest(); };

// ADRS: u32 type | u32 a | u32 b | u32 c | u32 layer | u64 tree | 4 zero bytes (all big-endian)
function adrs(type, a, b, c, layer, tree) {
  const x = Buffer.alloc(32);
  x.writeUInt32BE(type, 0); x.writeUInt32BE(a, 4); x.writeUInt32BE(b, 8); x.writeUInt32BE(c, 12);
  x.writeUInt32BE(layer, 16); x.writeBigUInt64BE(BigInt(tree), 20);
  return x;
}

// 32-byte message -> 64 base-16 digits (high nibble first) + 3-digit checksum sum(15 - d)
function digits(msg) {
  const d = [];
  for (const byte of msg) d.push(byte >> 4, byte & 15);
  let c = 0;
  for (const x of d) c += W - 1 - x;
  d.push((c >> 8) & 15, (c >> 4) & 15, c & 15);
  return d;
}

// Root of one XMSS tree implied by (message, WOTS signature, auth path).
function treeRoot(msg, wots, auth, pubSeed, layer, tree, leaf) {
  const d = digits(msg);
  const pk = [];
  for (let i = 0; i < LEN; i++) {
    let x = wots.subarray(i * N, (i + 1) * N);
    for (let s = d[i]; s < W - 1; s++) x = sha256(pubSeed, adrs(0, leaf, i, s, layer, tree), x);
    pk.push(x);
  }
  let node = sha256(pubSeed, adrs(1, leaf, 0, 0, layer, tree), ...pk);
  let idx = leaf;
  for (let h = 1; h <= H; h++) {
    const j = idx >> 1;
    const ad = adrs(2, h, j, 0, layer, tree);
    node = idx & 1 ? sha256(pubSeed, ad, auth[h - 1], node) : sha256(pubSeed, ad, node, auth[h - 1]);
    idx = j;
  }
  return node;
}

// One tree signature inside a buffer: wots(2,144) ‖ auth(8 × 32), starting at `off`.
const part = (sig, off) => ({
  wots: sig.subarray(off, off + WOTS_BYTES),
  auth: Array.from({ length: H }, (_, h) => sig.subarray(off + WOTS_BYTES + h * N, off + WOTS_BYTES + (h + 1) * N)),
});

/** true iff `sig` (4,804 bytes) is a valid hypertree signature of the 32-byte `msg` under (root, pubSeed). */
export function verifyHypertree(msg, sig, root, pubSeed) {
  if (msg.length !== N || sig.length !== SIG_BYTES || root.length !== N || pubSeed.length !== N) return false;
  const g = sig.readUInt32BE(0);
  if (g >= CAPACITY) return false;
  const tree = g >>> 8, leaf = g & 255;
  const bottom = part(sig, 4), top = part(sig, 4 + WOTS_BYTES + H * N);
  const bottomRoot = treeRoot(msg, bottom.wots, bottom.auth, pubSeed, 0, tree, leaf);
  return treeRoot(bottomRoot, top.wots, top.auth, pubSeed, 1, 0, tree).equals(root);
}

/** true iff `sig` (2,401 bytes: u8 leaf ‖ wots ‖ auth) is a vault key's signature of `msg`: the check the vault contract runs. */
export function verifyVault(msg, sig, root, pubSeed) {
  if (msg.length !== N || sig.length !== VAULT_SIG_BYTES || root.length !== N || pubSeed.length !== N) return false;
  const { wots, auth } = part(sig, 1);
  return treeRoot(msg, wots, auth, pubSeed, 0, 0, sig[0]).equals(root);
}

// Canonical digest: SHA-256(enc(app) ‖ enc(purpose) ‖ u16(version) ‖ chain ‖ u32(count) ‖ Σ enc(key) ‖ tag ‖ enc(value))
const u32 = (n) => { const b = Buffer.alloc(4); b.writeUInt32BE(n); return b; };
const enc = (b) => Buffer.concat([u32(b.length), b]);
const utf8 = (s) => Buffer.from(s.normalize("NFC"), "utf8");
/** A uint256 as its 32 big-endian bytes: the chain binding of a chain id, and every amount (tag `bytes`). */
export const u256 = (n) => Buffer.from(BigInt(n).toString(16).padStart(64, "0"), "hex");
/** An EVM address ("0x" + 40 hex, any case) as its raw 20 bytes (tag `bytes`). */
export const address = (a) => Buffer.from(a.slice(2), "hex");
/** `chain` is the 32-byte chain binding, u256(chain id); each field is [type, value] with type "str", "u64" or "bytes". */
export function canonicalDigest(app, chain, purpose, version, fields) {
  const keys = Object.keys(fields).sort();
  const parts = [enc(utf8(app)), enc(utf8(purpose)), Buffer.from([version >> 8, version & 255]), chain, u32(keys.length)];
  for (const k of keys) {
    const [t, v] = fields[k];
    let tag, body;
    if (t === "str") { tag = 1; body = utf8(v); }
    else if (t === "u64") { tag = 2; body = Buffer.alloc(8); body.writeBigUInt64BE(BigInt(v)); }
    else { tag = 3; body = Buffer.from(v); }
    parts.push(enc(utf8(k)), Buffer.from([tag]), enc(body));
  }
  return sha256(Buffer.concat(parts));
}

Check it against the vectors with verify-vectors.mjs. Download it with pq-crypto.json, protocol.json and vault.json into the same folder as verify-standalone.mjs. It rebuilds the register, launch and vault-spend digests from their documented field lists (spec §11, §13, §16) and checks four real signed vault withdrawals:

Shell
node verify-vectors.mjs .

Expected output (checked 2026-12-03 with Node 24):

encoding launch OK
encoding bind OK
encoding amount OK
sig 0 true tampered-sig: false other-msg: false
sig 257 true tampered-sig: false other-msg: false
sig 65535 true tampered-sig: false other-msg: false
protocol chain binding OK
protocol register OK
protocol launchWots OK
protocol vaultSpend OK
protocol vaultSpendToken OK
vault leaf 0 digest OK sig true tampered-sig: false other-leaf: false other-msg: false
vault leaf 1 digest OK sig true tampered-sig: false other-leaf: false other-msg: false
vault leaf 7 digest OK sig true tampered-sig: false other-leaf: false other-msg: false
vault leaf 255 digest OK sig true tampered-sig: false other-leaf: false other-msg: false

Each signature verifies; flipping one bit of the signature or of the message makes it fail. Index 65,535 is the last key of the last bottom tree, so the test covers the whole index range. The protocol digests match what our TypeScript builders produce, from an implementation that shares no code with them. The four vault lines repeat, off-chain, what the vault contract does on-chain for a withdrawal: rebuild the spend digest from the chain id, the factory, the vault, the leaf, the recipient, the token and the amount, then recompute the XMSS root from the 2,401-byte signature.

What the code does#

  • digits() turns the 32-byte message into 64 base-16 digits plus a 3-digit checksum (spec §6).
  • treeRoot() finishes each of the 67 chains from the signature value to position 15, compresses them into a leaf, then climbs 8 levels with the auth path (§7).
  • verifyHypertree() does that twice: the bottom tree signs your message, the top tree signs the bottom root (§8).
  • verifyVault() does it once, for the single tree of a vault key; the leaf is the first byte of the signature (§16).
  • canonicalDigest() is the length-prefixed, type-tagged encoding (§3). chain is the chain id as 32 big-endian bytes (u256(56) for BNB Chain); addresses go in as raw 20 bytes (address()), amounts as 32 big-endian bytes (u256()).

2. Full launch verification with the TypeScript packages#

@app/protocol (the package's name inside the QLab source; it is not published to npm yet) runs unchanged in browsers and Node. Given the qlab block from a coin's metadata:

TypeScript
import { verifyLaunchAttestation } from "@app/protocol"

const metadata = await (await fetch(ipfsGatewayUrl)).json()     // the coin's metadata JSON
const chainId = 56                                              // BNB Chain

// Signature-only check:
const { valid, trace } = verifyLaunchAttestation(metadata.qlab, chainId)

// With facts read from any RPC endpoint (no QLab API involved):
const full = verifyLaunchAttestation(metadata.qlab, chainId, {
  mint,            // the token address you are looking at
  creator,         // factory.launches(mint).creator, from the launch factory you trust
  anchor,          // { root, pubSeed, capacity } of the attested identity if anchor.isAnchored(wallet, …) ≠ 0, else null
  earliestAnchor,  // anchor.originOf(wallet) as { root, pubSeed, capacity }, or null if its blockNumber is 0
})
for (const s of full.trace) console.log(s.ok ? "✓" : "✗", s.step, "·", s.detail)

The trace has one step per check: format, chain, pq address, launcher, digest, scheme certificate (scheme signers only), signature, one plate … step per armor plate (war mode only), rotation chain (rotated identities only), and with chain facts mint, creator on-chain, anchor and earliest anchor (spec §17). valid is true only if every step passed.

3. Verify a live coin#

verifyCoin (packages/verifier) does the whole check for a token address with nothing but an RPC endpoint of its chain and IPFS gateways of your choice. It reads the token's metadataURI, creator, factory, name and symbol; requires the token to name the launch factory you trust and that factory's own record (launches(token)) to name the token and its creator; fetches the metadata by CID and re-hashes it where the CID allows; reads isAnchored and originOf from the anchor contract; runs verifyLaunchAttestation; and compares the on-chain name, symbol, quote asset and launch config with the signed fields. For Quantum and war launches it also looks for the launch's first-buy log and checks that the buy went to the attested vault (spec §17). Our API and database are never involved.

You supply two addresses: the launch factory and the anchor contract. They are set at deployment; until a build of the verifier pins them for BNB Chain, pass them yourself. Take them from a source you trust and compare them with a block explorer, because a verifier that asked a server which contracts to trust would be asking the party it is checking.

In a browser: verify.html#

qlab-verify.html (download above) is one self-contained file: no external scripts, no build step, and it works when opened from disk. Its Content-Security-Policy allows only its own embedded script, pinned by hash, and it connects only to the RPC endpoint and the IPFS gateways it is given.

  1. Download it and compare its SHA-256 with the value shown above:
Shell
sha256sum qlab-verify.html                 # Linux
shasum -a 256 qlab-verify.html             # macOS
certutil -hashfile qlab-verify.html SHA256 # Windows
  1. Open it and fill in the form:
FieldValue
Token addressthe coin, 0x + 40 hex
RPC endpointany JSON-RPC endpoint of the chain; a public BNB Chain endpoint is prefilled
Launch factorythe QLab launch factory you trust
Anchor contractthe QuantumAnchor contract
Chain id (optional)56 for BNB Chain; an endpoint that serves another chain is refused
IPFS gateways (optional)one or more gateway bases ending in /ipfs/; public gateways are used when empty
  1. Press Verify. Each step of the trace is shown with its result, then the verdict: verified, not verified, or no verdict when an endpoint did not answer. A war-mode coin also shows the algorithms that signed it.

To check that the file matches the source, build it yourself from the QLab source: pnpm --dir backend --filter @app/verifier run build:html prints the SHA-256 of dist/verify.html, which must equal the published one.

On the command line: qlab-verify#

The same code as a Node 24 command, qlab-verify (the bin of packages/verifier). From the QLab source:

Shell
pnpm --dir backend --filter @app/verifier... run build
node backend/packages/verifier/dist/cli.js <token> --rpc <url> --factory <0x…> --anchor <0x…> \
  [--chain-id 56] [--gateway <ipfs gateway>]… [--launch-tx <0x…>] [--finalized] [--json]
  • --rpc defaults to a public BNB Chain endpoint (https://bsc-dataseed.bnbchain.org). --gateway can be repeated and defaults to public gateways.
  • --factory and --anchor are required while no address is pinned for the chain in the build.
  • --chain-id refuses an endpoint that serves another chain. --finalized reads the chain at the last finalized block. --launch-tx names the launch transaction if you know it; it saves a search and is checked, not trusted.
  • It prints one line per step (✔ or ✘, step, detail) and then VERIFIED, NOT VERIFIED or NO VERDICT (retry later). --json prints the full result instead.
  • Exit code 0 = verified, 1 = not verified, 2 = usage error, 3 = no verdict, so it can gate scripts.

By hand#

Every chain fact is one eth_call. With Foundry's cast:

Shell
cast call <token>   "metadataURI()(string)" --rpc-url <rpc>
cast call <token>   "factory()(address)" --rpc-url <rpc>
cast call <factory> "launches(address)(address,address,address,bytes32,uint256,uint256,int24,uint64)" <token> --rpc-url <rpc>
cast call <anchor>  "isAnchored(address,bytes32,bytes32,uint32)(uint64)" <wallet> 0x<root> 0x<pubSeed> <capacity> --rpc-url <rpc>
cast call <anchor>  "originOf(address)((bytes32,bytes32,uint32,uint64,uint64))" <wallet> --rpc-url <rpc>
  1. The token's factory() must be the launch factory you trust, and launches(token) on that factory must return the token and its creator (the third value).
  2. Fetch the JSON behind metadataURI() from IPFS; take metadata.qlab.
  3. isAnchored for the attested wallet and identity must be non-zero: that is the block in which the wallet anchored it.
  4. originOf(wallet) must be the attested identity, or the first identity in identity.rotations: the first anchor decides (spec §11).
  5. Run verifyLaunchAttestation with those facts.

Any failed step means the coin's provenance is not established.

Check pqc.market coins too#

We re-verified pqc.market's own launch signatures and vault withdrawals with independent code: 46 of 46 WOTS launches and 68 of 68 mainnet vault withdrawals. pqc.market runs on another chain and its format differs from ours ("k=v" lines, 256-key trees), so the verifier above does not apply to their coins.