Get started
Three short paths: look at a 402, pay the demo as a buyer, or call the facilitator as a seller. Base URL for this deployment is .
1. See a 402
The demo resource is unpaid until you attach a signature. This request must return HTTP 402 and a PAYMENT-REQUIRED header.
curl -i {{BASE}}/demoThe JSON body is the same object as the header (decoded). accepts lists GNK and USDC. Pick one when you pay.
The 402 body will appear here.
2. Pay the demo
You need Go and a Gonka private key whose address already holds GNK or bridged USDC. gonkalabs Git is temporarily unavailable — fetch the source from this website. The key stays on your machine.
curl -fsSL {{BASE}}/releases/x402-gonka-source.tar.gz | tar -xz
cd x402-gonka
go run ./cmd/x402-gonka pay --key "$GONKA_PRIVATE_KEY" --url {{BASE}}/demo
go run ./cmd/x402-gonka pay --key "$GONKA_PRIVATE_KEY" --url {{BASE}}/demo --asset usdcThe archive is on Source. Flags are on CLI. What the signer builds is on Agents & buyers.
Live settlement
These are the commands used to pay /demo with GNK. The hex key stayed in $GONKA_PRIVATE_KEY on the signer and was never sent to this host.
curl -i {{BASE}}/demo
curl -fsSL {{BASE}}/releases/x402-gonka-source.tar.gz | tar -xz
cd x402-gonka
go run ./cmd/x402-gonka pay --key "$GONKA_PRIVATE_KEY" --url {{BASE}}/demoThe unpaid curl returned HTTP 402. pay signed locally, retried with PAYMENT-SIGNATURE, and printed:
status=200
{
"ok": true,
"product": "x402-gonka",
"message": "Payment settled on Gonka.",
"payer": "gonka150c4lsmsdr23vly466lskajkfhqh7eghmyjern",
"network": "cosmos:gonka-mainnet",
"transaction": "23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2",
"explorer": "https://gonka.gg/tx/23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2"
}Then we checked the payer balance and the tx on rpc.gonka.gg:
curl -sS https://rpc.gonka.gg/chain-api/cosmos/bank/v1beta1/balances/gonka150c4lsmsdr23vly466lskajkfhqh7eghmyjern curl -sS https://rpc.gonka.gg/chain-api/cosmos/tx/v1beta1/txs/23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2
| Payer | gonka150c4lsmsdr23vly466lskajkfhqh7eghmyjern |
|---|---|
| Paid | 1000 ngonka (0.000001 GNK) |
| Balance | 5.000000000 → 4.999999000 GNK |
| Height | 5745133 · code 0 |
| Transaction | 23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2 |
Open that hash on gonka.gg. USDC was not used in this run.
3. Call the facilitator
Sellers do not talk to the chain themselves. Discover kinds, then POST /settle after the client retries with PAYMENT-SIGNATURE.
curl -sS {{BASE}}/supported
curl -sS {{BASE}}/discovery/resourcesHow to emit 402 from your own API is in Sellers. Registered paid URLs are on Resource listing. Request and response bodies are in HTTP API.
Prerequisites
| Go | A local Go toolchain to go run the source from this host. See Source. |
|---|---|
| Wallet | A gonka1… address. GG Wallet, Keplr, or a hex key from x402-gonka keygen. |
| Funds | Enough GNK or bridged USDC to cover the advertised amount. Demo prices are tiny (see accepts). |
| RPC | The facilitator uses rpc.gonka.gg. Buyers can use the same URL. No API key required. |
| Account | The paying address must already exist on-chain (it has received a transfer at least once) so sequence and account number can be queried. |