
Quantum Pass
Bouncer
Discord roles that only a post-quantum key can open: every pass is an ML-DSA-87 signature checked on chain by pqcVerify.
About
Bouncer is a Discord bot that gives a role only to members who sign with their QoreChain account's ML-DSA-87 key. The decision is made on chain: BouncerRegistry rebuilds the exact text the member signed, reads the account's key from the pqcKeyStatus precompile and checks the signature with pqcVerify. Not our server, not a moderator, and not someone holding the member's stolen secp256k1 key can let anyone in. Live: https://bouncer-qore.vercel.app Demo server: https://discord.gg/GW8wShTgJv (type /verify) Forgery lab: https://bouncer-qore.vercel.app/lab Code (MIT): https://github.com/justhereandthere/bouncer THE PROBLEM Today's role bots (holder roles, verified roles, "connect your wallet" gates) trust a signature made with the wallet's classical key. The day a quantum computer derives that key from its public key, the thief signs as you and walks into every gated server you belong to. A QoreChain account can hold a second key, ML-DSA-87, that the thief cannot sign with and, once registered with a proof of possession, cannot replace. Bouncer makes that key the only thing that opens the door. HOW IT WORKS • /verify: Bouncer answers privately with a one-time link bound to your Discord ID, this server and a fresh nonce (30 minutes). • Sign in QoreX: one message, shown in full, signed with secp256k1 and ML-DSA-87. No transfer, no gas. The page reads the text from the contract itself, so page and chain can never disagree on a byte. • The registry decides: off chain both halves are checked with QoreSign; on chain, checkPass runs pqcKeyStatus (proof of possession required) and pqcVerify; the relayer writes issuePass and the role is granted. A refusal names its reason. • The patrol: standing(server, user) is re-checked on chain. If the member's key changed or was removed, or the balance fell below the rule, the role goes. /status re-checks at once. • Admins run /setup, pick the role and a QOR minimum, and sign the door with their own ML-DSA-87 key: from then on only that key can change it. Opening the door needs a door fund, a hybrid-signed (secp256k1 + ML-DSA-87) transfer of 0.5 QOR to the relayer that pays the members' gas; Bouncer verifies the committed transaction's ML-DSA-87 layer before the door opens. TRY IT 1. Switch QoreX to the testnet (click the version number seven times, then Switch to testnet). 2. Join the demo server and type /verify in #start-here. 3. Sign once in QoreX and get @quantum-safe. 4. Open the Forgery lab: a real pass from the chain, attacked seven ways (a flipped bit, another Discord user, another server, a thief's own ML-DSA-87 key generated in your browser, an account without a key, a replay). Every answer comes from the live registry. 5. Run /setup in a server of your own to try the admin side, or open the door list to see every pass and its live standing. WHAT A THIEF CAN AND CANNOT DO • With your secp256k1 key: sign classical messages as you, nothing more. No ML-DSA-87 signature, no pass (BadSignature). • With a copied pass: nothing. Every pass is bound to Discord user, server, account, one-time nonce, expiry (at most one hour) and the registry address; a replay is NonceUsed. • With the relayer's classical key: submit only what the registry accepts anyway. The relayer's EVM window is scoped to the registry (allowed_targets) with a 25 QOR cap, and it cannot sign for anyone. • With one wallet and many Discord alts: one account opens the door for one Discord user per server; signing for another moves the pass. The full threat model (14 attacks and what stops each) is in docs/THREAT_MODEL.md. QUANTUM PASS EVIDENCE • create-qorechain-dapp 0.14.0: the first commit is the untouched viem-wagmi and foundry scaffolds. • QoreX: enable, getKey, signArbitrary and signAndBroadcast. • Deployed on testnet: BouncerRegistry 0x16069B0610bcC3fdE4B395935019e992BE475A3C (qor1zcrfkpsshnplme9njkf4qx0fj2lywk3uy5sd2t). • Hybrid-signed transaction: door fund EFF2E65C1A403AEE3ADFE18FF19DA92D4899493789037FD0D3991F4C0BA69355, verified by the server with inspectTransaction before configureGate.
How it's made
Started from create-qorechain-dapp 0.14.0: web/ from the viem-wagmi template, contracts/ from the foundry template. The first commit is the untouched scaffold; the template's window.ts registered the relayer's ML-DSA-87 key (with proof of possession) and opened the deploy window. CONTRACT: BouncerRegistry.sol (Foundry, no owner, no upgrade path) • passMessage / setupMessage build the exact text a member or admin signs (QoreSign message-signing v1). The web page asks the contract for it, so the signed bytes are the contract's own. • checkPass / checkSetup: expiry (at most one hour), nonce not used, door exists, pqcKeyStatus (0x…0a02): registered, ML-DSA-87, possessionProven; then pqcVerify (0x…0a01) over "qorechain-msg-v1|qorechain-diana|" + text; then the balance rule. They are free eth_calls; issuePass and configureGate run the same checks and write. • standing(server, user): is the account's current key the one that signed (keccak of the pubkey), still proven, and does it hold the minimum? The patrol and /status use it. • verifyPassSignature: the cryptography alone, so the Forgery lab can test tampered copies of a real, already-used pass. • 21 Foundry tests. The pqcVerify stand-in runs real ML-DSA-87 verification (the QoreChain pqc kit through vm.ffi) and the tests sign with real ML-DSA-87 keys: flipped byte, another Discord user, another server, a thief's own key, replay, expiry, no key, key without proof, balance, admin takeover, pass moving between alts, key rotation. SERVER: Vercel Functions, no database • api/discord: HTTP interactions (Ed25519-verified, no gateway process): /verify, /setup (Manage Server), /status, /door. • Tickets are HMAC-signed and carry server, user, nonce and expiry; they travel in the URL fragment, so they never reach logs or Referer headers. The nonce becomes the on-chain nonce and is burned on first use. • api/pass and api/setup stream their real progress (NDJSON): QoreSign verifyMessageWithChain on both halves, checkPass as a dry run, the relayer's window, the write, the role. • The door fund is checked with QoreSign inspectTransaction: committed, tier pqc, ML-DSA-87 layer verified, signer is the admin, recipient the relayer, at least 0.5 QOR, memo naming this server and setup nonce. • The relayer is an eth-native account with its own ML-DSA-87 key. It opens its EVM window itself with a hybrid-signed MsgOpenEVMWindow scoped to the registry (allowed_targets = [registry], 25 QOR cap), only when the current one runs low. • api/recheck is the patrol (Vercel Cron daily, GitHub Actions every 10 minutes). WEB: Vite + React, reading the chain directly over the EVM JSON-RPC • /pass and /setup: QoreX through @qorechain/qorex-types (enable, getKey, signArbitrary, signAndBroadcast with a cosmjs-types MsgSend). Key and balance are read from pqcKeyStatus and eth_getBalance; an account without a key can register it from the page with a 1 uqor self-send. • /doors and /door/:id list every door and pass from the registry's own enumeration, with each pass's live standing. • /lab decodes a real issuePass from chain and runs seven forgeries; the thief's ML-DSA-87 key is generated in the browser with @qorechain/pqc. • Every ticket carries a stamp drawn from the pass's own key or signature bytes. KITS @qorechain/sdk (window messages, hybrid EthNativeSigner, accounts), @qorechain/evm (chains, window helpers), @qorechain/qoresign (verifyMessageWithChain, inspectTransaction), @qorechain/qorex-types, @qorechain/pqc, create-qorechain-dapp. WHAT WAS HARD • Ordinary QoreX accounts cannot send EVM transactions, so passes are relayed, and the relayer had to be harmless if compromised: it can submit, never sign, and its window reaches only the registry. • Before writing the contract we checked on chain that a real QoreX signArbitrary signature verifies with pqcVerify over the prefixed bytes (true), and that one changed character does not (false). • Discord gives a bot three seconds: chain reads were split from the relayer so those functions bundle viem alone (about 0.8 s cold). • Vercel compiled the functions to CommonJS, which cannot require() the ESM-only noble crypto under cosmjs; each function now ships as one esbuild ESM bundle through the Build Output API. • The RPC caps logs at 10,000 blocks, so the pages enumerate the registry instead of scanning events. Built with Claude Code; the workflow, the generated work and the human decisions are in AI_USAGE.md.
Timeline
Pushed 2 commits to main
Pushed 5 commits to main
- d0b8841 Test the role hierarchy Bouncer may hand out, including Discord's tie-break by id · justhereandthere
- bf969b4 Test the config, door and patrol endpoints · justhereandthere
- aaea0b9 Test the pass and setup flows: every refusal stops before the relayer · justhereandthere
- fa49073 Contracts: real gas on diana (issuePass 492,758; configureGate 410,567) and a gas snapshot · justhereandthere
- e440fa1 README and changelog for 1 December: test counts and what changed · justhereandthere
Pushed 7 commits to main
- 4df871a Contract edge tests: expiry and one-hour boundaries, setup replay, admin key without proof, · justhereandthere
- 0740ab9 Test the Discord command handler end to end with signed requests · justhereandthere
- a71de9f Test the session API: forged tickets, no door, pass facts, admin roles, wrong page · justhereandthere
- 0d4054d Test the QoreX helpers: missing, outdated, mainnet, connected; hybrid, classical-only and declined signatures · justhereandthere
- 6e80f38 Test qor1 <-> 0x conversion on the project's real accounts, checksum refusal, explorer links · justhereandthere
and 2 more commits
Pushed 8 commits to main
- 3f8c2f6 Test: one nonce serves once across setups and passes · justhereandthere
- 38c9393 Test: a pass in one server opens no other door, even with the same admin · justhereandthere
- eb51874 Fuzz: any single flipped bit in a real ML-DSA-87 signature is refused · justhereandthere
- 3fd61e5 Test: streamed progress parser (step transitions, refusals, network failure, early close) · justhereandthere
- 3b9410f Test: server progress stream, refusal mapping and Discord id validation · justhereandthere
and 3 more commits
Pushed 10 commits to main
- 28d9e88 Test: members() pages safely past the end and for unknown servers · justhereandthere
- 2b1448a Test: configureGate refuses direct calls, even from the admin with a valid signature · justhereandthere
- a29c617 Test: format helpers (address shortening, 18-decimal QOR, role colours, acronyms) · justhereandthere
- 3d086ee Test: page refusal texts track the contract's Refusal enum; door-fund memo format · justhereandthere
- a220329 Docs: a two-minute guide for trying Bouncer as a member, a forger and an admin · justhereandthere
and 5 more commits
Pushed 8 commits to main
- 4e216cf Fast Discord replies, demo video, patrol workflow · justhereandthere
- 5b74ced Deploy as prebuilt Build Output: each function one ESM bundle · justhereandthere
- 6f83f05 README with requirement-to-evidence map, threat model, AI usage, cover · justhereandthere
- 9e12fb3 MIT licence; Vercel config with SPA routing, REST proxy and a daily patrol cron · justhereandthere
- 9a250cd Web: landing, member pass, admin setup, door list and forgery lab · justhereandthere
and 3 more commits
Bouncer is live and the 2:20 demo is up. Members type /verify in Discord, sign once in QoreX with their ML-DSA-87 key, and BouncerRegistry checks the signature on chain with pqcVerify before the role is granted. The video shows a member getting in, the forgery lab refusing seven attacks against the live registry, an admin raising the rule with a hybrid-signed door fund, and /status taking the role back when the member no longer qualifies. Try it in the demo server: https://discord.gg/GW8wShTgJv
https://bouncer-qore.vercel.app𝕏 McgrodI built Bouncer, a discord roles that only a post-quantum key can open. Members sign once with their @QoreChain ML-DSA-87 key and a contract checks it on chain with pqcVerify. Try it: https://t.co/HXLm13sJNmhttps://t.co/lZmblyxadn #BuildBeforeQDay pic.twitter.com/Vy9FQ2Lnl1Earned a Ship Weeks badge.
Earned a Ship Weeks badge.
New project.
Comments and questions
- No comments yet.