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-gonkapay
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--key | Hex secp256k1 private key. Required. Never uploaded. |
|---|---|
--url | Paid resource URL. Required. |
--asset | gnk (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.
That command already settled on-chain. The key stayed in $GONKA_PRIVATE_KEY. Check and explorer:
curl -sS https://rpc.gonka.gg/chain-api/cosmos/tx/v1beta1/txs/23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2
Tx 23B76D1281F9EFCC7AFC90659480CF3219A7099959C0513720769F700E9B73B2 on gonka.gg. Full output is on Get started.
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 serveEnvironment
PORT | Listen port. Default 4020. |
|---|---|
PUBLIC_BASE_URL | Absolute origin used in demo resource.url and discovery. |
GONKA_RPC_URL | Default https://rpc.gonka.gg. |
GONKA_CHAIN_ID | Default gonka-mainnet. |
PAY_TO | Merchant address that receives demo (and default) payments. |
DEMO_AMOUNT_GNK | Atomic ngonka for /demo. |
DEMO_AMOUNT_USDC | Atomic USDC for /demo. |
USDC_CONTRACT | CW-20 address. See Network & assets. |