Skip to content
QORECHAIN
Register

Post-Quantum dApp

Buggy

The QoreChain EVM safety kit: PQ security gates that fail closed instead of silently passing on mainnet.

Share on X

About

Buggy is a safety kit for Solidity contracts on QoreChain that check post-quantum signatures. On QoreChain, calling a precompile that is switched off does not fail: it returns success with no data. The post-quantum signature verifier is switched on for testnet and off on mainnet. So a signature check that passes every test on testnet lets anyone through once the contract is moved to mainnet. Buggy makes those checks fail closed. FailClosedPQ is a Solidity library that treats a missing or short answer as a refusal. QGuard is a wallet that only runs a call signed with ML-DSA-87, so a stolen classical key moves nothing. Portcullis gives every token approval a hard cap and an expiry. The portcheck CLI reruns a project's own tests with the verifier switched off and flags every check that silently stops working. Everything is shown with real transactions on testnet. Anyone can try it on the website without a wallet: sign a message with ML-DSA-87 in the browser, watch testnet check it while mainnet answers with nothing, then see which of four deployed vaults lets junk bytes through.

How it's made

We started from a flaw, not a feature. Before writing code we called every QoreChain precompile on testnet and mainnet, read-only, and saw that a switched-off precompile answers with success and no data instead of an error. We never sent a transaction to mainnet. The contracts are Solidity 0.8.24, built and tested with Foundry (71 tests). FailClosedPQ is the only place the verifier is called: it checks the length and value of the answer, never just the success flag. ML-DSA-87 signatures are 4,627 bytes, so QGuard reads the owner's 2,592-byte key on chain from QoreChain's key registry and requires proof of possession instead of taking the key as input. A contract cannot see the owner's EVM window, so Portcullis asks the owner to set a matching expiry, at most one day. The testnet demo is a set of TypeScript scripts using the QoreChain SDK and qorechain-pqc. They register both accounts' ML-DSA-87 keys with proof of possession, open scoped EVM windows with hybrid ML-DSA-87 transactions, deploy nine contracts and send 37 transactions, nine of them deliberate refusals. Vaults pointed at a switched-off precompile reproduce mainnet: the naive vault paid out on four junk bytes and the guarded vault refused. Vaults on the live verifier refuse forged and replayed signatures and pay out on a real one. The website links every one of these transactions to its receipt. The Solidity PQC features cannot be verified automatically, so here is where to look. Signature check (pqcVerify): QGuard executes an ML-DSA-87 signed transfer in 0x9434029cc6e4adb846d08b4c2ccaddfc54d1946ab5514364848bfd54f5a1fe49, GuardedVaultLive pays out on a valid signature in 0x5640d328f2cee8b4d9ef7c206570a5277812d01f265756f64d4891fdecb10132 and refuses a forged one in 0x59076a99ae896aef485644479e0ed47565e458113d6e352577628af8dd317689. Key status (pqcKeyStatus): QGuard and the attestation registry read the signer's key and its proof of possession before verifying, as in the attestation 0x9a08e963d32ff5eb086fdf1721a5e7a318e5034ca02dff30debc737c30f83cd0. Contracts: QGuard 0x86796b95189ef45bd8d6868284a5e6579b8deb0f, GuardedVaultLive 0xdc871dce3f132684d4ff63867c4755063c2e7705, Attestations 0xc3e812ffe44b0e991c6c8e0a332b7e75335d00ed. portcheck is a TypeScript CLI with 13 tests. It copies a Foundry project, turns the precompile mocks into no-ops and compares each test before and after. Its report on GuardedVault is hashed and attested on chain under an ML-DSA-87 signature. The kit went through both stages of the QoreChain AI audit (45, then 65 out of 100). None of the 13 findings was confirmed, and each one is answered in docs/AUDIT.md with a regression test or a design reason. How we worked: one developer directing several AI coding agents, with separate checker agents that replayed claims against the chain and tested the site from phones to wide screens. AI_USAGE.md describes the workflow and the mistakes the checkers caught. Further findings from our review are being disclosed privately to the QoreChain team.

Timeline

BuggyPost-Quantum dApp

Pushed 45 commits to main

  • c388a97 Run portcheck's forge with ffi and file access off and refuse a symlinked helper; state its trust limits · charlesms1246
  • b022e75 Restore the open-source credits the fest rules require · charlesms1246
  • 17c6cc5 Make the security review summary and the Portcullis re-approval limit precise · charlesms1246
  • d399abc Describe the QGuard gas limit precisely · charlesms1246
  • 39a0211 Document the internal security review's findings as limits · charlesms1246

and 40 more commits

BuggyPost-Quantum dApp

New project.

Comments and questions

  • No comments yet.