
Protocol Builders
Turnstile
A post-quantum rollup for pay-per-call APIs: Every call paid, every batch signed, every answer sealed.
About
AI agents can't pay for an API one call at a time. Turnstile fixes that. A seller puts a price on any route. When an agent calls it, the API answers with a price the seller signed. The agent pays with a post quantum signature from its own account inside our rollup, and gets an answer that only it can open. Thousands of tiny payments settle in a few batches on QoreChain, each anchored with an ML-DSA-87 signature. A watchtower replays every batch and challenges any wrong one. Sellers withdraw with a Merkle proof, and anyone can check a receipt on chain or inside a Solidity contract. We also added spending limits for agents that live on chain, a zero knowledge proof of the facilitator fee, a hosted MCP server that charges per tool call and exit files that only their owner can open. Every claim on the Proof page links to its transaction, and the limits are written down too.
How it's made
Turnstile is a TypeScript monorepo. The settlement layer is our own RDK rollup on QoreChain testnet, qledger v1 with based sequencing and optimistic challenges. A buyer signs each payment with ML-DSA-44 inside the rollup. The operator posts batches of up to 64 transactions, each anchored with ML-DSA-87. On the seller side a middleware answers HTTP 402 with a quote signed through QoreSign. The facilitator checks the payment, posts it to the rollup inbox and pays the gas. Answers are sealed with QoreSeal to the ML-KEM-1024 key the buyer registered on chain. For many cheap calls a session replaces one post per call. The buyer funds a session account and signs a running total, so fifty calls settle in a single post. On the EVM we deployed three Solidity contracts with Foundry. TurnstileReceipts rebuilds the anchor message and checks it with the pqcVerify precompile. AgentSpendCap holds an agent's spending limits and only accepts an owner with a registered post quantum key. FeeAudit verifies a Groth16 proof made with Circom and snarkjs, using the pairing precompile. A separate watchtower with its own key replays every batch from the raw inbox. We forged batches on purpose three times. We lost two races by one block, found a two second database wait in our own code, fixed it and won the third. The hardest part was the chain's own rules: hybrid signatures on every transaction, one post per transaction and a rate limited REST endpoint. The repo also has Sign In With QoreChain, an IBC exit to Osmosis, a QoreScan inventory and two MCP servers. Contracts: TurnstileReceipts 0x970B29eB9C454a836Fe6dCB3e7A616673A66B2e0, AgentSpendCap 0x16c2cb5600d37195C88fde5327771652b1d02dFd, FeeAudit 0xAE05f8faDD76F827B3e80A3382a54cF31A4549A5. Built with an AI coding agent, documented in AI_USAGE.md.
Timeline
Newly verified on chain: EVM window (incl. scoped)
Pushed 5 commits to main
- b7ae39e Watchtower: fixed challenge fee; operator: per-run drill guard (DRILL_RUN) · Abhishek222983101
- a3457ba Watchtower prefetch: incremental per-entry reads instead of full index search (fixes REST 429 load) · Abhishek222983101
- 0b43fe5 operator drill: log guard name and reasons · Abhishek222983101
- ea6fb91 Watchtower: start the challenge before any database write (drill 2 showed ~2 s lost there) · Abhishek222983101
- 10cef2b Record drill 2 honestly (lost by one block), docs updated · Abhishek222983101
Newly verified on chain: QoreScan
Newly verified on chain: IBC via QORel
Comments and questions
- No comments yet.