Read the challenge#
Shell
onchainos payment quote "https://api.roundlot.0xo.in/v1/quote?symbol=NVDA&side=buy&size=250"
The CLI decodes the 402 and summarizes it as Will pay 0.01 USD₮0 (exact, X Layer Testnet). For MCP, name the tool:
Shell
onchainos payment quote https://api.roundlot.0xo.in/mcp --tool quote --param symbol=NVDA --param side=buy --param size=250
Sign#
onchainos payment pay --payment-id <id from quote> --selected-index 0 --yes
The CLI signs in OKX's TEE, repeats the request with PAYMENT-SIGNATURE and prints the receipt.
Local keys.
pay-local signs with a plain private key on your machine. Use a testnet-only key.
Decode the receipt#
Shell
onchainos payment decode-receipt --header "<PAYMENT-RESPONSE value>"
It prints status, transaction, payer and chainId.
One command#
The repository wraps all of this, using a funded testnet key:
Shell
DEMO_BUYER_PRIVATE_KEY=0x... npm run demo:okx -w service