About
Opsonin is an immune system for robot fleets, on QoreChain. A worm spreads through a simulated warehouse fleet; a rules-based sentinel agent watches telemetry and quarantines infected robots with real, rate-capped transactions to an on-chain FleetRegistry.
The key idea is asymmetry: quarantine is restrict-only, so a classical key can only stop robots. Releasing them needs the fleet owner's ML-DSA-87 signature, checked on chain by the pqcVerify precompile. A thief with the owner's classical key is refused (BadPqSignature), which you can try yourself in the demo.
Live demo: https://opsonin.up.railway.app
Video: https://youtu.be/5H4SB-RCBis
Robots are simulated and the worm is a probabilistic model with no exploit code. Testnet only (qorechain-diana).
How it's made
Architecture
- Browser: React & React Three Fiber, with the fleet/worm simulation in a Web Worker. Three labelled modes: Live chain, Offline Replay (recorded real txs), and Simulation (no txs, with an unprotected fleet on the same seed for comparison).
- Railway: a sentinel service (rules engine R1–R7 with decay and hysteresis, authority budget, batched quarantine txs) and a separate owner release service (ML-DSA-87 signing), so a sentinel compromise can't reach the owner key.
- Chain: FleetRegistry.sol (restrict-only, rate-capped quarantine of 20 robots per 60 blocks; release, sentinel rotation and cap changes all gated by ML-DSA-87) plus QorePQC.sol wrapping the pqcVerify (0x0a01) and pqcKeyStatus precompiles. 300 robots enrolled at 0x5a69a9e6e5577ee42dd74d9f8a00714319d11f78.
- Packages: @opsonin/envelope (ML-DSA-87 signed robot command envelopes: canonical JSON, scope, expiry, single-use nonce, fail closed, stop always honoured), @opsonin/sim, @opsonin/sentinel.
Kits: QoreChain SDK (@qorechain/sdk, @qorechain/evm) and qorechain-pqc (@qorechain/pqc), with viem and cosmjs.
Network features
- Hybrid secp256k1 + ML-DSA-87 transactions (MsgOpenEVMWindow), shown as "quantum-safe, verified on-chain" in the explorer.
- PQC key registration with proof of possession for the owner and the sentinel.
- Scoped EVM window as the agent's leash: FleetRegistry is the only allowed target, capped at 120 txs, 12 QOR and about 5 h, and shown live in the HUD.
- Smart-account spending rules: an agent key that can only call FleetRegistry.quarantine, with one allowed call and two refusals on chain.
- pqcVerify + pqcKeyStatus in Solidity. Release only accepts a key that is registered and has proven possession, and the signed message binds chain id, contract, nonce, ids and a deadline.
Testing: 85 tests (40 Foundry, including a fuzzed restrict-only invariant, replay, cross-chain and dead-precompile cases, plus 45 vitest). Two-stage QCAI audit (85/100), with every finding answered in docs/AUDIT.md.
What was hard
- eth_call with a stateOverride sees the PQC precompiles as inactive, so precompile paths have to be tested without overrides. Dead precompiles had to fail closed.
- A new account's first tx must be the PQ key registration, and a second registration is refused after the fee is charged, so account setup had to be scripted exactly.
- Verifying a 4,627-byte ML-DSA-87 signature in-contract from calldata, and binding the release so no one can replay it, without letting an intervening quarantine invalidate a pending release.
- EVM windows expire, so the services re-open them before they run low and tell a target refusal apart from real exhaustion.
- Keeping the chain out of the control loop: robots act on a cached quarantine set, and the live world re-syncs from fleetState every 8 s.