Skip to content
QORECHAIN
Register

Post-Quantum AI Agents

QoreGuard

An AI agent that pays bills under on-chain limits nobody can raise without the owner's ML-DSA-87 key.

Share on X

About

QoreGuard — github.com/dorithesky/qoreguard (build.qorechain.io/ko/p/qoreguard), not qoreguard-2/-3/-quantum-pass. An AI agent that pays bills needs a wallet, and a wallet needs limits that survive the agent: a stolen key, a prompt-injected invoice, a bug in the planner. QoreGuard puts those limits where the agent cannot reach them. Gate 1 — the account's own rules. The agent is a linked ed25519 key on the owner's QoreChain account (MsgRegisterAuthenticator) with send and evm permissions only, a spending rule of 0.6 QOR per call and 1.5 QOR per day in uqor and fUSD, and an allowed_evm_calls list naming exactly two functions on one contract. Even with the agent's key, an attacker can pay registered vendors within one day's cap and nothing else: no transfers, no other contracts, no deployment. The owner's ML-DSA-87 key never leaves the owner's side; the agent's relayer submits and pays the fee. Gate 2 — the business policy. QoreGuardTreasury.sol holds the vendor allowlist, per-vendor per-transaction and daily caps, and a treasury-wide cap. Payments arrive as msg.value and are forwarded in the same transaction, so the chain sees the real outflow that gate 1 bounds. Every payment and its invoice commitment is an event. The post-quantum part. Adding a vendor, changing a cap, or approving one payment above a cap requires a fresh ML-DSA-87 signature from the owner over a message bound to the domain, chain, action and payload with a monotonic nonce. The contract checks the registered, proven key with pqcKeyStatus, then the signature with pqcVerify (0x…0a01). An attacker who has recovered the owner's classical ECDSA key — the Q-Day scenario this fest is named for — cannot add a payee, raise a cap, or move money: those paths need a key that quantum computers do not have. Invoices are authenticated, not trusted. Each vendor signs its invoice with an ed25519 key registered in the mandate; the agent verifies it before building anything, and the payment's on-chain memo commits to that exact signed invoice. A tampered invoice whose amount changed after signing is refused before a transaction exists. Three more rails on the same account. QoreSeal encrypts signed invoices to the owner's ML-KEM-1024 key; only the archive digest is public. QoreSign: an over-cap invoice (250,000 uqor against a 200,000 uqor cap) is approved by the owner as a Sign-In-With-QoreChain message, verified with verify_siwq(require_pq=True) against the on-chain ML-DSA-87 key, then settled through payWithApproval. fUSD: the agent pays a 500 fUSD invoice itself on the native lane under the same spending rule, which now lists the token denom, from tokens the treasury swapped in pool 2. Proof, not adjectives. 58 Foundry tests, 15 invariants over a 9-action handler, 100% of lines, statements, branches and functions, and 22/22 mutants killed (python scripts/mutate.py); a QoreScan CBOM (CycloneDX 1.6) with DORA and NIS2 mappings; a daily GitHub Actions run that re-executes forge test and python verify.py on a machine we do not control, with no secret configured. One invoice, one payment. The treasury records every invoice it settles (paidInvoices, keyed by qg-inv:v1:…), and both lanes — the agent's pay and the owner-approved payWithApproval — consult it before moving value. A retry, a second agent, a restarted app or a cross-lane duplicate produces one deposit and one InvoiceAlreadyPaid revert, checked before any cap or signature. The journal also skips settled invoices on restart; the contract is what makes that a guarantee. demo/guard.json holds six attempts on two invoices; verify.py reproduces the refusal with a live eth_call. A 500 fUSD invoice is 500 fUSD in the list, the ledger and the receipt — never a QOR number nobody paid. A judge can press it. web/lab.html runs eight refusals as eth_calls — over-cap, unknown vendor, forged ML-DSA-87 signature, memo ≠ value, stale approval nonce, a non-owner sender, a one-byte signature, an already-settled invoice — and verifies the owner's recorded hybrid signature against the on-chain key. web/qorex.html reads the account and key status and reports the wallet's refusal of signArbitrary verbatim. What the demo shows on testnet (every hash in docs/EVIDENCE.md): the ML-DSA-87 key registered with a proof of possession; two vendors added through PQ-signed calls verified by pqcVerify; seven QOR payments and two fUSD invoices settled; refusals mined as transactions (vendor caps, four InvoiceAlreadyPaid duplications, a tampered invoice stopped before the chain); one owner-approved exception settled; a PQ-signed cap change; a revocation the chain answers as linked key is unbound or revoked; and a Q-Day check where the owner's classical key submits a setTreasuryCap with a forged PQ signature — mined, reverted, policy unchanged. python verify.py re-checks 47 of these facts read-only, and docs/JUDGES.md is the five-minute tour. AI-native: built with an AI workflow (AI_USAGE.md); AI never enters the trust path.

