Small self-hosted x402 v2 facilitator (exact, EIP-3009) for GOAT Network Testnet3 + PayGuard Test USD token; settles PayGuard's /goat-testnet3 route
A small, self-hosted x402 v2 facilitator for GOAT Network Testnet3 (eip155:48816), plus the EIP-3009 test token it settles. It powers PayGuard's test route https://api.youraitools.co/payguard/goat-testnet3/v1/address. Testnet only, no real money.
exact (EVM, EIP-3009 transferWithAuthorization), built on the official @x402/core x402Facilitator and @x402/evm ExactEvmScheme0x7730c7b13e10440dda3A2700845e7cE4dF901df4 (pays testnet BTC gas, so payers need no gas)| Chain | GOAT Testnet3, chain id 48816 (0xBEB0), CAIP-2 eip155:48816 |
| RPC | https://rpc.testnet3.goat.network |
| Explorer | https://explorer.testnet3.goat.network |
| Gas faucet | https://bridge.testnet3.goat.network/faucet (tBTC) |
| Method | Path | Body / result |
|---|---|---|
| GET | / |
info: tokens, policy, signer |
| GET | /supported |
{ kinds: [{ x402Version: 2, scheme: "exact", network: "eip155:48816" }], signers } |
| POST | /verify |
{ x402Version, paymentPayload, paymentRequirements } → VerifyResponse |
| POST | /settle |
same body → SettleResponse (transaction = GOAT Testnet3 tx hash) |
Policy: it only settles on eip155:48816, only the two tokens below, only to allowlisted receivers (PAY_TO_ALLOWLIST, PayGuard's receiver 0x35A4577c2Bd3c6dC283285c879C3E5cfD252C6a1), and only up to 1 token per payment. That stops anyone else from draining its testnet gas.
| Token | Address | EIP-712 domain | How to get it |
|---|---|---|---|
| tUSDC "PayGuard Test USD" (6 dec) | 0x4aa7292d13801011C3A638CA2C16fFa85a06Bc43 |
name PayGuard Test USD, version 1 |
faucet() or faucetTo(address): 10 tUSDC per address per 24 h, open to anyone |
| GOAT x402 test USDC (6 dec) | 0x29D1Ee93e9ecf6E50F309f498e40a6b42D352Fa1 |
name USD Coin, version 1 |
owner-mint only (ask the GoatX402 team) |
contracts/PayGuardTestUSD.sol is a minimal ERC-20 with EIP-3009 (transferWithAuthorization in both v/r/s and bytes-signature forms, receiveWithAuthorization, authorizationState) and a Circle-style EIP-712 domain. It's compiled with solc 0.8.24 (optimizer 200, evm paris) and was deployed in tx 0x16bbfe56…28c6.
Oct 22 2026, 12:26 UTC (SELF test): a paid PayGuard call returned HTTP 200, settled in tx 0xcbb856ffcb47419c7f7d977f84f5b37b49d5d87ea5cdea0b16416990cbd87cbb (block 17677590, 0.001 tUSDC, 82,668 gas paid by the facilitator).
npm install
node scripts/compile.mjs # needs soljson 0.8.24 (SOLJSON=path; binaries.soliditylang.org)
FACILITATOR_FILE=./facilitator.txt PAYER_ADDRESS=0x... node scripts/deploy-token.mjs # file: private_key=0x...
npx wrangler secret put FACILITATOR_PRIVATE_KEY
npx wrangler deploy
A resource server that runs on Cloudflare too should call it through a service binding ([[services]] binding = "GOAT_FACILITATOR"), because one Worker can't fetch another workers.dev Worker on the same account. See PayGuard's src/goat-testnet3.js (GoatFacilitatorClient).
MIT licensed.
agentgate-source: code mirror on Cloudflare Pages. All repos