
Post-Quantum dApp
Sera Bolt
A drop-in guard that only trusts post-quantum keys registered and proven on chain.
About
On Q-Day, a stolen or quantum-cracked ECDSA key can drain a contract that trusts it. QoreChain's pqcVerify precompile fixes that, but it's easy to get subtly wrong. The most common mistake is verifying a signature against a public key the caller supplies. That lets an attacker pass with their own valid ML-DSA key. Sera Bolt is a drop-in Solidity library. A contract inherits OnlyPQ and adds one modifier. The library: - looks up the signer's registered ML-DSA-87 key through pqcKeyStatus, and requires proof of possession - verifies with pqcVerify - fails closed on empty precompile returns - binds every signature to the chain, contract, function, its arguments, the value sent, a nonce and a deadline npm: https://www.npmjs.com/package/sera-pq
How it's made
What's built - Solidity library (PQGuard + PQPrecompiles) with named errors, plus a Foundry kit with precompile mocks and real ML-DSA test vectors. - Adversarial Foundry suite covering: ECDSA-only, a foreign valid key, an unregistered key, no proof of possession, replay, cross-contract or cross-chain signatures, an expired deadline, and known precompile edge cases. 72 tests; all 33 attack tests fail without the guard. - Three retrofits deployed on testnet: the official QDayVault, the official cross-VM checkout and PQ Passport. Guarded calls go through a scoped EVM window. - QCAI audit in two stages (92, then 85), every finding answered with tests. - Published on npm as sera-pq: the guard, the precompile library and the interface. - Hosted demo, no wallet needed: a five-step guided story with real testnet transactions, plus an attack matrix to simulate or send each attack. Architecture - OnlyPQ / PQGuard: takes the signer's public key from the pqcKeyStatus precompile (registered and possession-proven), never from the caller, and verifies the signature with the pqcVerify precompile (ML-DSA-87). It fails closed: an inactive precompile or malformed answer reverts with a named error. - The signed digest binds the chain, the contract, the function, its arguments, the value sent, a per-signer sequential nonce and a deadline, so a signature works once, in one place, for a limited time. - Foundry kit: precompile mocks plus real ML-DSA-87 signatures. 72 tests; all 33 attack tests fail when the guard is removed. - Retrofits: the official QDayVault (the hand-written post-quantum check became one modifier), the official cross-VM checkout (the guard composes with the bridge call; a failure after it undoes both sides and keeps the nonce) and PQ Passport (MIT). - Live demo: a relay sends real testnet transactions as the attacker, through scoped EVM windows limited to the guarded contracts. Nine attacks are refused on chain; a free-play page simulates each one or sends it for real. - Published on npm as sera-pq. About 183,000 extra gas per guarded call. Network features pqcKeyStatus and pqcVerify precompiles, scoped EVM windows (allowed targets), the cross-VM bridge, and QCAI, which audited it in two stages (92, then 85; every finding answered with a test). What was hard - Our first premise was wrong: we assumed QoreX's automatic signing windows were unscoped. Testing showed they are scoped and close after one transaction, so we refocused on the real gap: contracts that check a post-quantum signature against a key the caller supplies. - Making the guard fail closed on every precompile answer, including empty or short return data. - eth_call with any state override switches off QoreChain's precompiles, so simulations can read "success, no data". We reported it (qorechain-core #14). - Refused calls are mined and reverted, but the explorer can still show "success" for them, so the demo reads receipt status from the chain itself. We reported it (qorechain-explorer #1). - The public RPC occasionally drops requests, so the demo falls back to clearly labelled recorded runs.
Timeline
Comments and questions
- No comments yet.