1. Accounts (PDAs)
| Account | Seeds | Role |
|---|---|---|
| Registry | ["registry", authority] | Canary count, heartbeat slot, largest broken RSA size, secp/ed dead flags (trustless canaries: broken_*; all canaries: op_broken_*), index (bps), ledger root and post slot, index_authority, canaries_frozen, pending_authority |
| Canary | ["canary", registry, id le] | Kind (RSA/secp256k1/Ed25519), origin (0 operator, 1 RSA challenge, 2 NUMS), target (N or public key), strength in bits, alive flag. Account balance = bounty |
| Commit | ["commit", canary, claimer] | RSA answer commitment hash + slot |
| IndexBoard | ["board", registry] | Up to 5 oracles, quorum, vote freshness window, votes {bps, slot, root}. Becomes the registry's index_authority on creation |
| PqVault | ["pqvault", owner, registry] | Ed25519 owner, LMS public key (60-byte HSS, L = 1), next_q, delay slots, breaker policy, one pending withdrawal |
| SigBuffer | ["sigbuf", vault, writer] | LMS signature staging (≤ 5,104 B). Bound to its writer, closed after execution |
2. Kill proofs (no human judges)
RSA: commit-reveal + on-chain bigint product
Post only a hash with commit_claim(h), then claim_rsa(p, q) at least DELAY slots later. The program checks h == sha256("QCANARY-CLAIM-v1" ‖ canary ‖ claimer ‖ len(p) u16le ‖ p ‖ q), p, q > 1 and p·q == N (schoolbook multiplication over 32-bit limbs), pays the full bounty, marks the canary dead and updates broken_rsa_bits. Copying an answer out of the mempool gains nothing.
secp256k1: secp256k1_recover
The claimer signs "QCANARY-CLAIM-v1" ‖ canary ‖ claimer with the target key. If the syscall recovers the target public key, the claimer holds the private key. Targets are NUMS points (x-coordinates from hash-and-increment), so no one should know their discrete log.
Ed25519: precompile introspection
The program reads the Ed25519 precompile instruction in the same transaction through the instructions sysvar and checks that public key, message and offsets match exactly. Targets are NUMS points: a hash decoded to a point, then multiplied by the cofactor 8.
Who can fake a break? (canary origin)
A canary whose secret someone could hold proves nothing when it dies. Only two origins are trustless, and the program checks both itself:
add_canary(kind, label, target)
origin = RSA_CHALLENGE if kind == RSA and sha256(N) ∈ {sha256(RSA-1024), sha256(RSA-2048)}
= OPERATOR otherwise (calibration rungs, operator test keys)
add_nums_canary(kind, label, ctr ≤ 1000, target) // origin = NUMS, else NotNums
secp256k1: x == sha256("Quantum Canary secp256k1 NUMS v1" ‖ ctr u32be), y even, y² ≡ x³ + 7 (mod p)
ed25519 : target == 8 · decode(sha256("Quantum Canary ed25519 NUMS v1" ‖ ctr u32be)) ≠ identity
(curve25519 syscalls validate_edwards / multiply_edwards)
kill(canary): op_broken_* always; broken_* only if origin ≠ OPERATOR
freeze_canary_set() // authority, permanent: no add_* afterwards
propose_authority(k) → accept_authority() // two-step handover, signed by k
3. Oracle board
init_board(oracles: Vec<Pubkey> (1..=5, no duplicates), quorum (strict majority: quorum > n/2, ≤ n), max_age_slots)
signers: registry authority + current index_authority // the authority alone cannot swap the publisher
→ registry.index_authority = board PDA // the old single authority can no longer post_index
vote_index(index_bps ≤ 10_000, sources_root: [u8;32])
votes[oracle] = {bps, slot: now, root}
fresh = votes where now - slot ≤ max_age_slots
if |fresh| ≥ quorum:
registry.qday_index_bps = upper_median(fresh.bps) // fresh[len/2]
registry.index_sources_hash = root of the vote that was the median
registry.index_slot = now
With n = 3 and quorum 2, one oracle reporting +60 leaves the median between the two honest values. When votes expire the quorum breaks and the index stops updating; a consumer's max_index_age_slots then treats that as danger (bit 32).
4. Circuit breaker check(policy) → u8
| Bit | Condition |
|---|---|
| 1 | broken_rsa_bits ≥ rsa_trip_bits |
| 2 | trip_on_secp256k1 && broken_secp256k1 |
| 4 | trip_on_ed25519 && broken_ed25519 |
| 8 | Heartbeat older than max_heartbeat_age_slots (dead-man switch) |
| 16 | qday_index_bps > max_index_bps |
| 32 | Index post older than max_index_age_slots |
The mask is returned as CPI return data. assert_safe(policy) is a convenience instruction that fails when the mask is non-zero. The heartbeat only advances when every registered canary account is passed in remaining accounts and checked alive. By default the broken_* flags count only trustless canaries; a policy with trust_operator_canaries = true reads op_broken_* instead (all canaries, including ones the registry authority may hold the secret of).
5. LMS signatures (RFC 8554 · NIST SP 800-208)
The PQ key is a standard LMS key (Leighton–Micali, RFC 8554), the stateful hash-based scheme NIST approved in SP 800-208. SHA-256 only, n = m = 32. The on-chain verifier (programs/pq_vault/src/lms.rs) handles every RFC 8554 type and passes the RFC's Appendix F test vectors (HSS L = 2: H5/W8 and H10/W4 over H5/W8). The JS signer (client/lms.mjs) re-derives the RFC's Test Case 2 keys from their SEED and I, and reproduces the RFC's top-level signature byte for byte.
x_q[i] = H(I ‖ u32(q) ‖ u16(i) ‖ 0xff ‖ SEED) // Appendix A key derivation (client only)
step = H(I ‖ u32(q) ‖ u16(i) ‖ u8(j) ‖ tmp) // Winternitz chain step j
Q = H(I ‖ u32(q) ‖ 0x8181 ‖ C ‖ message) // C = 32-byte randomizer
digits = coef(Q ‖ Cksm(Q), i, w), i = 0..p−1 // W4: p = 67 (64 + 3 checksum)
Kc = H(I ‖ u32(q) ‖ 0x8080 ‖ z_0 ‖ … ‖ z_{p−1}) // z_i = chain from digit to 2^w − 1
leaf = H(I ‖ u32(2^h + q) ‖ 0x8282 ‖ Kc)
node = H(I ‖ u32(r) ‖ 0x8383 ‖ left ‖ right) // climb to T[1]
HSS public key (vault, 60 B) = u32(L = 1) ‖ u32(lms_type) ‖ u32(ots_type) ‖ I[16] ‖ T[1][32]
HSS signature (staged) = u32(Nspk = 0) ‖ u32(q) ‖ u32(ots_type) ‖ C ‖ y_0..y_{p−1} ‖ u32(lms_type) ‖ path[h]
= 2,352 B at H5/W4, 2,512 B at H10/W4
signed message = "QCANARY-PQ-v2" ‖ vault ‖ created_slot u64le ‖ key_epoch u32le ‖ Borsh(PqAction)
| Accepted on chain | Why |
|---|---|
| HSS L = 1; LMS_SHA256_M32_H5 … H25 | Up to 33.5M one-time leaves per key. Deeper trees add only h hashes to verify |
| LMOTS_SHA256_N32_W4 or W2 | W4 walks at most 1,005 hashes, W2 at most 399. W8 (up to 8,670) does not fit the compute budget; W1 signatures (8.5 KB) are too large |
Measured on the local validator: a PQ withdrawal at H5/W4 costs 123,096 CU and a veto 119,145 CU (the chain walk depends on the message digits), about 9% of the 1.4M limit; at H5/W2 it costs 82,956 CU. Any RFC 8554 implementation (for example a hardware signer) can produce the signature: the vault only adds the domain-prefixed message.
6. PQ bunker vault (pq_vault)
| Instruction | Signer | When the breaker trips |
|---|---|---|
request_withdraw(amount, to) | Ed25519 owner | Refused (BreakerTripped) |
execute_withdraw | Anyone, after the delay | Refused |
open/write/close_buffer | Anyone (writer-bound) | Allowed |
pq_execute(Withdraw{amount,to}) | LMS (any relayer) | Allowed |
pq_execute(Veto{request_id}) | LMS | Allowed |
pq_execute(Rotate{new_pub}) | LMS | Allowed |
pq_execute(SetOwner{new_owner}) | LMS | Allowed |
The signed message is "QCANARY-PQ-v2" ‖ vault ‖ created_slot u64le ‖ key_epoch u32le ‖ Borsh(PqAction). created_slot is the slot the vault was created in, so the same vault address on another cluster signs a different message. key_epoch starts at 0 and every Rotate increments it, so signatures made under an earlier key period never verify again (variant byte 0–3). The leaf used must satisfy q ≥ next_q, and afterwards next_q = q + 1. Tests confirm that replaying a signature, changing the destination, changing the amount and forging a signature are all refused. Rotate to a new tree before the leaves run out.
7. Signal ledger (Merkle)
canonical(s) = JSON.stringify([date, category, target, practicality, verified, attention, title, url])
leaf = sha256(0x00 ‖ utf8(canonical(s))) // signals sorted by canonical()
node = sha256(0x01 ‖ left ‖ right) // odd node promoted unchanged
proof = [{side: "L"|"R", hash}] // sibling position per level
Oracles vote this root together with the index. Anyone can check whether a given signal is in the score, and whether it was edited, with the site's “Verify” button or index/score.mjs verifyProof. The 0x00 / 0x01 domain split rules out leaf/node confusion (second-preimage) attacks.
8. Index formula (rubric v1)
w_threat(s) = [0, 2, 5, 12, 40, 100][practicality] × (verified ? 1 : 0.25) × (policy ? 0.5 : 1) × 2^(−age/180d)
(practicality 5 does not decay)
w_attn(s) = [0, 1, 3, 7, 15, 30][attention] × 2^(−age/30d)
index(Σw) = 100 · (1 − e^(−Σw / 60))
fear_gap = attention_index − threat_index
dead sentinel canary ⇒ threat ≥ 90 (and its target ≥ 90)
9. Threat model and limits
- Silent break: an attacker who prefers a bigger prize than the bounty keeps the canary quiet. Mitigation: timelocked Ed25519 withdrawals with a PQ veto, plus the dead-man heartbeat.
- Oracle collusion: a colluding quorum can move the index. Policies are designed to use the index together with canary bits, not alone.
- RSA trusted setup: calibration rungs assume the generator discarded the factors, so they are
OPERATORcanaries and never trip a default policy. Challenge numbers rely on RSA Labs having discarded theirs. NUMS curve rungs need no trusted setup, and the program re-derives them. - LMS state: losing the signer's leaf counter risks reuse (as with every stateful scheme in SP 800-208). On chain, monotone leaves refuse any second use of a leaf.
- Deployment status: local validator only, unaudited, not deployed to devnet or mainnet. Not investment advice.