How it's made

Built from an empty directory in three layers: the Solidity policy contract, a Python agent package on the QoreChain SDK, and the testnet run that produced docs/EVIDENCE.md. 1. Read the protocol before writing code. Precompiles pqcVerify (0x…0a01) and pqcKeyStatus (0x…0a02), the authenticator lane (MsgRegisterAuthenticator, MsgUpdateSpendingRules, MsgExecuteEVM), the spending-rule fields (allowed_evm_calls as 0x<contract>/0x<selector>), the v2 EVM auth digest and the EVM-window traps (opening advances the account sequence; max_value covers fees). That reading killed the first design, which paid vendors from a contract balance: the chain counts the account's native balance decrease, so the outflow would have read as zero. The final pay{value: ...} design exists so gate 1 sees the real amount. 2. Write the contract, then attack it. QoreGuardTreasury.sol holds the vendor allowlist, per-vendor and treasury caps, the approval path and the PQ gate. 58 Foundry tests try to break it: wrong sender, per-tx cap, per-vendor day cap, treasury cap, inactive vendor, value mismatch, unregistered/unproven/mismatched key, bad signature, nonce replay, an approval for one amount used on another, and a precompile that answers with empty data. 3. Close the encode/decode gap. Off-chain encoders are where these projects silently break, so reference hashes generated by the Python encoder are asserted in Solidity (contracts/test/Encoding.t.sol); if either side drifts, forge test fails before a transaction is signed. 4. Run it on testnet and write down what the chain said. Throwaway keys, ML-DSA-87 key + proof of possession in a classical bootstrap transaction, a one-transaction deployment window, then a target-scoped admin window; two vendors added through PQ-signed calls the contract verified with pqcVerify; the agent linked with send+evm, 0.6 QOR per call, 1.5 QOR per day and two allowed selectors; payments, refusals, one owner-approved exception, one PQ-signed cap change and a revocation. Every refusal is recorded as a first-class result in demo/journal.jsonl and docs/EVIDENCE.md. 5. Write the submission from the artifact. README, threat model, rubric map and submission text were generated from the code and the run, not the other way round. What was hard: the owner has to be an eth_secp256k1 (unified) account, because the EVM lane attributes a transaction to the keccak address of the signing key while a native account's 0x form only reads the balance — the fix was a rebuilt account layer, not a rename. BROADCAST_MODE_BLOCK is not served by the public REST endpoint, so relayed payments are broadcast in sync mode and the execution result is read back. Solidity rejects checksummed precompile literals. A 4.6 KB ML-DSA-87 signature needs gas provisioned above the signed gas_limit, and the two retries are kept in the journal as operational retries, not refusals. Kits and features: QoreChain SDK (Python) for accounts, hybrid signing, the authenticator messages and EVM calls; Foundry for the contract and tests. Network features used: hybrid ML-DSA-87 transactions, PQC key registration with proof of possession, scoped EVM windows, Solidity pqcVerify and pqcKeyStatus, smart accounts with spending rules. The whole build was an AI coding agent working from the QoreChain documentation with a human in the owner role who chose the business numbers and holds the owner key; AI_USAGE.md lists what the AI got wrong and how the tests or the chain caught it. The second pass added three kits that the first did not use: qorechain-qoreseal (ML-KEM-1024 archive, agent/qoreguard/sealing.py), qorechain-qoresign (SIWQ approvals verified against the on-chain key, agent/qoreguard/approvals.py) and qorechain-mcp (the read layer, agent/qoreguard/mcpread.py). It also added three network features — the KEM key registry, one native AMM swap in pool 2 and a test-token (fUSD) payment through MsgExecuteCosmos — and verify.py, a read-only script that re-checks 23 of these facts from a clean machine with no keys, including reproducing the refusals with eth_call. The 2026-11-27 pass raised that to 47 checks and added a QoreScan CBOM with DORA and NIS2 reports, 15 invariants with 100% line, statement, branch and function coverage and 22/22 mutants, the keyless attack lab and the QoreX console, and a daily GitHub Actions run that repeats forge test and verify.py with no secret configured.

