x402 on Gonka
checking…

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

Protocol

This facilitator speaks x402 version 2 over HTTP. The chain binding is Cosmos exact with a client-signed TxRaw.

Network binding

x402 version2
Schemeexact
Networkcosmos:gonka-mainnet (CAIP-2)
Transfer methodsigned-tx — client signs, facilitator broadcasts
Payment flowupfront — settle, then serve. /verify is not required for that ordering.

The generic protocol is documented at docs.x402.org and in the v2 specification. This page is the Gonka binding.

Headers

PAYMENT-REQUIREDServer → client. Base64 JSON PaymentRequired. Sent on 402.
PAYMENT-SIGNATUREClient → server. Base64 JSON PaymentPayload.
PAYMENT-RESPONSEServer → client. Base64 JSON settle result. Sent after an attempt, success or fail.

Encoding is standard base64 of UTF-8 JSON, not base64url. CORS exposes the payment headers so browsers can read them.

PaymentRequired

{
  "x402Version": 2,
  "error": "PAYMENT-SIGNATURE header is required",
  "resource": {
    "url": "https://example/demo",
    "description": "…",
    "mimeType": "application/json",
    "serviceName": "x402-gonka",
    "tags": ["gonka", "x402", "usdc"]
  },
  "accepts": [ { "scheme": "exact", "network": "cosmos:gonka-mainnet", "amount": "1000", "asset": "ngonka", "payTo": "gonka1…", "maxTimeoutSeconds": 60, "extra": {} } ],
  "extensions": {}
}

accepts[].extra on this network includes name, decimals, assetTransferMethod, and paymentFlow.

Payment payload

The object inside PAYMENT-SIGNATURE:

x402Version2
acceptedThe PaymentRequirements you fulfilled.
payload.signedTxBase64 protobuf TxRaw (body, auth info, signature).
payload.signatureBase64 of the 64-byte secp256k1 signature (same bytes as in TxRaw).
payload.authorization.fromPayer gonka1…. Must match the tx signer.
payload.authorization.toMust equal accepted.payTo.
payload.authorization.amountAtomic units. Tx amount must be ≥ this and ≥ accepted.amount.
payload.authorization.denomngonka or the USDC contract.
payload.authorization.timeoutAtUnix seconds. If set in the past, rejected.

Transaction shape

GNK

First (and only) message: /cosmos.bank.v1beta1.MsgSend with a single coin {denom: "ngonka", amount}.

USDC

First message: /cosmwasm.wasm.v1.MsgExecuteContract. contract is the USDC CW-20. msg is JSON {"transfer":{"recipient":"…","amount":"…"}}.

Auth info

One signer, /cosmos.crypto.secp256k1.PubKey, SIGN_MODE_DIRECT (mode 1), fee 0ngonka, gas limit typically 120000. SignDoc is body_bytes || auth_info_bytes || chain_id || account_number, hashed with SHA-256.

What verify checks

  1. Version, scheme, and network.
  2. signedTx decodes to a supported message.
  3. Recipient, asset, and amount match requirements.
  4. Authorization from matches the signer address.
  5. On-chain account number/sequence match the signed tx.
  6. Signature verifies against the SignDoc.
  7. On /verify only: payer balance ≥ amount.
  8. On /settle only: TxRaw has not been settled before, then broadcast and wait for a block.

Rejection codes are listed on Errors.