x402 on Gonka
checking…

Git: gonkalabs Git is temporarily unavailable. Download the source from this website — Source.

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}}/demo

The 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 usdc

The 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}}/demo

The 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
Payergonka150c4lsmsdr23vly466lskajkfhqh7eghmyjern
Paid1000 ngonka (0.000001 GNK)
Balance5.000000000 → 4.999999000 GNK
Height5745133 · code 0
Transaction23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2

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/resources

How 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

GoA local Go toolchain to go run the source from this host. See Source.
WalletA gonka1… address. GG Wallet, Keplr, or a hex key from x402-gonka keygen.
FundsEnough GNK or bridged USDC to cover the advertised amount. Demo prices are tiny (see accepts).
RPCThe facilitator uses rpc.gonka.gg. Buyers can use the same URL. No API key required.
AccountThe paying address must already exist on-chain (it has received a transfer at least once) so sequence and account number can be queried.