Timeline

QoreGuardPost-Quantum AI Agents

Pushed 2 commits to main

  • 37a40dc README: the name note counts three other QoreGuard entries, not two · dorithesky
  • 4ca9c7b README: the name note moves to the top, naming the repo and the /ko page · dorithesky
QoreGuardPost-Quantum AI Agents

Pushed 5 commits to main

  • c52e294 video script: the proof slide takes the check count from one constant · dorithesky
  • ac6aa94 dashboard: the approval-nonce card reads the chain's counter, not the last event's nonce · dorithesky
  • 1af1aca lab page: the footer says the current 47 read-only checks · dorithesky
  • 99c2627 dashboard: receipts are shown in the invoice's own unit (0.150 QOR, not 150000 QOR), and the page is re-read from the chain · dorithesky
  • 2855e08 docs: the read-only check count is 47, not 45 · dorithesky
QoreGuardPost-Quantum AI Agents

Pushed 3 commits to main

  • f08ae07 CI: a node job that runs the three browser-surface suites (42 checks) · dorithesky
  • 619efc1 Submission copy: 47 read-only checks, and the Q-Day attempt by name and block · dorithesky
  • d81dc65 Q-Day as a mined transaction, the owner's wallet console, and two more verified kits · dorithesky
QoreGuardPost-Quantum AI Agents

Pushed 1 commit to main

  • 782d4c7 Invoice guard, correct currency everywhere: one invoice pays once, on chain · dorithesky
QoreGuardPost-Quantum AI Agents

Pushed 16 commits to main

  • a82f6ea Submission copy and AI_USAGE: the accurate long description, and what the QoreX kit told us about signArbitrary · dorithesky
  • e3229ad QoreX console: detect the wallet with @qorechain/qorex-types, read the account, and report the wallet's refusal of signArbitrary verbatim · dorithesky
  • 4ca855f verify: resolve sealed envelopes by name, so the daily run works on any machine · dorithesky
  • 059eee1 CI: make the workflow valid YAML and run it daily · dorithesky
  • d05c585 Rename daily-verify.yml to .github/workflows/daily-verify.yml · dorithesky

and 11 more commits

QoreGuardPost-Quantum AI Agents

Newly verified on chain: QoreScan

QoreGuardPost-Quantum AI Agents

Newly verified on chain: AMM pools, MCP server or qore CLI, QoreSeal and the encryption key registry, Test tokens fUSD, fETH, fBTC

QoreGuardPost-Quantum AI Agents

Earned a Ship Weeks badge.

QoreGuardPost-Quantum AI Agents

Earned a Ship Weeks badge.

QoreGuardPost-Quantum AI Agents

Earned a Ship Weeks badge.

QoreGuardPost-Quantum AI Agents

Earned a Ship Weeks badge.

QoreGuardPost-Quantum AI Agents

Pushed 5 commits to main

  • 282a622 Add requirements.txt for QoreChain SDK dependency verification · dorithesky
  • 35519cc docs: map the project to the jury rubric, page by page · dorithesky
  • b046756 dashboard: label the PQ-approved payment path correctly; video reads the recorded window · dorithesky
  • f7a0d9f Testnet run: deploy, PQ-signed policy, agent payments, refusals, revocation · dorithesky
  • 04a35e1 QoreGuard: post-quantum treasury agent with chain-enforced limits · dorithesky
QoreGuardPost-Quantum AI Agents

New project.

Comments and questions

  • No comments yet.