New project.

About
Q-Day is the day a quantum computer can break ECDSA. On that day, any wallet guarded only by a classical key can be drained by whoever recovers it. Q-Day Vault is built for that day. Funds in the vault can only move with an ML-DSA-87 (FIPS 204) signature from the owner's post-quantum key. The signature is checked on-chain through QoreChain's pqcVerify precompile. The owner key is bound to the account's on-chain registered PQC key: the contract checks pqcKeyStatus, including proof of possession, when it is deployed. The caller's address (msg.sender) grants nothing, so a stolen or quantum-broken ECDSA key gives an attacker zero power over the vault, and anyone (for example a relayer) can submit a signed request. Features • Post-quantum withdrawals: native QOR and ERC-20, instant up to a daily limit. • Larger withdrawals are queued behind a time delay (timelock). • A second post-quantum "guardian" key can cancel queued actions or freeze the vault. Unfreezing needs both keys. • Key rotation, limit changes and delay changes all need post-quantum signatures and go through the timelock. A per-role key version counter cancels anything signed by a key that has since been replaced. • Replay protection: each signed message carries the chain id, the vault address, a per-role nonce and a deadline. A 0xFF domain tag keeps vault messages from ever matching any other message format the QoreChain SDK signs. • Users interact through EVM windows scoped to the vault only (allowed_targets = [vault]), with small max_value and max_txs. Security evidence • docs/SECURITY_PROOFS.md: short, readable proofs of each security claim (no theft without the PQ key, no replay, timelock cannot be bypassed, guardian powers are limited, key rotation is safe), each linked to the tests that check it. • 73 tests: unit tests, adversarial tests and Solidity fuzz/invariant tests, using real ML-DSA-87 signatures. • Live on testnet: key registered with proof of possession, vault deployed, deposit, instant and queued withdrawals, guardian cancel, freeze and joint unfreeze all run on chain. • npm run attack: plays the Q-Day Drill attacker with only the ECDSA key. All 14 attacks are blocked, including native transfers, opening an EVM window, replacing the PQ key, forged signatures, a takeover attempt, and replaying a real past signature. Built with Hardhat 3 + viem, @qorechain/sdk and @qorechain/evm. Based on the qorechain/build-before-qday workshop-1 template (Apache-2.0).
How it's made
Architecture QDayVault.sol is a single Solidity 0.8.28 contract. Every action that moves funds or changes settings is authorised by an ML-DSA-87 signature over a fixed 384-byte message (12 ABI words), never by msg.sender: (0xFF domain tag, chain id, vault address, role, nonce, deadline, action, asset, to, amount, item id, value) The contract staticcalls the pqcVerify precompile (0x…0A01). It accepts only a well-formed 32-byte "true" reply, so it fails closed if the precompile is missing or returns garbage. A per-role nonce and a deadline stop replays and stale signatures. In the constructor, pqcKeyStatus (0x…0A02) must report that the owner key is the account's registered ML-DSA-87 key with proof of possession, otherwise the deploy reverts. Two post-quantum roles: • the owner withdraws, rotates keys and changes the daily limit and the delay; • the guardian can only cancel queued actions and freeze the vault; • unfreezing needs both signatures. Withdrawals within the daily limit pay out at once. Larger ones, and every admin change, wait in a timelock queue. Each queued item records the version of the key that signed it. When a key is rotated its version counter goes up, so pending items signed by the old key die, even if that same key is later set again. Network features used • pqcVerify and pqcKeyStatus EVM precompiles (QoreChain testnet) • ML-DSA-87 key registration with proof of possession (@qorechain/sdk) • Hybrid-signed native transactions; EVM windows opened by hybrid signature. The deploy uses an unscoped window; users get windows scoped to the vault only (allowed_targets = [vault], small max_value and max_txs) • A separate PQ key: the drill account's ML-DSA key comes from its own recovery code, not from the ECDSA key Tooling Hardhat 3 + viem, @qorechain/sdk and @qorechain/evm 0.14, Hardhat Solidity fuzz/invariant tests (forge-std), Slither. A TypeScript CLI (npm run vault) covers key registration, windows, deploy, deposit, withdraw, cancel, freeze and unfreeze. Before signing, it rebuilds the message locally and refuses to sign if the vault's messageFor() returns something different, so a lying RPC cannot trick the user into signing the wrong thing. Testing 73 tests. Hardhat has no QoreChain precompiles, so the unit tests use a mock that only accepts signatures we actually produced with the SDK. Every test signature is a real ML-DSA-87 signature. The adversarial suite covers reentrancy, malicious tokens, garbage precompile replies, replay across nonces, chains and vaults, a lying RPC, and 200 random encoding cross-checks. The invariant suite fuzzes honest, attacker and replay actions and checks that the vault never pays out without a valid PQ signature. On testnet, every flow was run for real, and npm run attack replays the Q-Day Drill attacker with only the ECDSA key: 14 of 14 attacks were blocked. What was hard • The precompile's exact semantics were undocumented. A live probe showed it is pure FIPS-204 verification over raw message bytes. • Domain separation: we listed every message format the QoreChain SDK signs and proved a vault message can never be the same bytes as any of them, so a signature made for something else can never authorise a vault action. • Key rotation: two design flaws were found by our own tests and fixed. (1) Replacing the guardian did not cancel its queued items. (2) Setting an old key back would revive its items. The fix is the monotonic per-role key version counter. • viaIR caches block.timestamp across vm.warp in fuzz tests, which needed explicit time tracking. • The proofs of every security claim are in docs/SECURITY_PROOFS.md.
Timeline
Comments and questions
- No comments yet.