x402 on Gonka
checking…

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

CLI

The x402-gonka binary is the facilitator and a local payer. Signing happens on the machine that runs pay.

Install

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

curl -fsSL {{BASE}}/releases/x402-gonka-source.tar.gz | tar -xz
cd x402-gonka
go run ./cmd/x402-gonka

pay

GET the URL, expect 402, sign a matching Gonka tx, retry with PAYMENT-SIGNATURE.

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
--keyHex secp256k1 private key. Required. Never uploaded.
--urlPaid resource URL. Required.
--assetgnk (default) or usdc. Selects among accepts.

pay uses GONKA_RPC_URL (default https://rpc.gonka.gg) only to read account number and sequence. Settlement is done by the resource server through this facilitator.

keygen

Prints a new gonka1… address and hex key. Fund it before paying. The address is not registered until it receives a transfer.

go run ./cmd/x402-gonka keygen

serve

Runs the facilitator, docs, and /demo. Requires PAY_TO to be a valid merchant address.

curl -fsSL {{BASE}}/releases/x402-gonka-source.tar.gz | tar -xz
cd x402-gonka
cp .env.example .env
# set PAY_TO
go run ./cmd/x402-gonka serve

Environment

PORTListen port. Default 4020.
PUBLIC_BASE_URLAbsolute origin used in demo resource.url and discovery.
GONKA_RPC_URLDefault https://rpc.gonka.gg.
GONKA_CHAIN_IDDefault gonka-mainnet.
PAY_TOMerchant address that receives demo (and default) payments.
DEMO_AMOUNT_GNKAtomic ngonka for /demo.
DEMO_AMOUNT_USDCAtomic USDC for /demo.
USDC_CONTRACTCW-20 address. See Network & assets.