Post-Quantum dApp
Redzone
A public crash-test arena for AI robots, with bounties protected by post-quantum signatures.
About
RedZone is a public crash-test arena for AI robot brains. A robot owner registers an AI brain and locks a bounty in a smart contract on QoreChain. Players connect their QoreX wallet and get a few attempts per day to trick the robot into entering a forbidden "red zone" in a 2D simulation. If a player breaks the robot, the contract pays them the bounty automatically. If the robot defends itself, its public safety rating goes up. Ratings combine safety (attacks defended) and utility (normal tasks completed), so a robot that refuses everything scores zero. Every action that moves money needs an ML-DSA-87 post-quantum signature verified on-chain: bounty claims, owner withdrawals and admin changes. A leaked or quantum-broken ECDSA key alone cannot drain the vault.
How it's made
Contracts (Solidity 0.8.28 + Foundry, live on qorechain-diana) - RobotRegistryV3: robots, attack sessions, breaches in the order they were recorded, safety and utility scores. EscrowVaultV2: bounties in native QOR. - PQAccess and MLDSA87 call the pqcVerify (0x0A01) and pqcKeyStatus (0x0A02) precompiles directly. - Every action that matters needs an ML-DSA-87 signature verified on chain: registering a robot, starting a session, the referee's verdict, withdrawing a bounty, admin changes. msg.sender is never used for authorisation, so a stolen ECDSA key gets nothing. Signed messages carry chain id, nonce and deadline. - Both contracts check a real ML-DSA-87 signature from the deployer in the constructor, so a key-format mismatch fails the deploy instead of locking funds later. - Fair payouts: a bounty always pays the earliest eligible breach, whoever calls claim. Breaches expire after 1 day. Withdrawals take two steps with a 3-hour delay and wait for any pending win. The admin can pause (7 days at most) but can never move funds. Backend (Node + TypeScript + Fastify) - Robot brain: an LLM (OpenRouter free models, with Groq and other fallbacks) or a rule brain turns a player's prompt into a motion plan. - Referee: a deterministic simulator checks the path against red-zone polygons and signs the verdict with ML-DSA-87. Replays are stored off chain; their hash goes on chain. - Relayer: QoreX can't send transactions to contracts yet, so a relayer submits the user's QoreX-signed (ML-DSA) actions through a scoped EVM window. - Leaderboard, sign-ups and bounties are read from chain events, so the chain is the source of truth. Website (React + Vite) - QoreX wallet connect with ML-DSA signArbitrary, a 2D arena with animated replays, practice mode, a 3-step flow for robot makers, and leaderboards. Kits: @qorechain/sdk and @qorechain/evm 0.14.0; create-qorechain-dapp (foundry template) for the scaffold and the EVM window helper. Testing and audits (all in the repo under audits/) - 167 Foundry tests, including fuzz tests and invariant tests (100,000 random calls, 0 violations); 99.7% line coverage of the v3 contracts; Slither: no High or Medium. - QCAI two-stage audit: Stage 2 rated QUANTUM-SAFE; every finding fixed or answered, with a test. - Exploit-driven adversarial audit: 1 Medium and 2 Lows proven and fixed before the final deploy. - Q-Day Drill rehearsal: 22 of 22 attacks with the leaked ECDSA key were blocked. What was hard - Making payouts fair: an early design let the caller choose which breach got paid; now the earliest eligible breach always wins. - QoreX can't call contracts yet, hence the relayer and scoped EVM window. - The PQC precompiles don't exist in local simulation, so deploys go straight to testnet and verify a live signature on the way.
Timeline
Pushed 7 commits to main
- 092ab34 Local Ollama fallback brain and model benchmark · ponram06
- 5ab05be Backend docs, env example and project tracker · ponram06
- 6089dac Referee API: attempts, utility, practice, replays · ponram06
- ebeb349 Referee ML-DSA-87 signer and chain reads, with live parity test · ponram06
- 257f7d6 Robot brains: rule brain, OpenAI-compatible LLM brain, brain registry · ponram06
and 2 more commits
Comments and questions
- No comments yet.