msg.sender, and earns feeBps of the amount. By the end you will have a relayer serving POST /broker and GET /info with nothing but a gas key. There is no allowlist and no approval: relaying is permissionless because it is incentivized.
Run one in one command
The same binary the hosted service runs, with zero privileged config:GET /info, and submits. You can stand up a competing relayer in under a minute.
Why you cannot cheat the consumer, and why that is the point
The consumer signs the EIP-3009 authorization overnonce = keccak256(abi.encode(order)). If you change any order field (adapter, params, amount, payee, feeBps), the recomputed orderHash no longer equals the signed nonce, USDC rejects it, and the whole transaction reverts. You can only relay the order verbatim or reject it. This is cryptographic least-privilege, not a policy anyone maintains. See the binding.
Your only economic lever is your local feeFloorBps: you may decline an order below your floor, but you cannot raise the fee, because that would change the orderHash and break the consumer’s signature. GET /info publishes that floor, your supported chain ids, and your gas address, so a consumer can shop on it.
The POST /broker pipeline
Every request runs the same pipeline. Each failure maps to a typed code, and error bodies carry only{ ok: false, code, message }, never the order, the signature, or any key.
- Validate the body. A malformed order is rejected
MALFORMED_ORDER(400). - Recompute
orderHashfrom the order itself. Never trust a client-supplied hash; a mismatch isORDERHASH_MISMATCH(400). - Enforce your local
feeBpsfloor. Below it isFEE_BELOW_FLOOR(402). - Check the signed auth window. Expired is
AUTH_EXPIRED(422). - Pre-simulate with
eth_call. A would-revert order (sold out, tampered,feeBpsover 10000) isWOULD_REVERT(422), rejected without spending gas. - Broadcast from your gas key, wait for the receipt, and decode
Brokered. - Return a
RelaySuccess:{ txHash, orderHash, brokered, receipt, feeCollected }.
method path -> status [code] and nothing else. The full request and response shapes are in the API reference; the codes are in the errors reference.
The economics, honestly
- Revenue:
feeBpsof every order you successfully relay. Whoever transmits first earns the fee. It is an open market, not a yield. - Cost: gas. A reverted broadcast costs you gas for nothing, which is why the pipeline pre-simulates every order and rejects the doomed ones before broadcasting. Set
feeFloorBpsso the fee covers gas plus margin on your chain. - Graceful degradation: when the relayer key’s native balance drops below
RELAYER_GAS_FLOOR_WEI,POST /brokerpauses with503 INSUFFICIENT_RELAYER_GAS, so abuse degrades to “out of gas, try another relayer or run your own” instead of broadcasting doomed transactions.
The hardened public edge (opt-in)
A bare relayer is right for local and in-process use. A public deployment opts into the hardened edge by settingRELAYER_HARDENED=1 (or any RELAYER_RATE_* / RELAYER_GAS_FLOOR_WEI / RELAYER_CORS_ORIGINS var). The edge wraps the unmodified settlement pipeline with:
- a per-IP rate limit (token bucket), returning
429withRetry-After; - a global concurrency cap, returning
429 SERVER_BUSYrather than an unbounded queue; - the relayer-gas circuit breaker described above;
- CORS, where
GET /infois readable from any origin andPOST /brokeris callable from the configured origins and from server-side agents.
The edge rejections (
RATE_LIMITED, SERVER_BUSY) use a separate edge error code union, so the audited settlement RelayErrorCode taxonomy stays clean. The low-gas pause reuses the settlement INSUFFICIENT_RELAYER_GAS code, so a consumer’s error handling stays uniform. Public hosting (TLS, a URL) is an ops task, not part of the package.Verify
GET /info returns your policy. Have a consumer submit an order with feeBps at or above your floor (see the agent-builder lane). It settles through you, the Brokered event records your gas address as the relayer, and feeCollected is paid to that address in the same transaction.
Related
- The binding: why a relayer is bounded to relay-or-reject.
- How a brokerage settles: the one-transaction flow you transmit.
- The API reference and errors reference: the
POST /brokerandGET /infoschemas and the full code catalog. - Buy a capability or sell one from the other side of the market.

