The Gateway lab
The gateway's pipeline, driven from this tab against a simulated chain. Real envelopes, headers and verdicts; transactions wait for a block. No key, no RPC, nothing to fund.
- Tests on the bench
- 28
- Protocols driven
- 6
- Typed error codes
- 18
- Merchant keys held
- 0
Unbadged tests run in this tab with no chain access. RPC reads the simulated chain. TX broadcasts a transaction and waits for it to be mined: the chain is fake, the block time is not. Tick fail on any test to run its failure instead.
Each one drives the gateway's pipeline against a chain simulated in this tab. Real envelopes, headers and error codes; transactions wait for a block. Tick fail on a test to see how it breaks. Switch to json for the raw object at any time.
What is real here, and what is not
Everything a buyer or an operator would see comes from the gateway's frozen contract. Everything that would cost money or touch someone else's system is simulated, and says so.
Real, from v2.1.0
- The pipelineResolve, challenge, verify, reserve, call the backend, settle, record: in the order the gateway runs it, and in the upfront order when you pick it.
- The wirePAYMENT-REQUIRED, PAYMENT-SIGNATURE, PAYMENT-RESPONSE, WWW-Authenticate: Payment, the MCP _meta carriers and the A2A x402 metadata, shaped as the gateway sends them.
- The verdictsSignature recovery against the EIP-712 domain, recipient, amount, validity window, balance and nonce. Tamper with a proof and it fails where it would fail.
- The bookkeepingOne replayKey per authorization, reserved before settlement. Canonical events and receipts under one requestId, and the eighteen typed error codes.
Simulated in this tab
- The chainBlocks, balances and EIP-3009 nonces live in this tab. Block time and confirmations follow the network you pick, so a settlement takes as long as it would.
- The signaturesRandom bytes recorded at signing time, so recovery returns the signer for the signed message and a stranger for anything else.
- The neighboursThe facilitator, the merchant API and the RPC answer locally, with their usual latency.
- Base Sepolia and BaseParameters and labels only. Nothing is sent to either network, and no hash on this page exists on an explorer.
Run the real thing in five minutes.
The same flow on Anvil with MockUSDC: a deterministic stack you start with Docker, where the transfer is a real transaction and the balances are read back from the chain. No API keys, no real money.
$ git clone https://github.com/devlab-group/agent-commerce && cd agent-commerce $ npm install && npm run agent-commerce -- demo [agent] Agent Commerce Gateway: deterministic buyer demo [buyer] balance before 100 MockUSDC [gateway] connected to http://localhost:8080/mcp [agent] discovered 2 tool(s): weather_basic, market_report [gateway] 402 payment required: 0.01 USDC to 0x7099…79C8 [buyer] challenge checked before signing: pays 10000 units of 0x5fbd…0aa3 to 0x7099…79C8 [buyer] signed x402 payment proof (LOCAL DEVELOPMENT ONLY - DO NOT FUND) [gateway] delivered "market_report" [receipt] status=settled settlementTx=0x0b19…1c7f [buyer] balance after 99.99 MockUSDC (Δ -0.01) [agent] demo complete: free and paid delivery both verified