Skip to Content
px402Devnet
Getting started

Run your own agent

Create a key on your machine, fund it with devnet money, and pay for a call.

The key never leaves your machine and there is no px402 login. You need your own Helius API key. Install the packages first.

Configure

export PX402_NETWORK=devnet PX402_HELIUS_RPC_URL="https://devnet.helius-rpc.com/?api-key=<your key>"
export PX402_MAX_PRICE_BASE=20000 PX402_ALLOWED_ORIGINS=https://devnet.x402.px402.tech

PX402_MAX_PRICE_BASE is in base units: USDC has 6 decimals, so 20000 is 0.02 USDC. With no allowed origin set, every payment is refused.

Create the agent

px402 init

It asks for a passphrase (12 characters or more) and prints the agent’s address and shielded address.

Fund it

Send the address some devnet SOL for network fees (faucet.solana.com) and devnet USDC (faucet.circle.com). Then move the USDC into the private balance:

px402 deposit 1
Public
A deposit is visible on chain, and it links the funding wallet to the agent.

Set caps

px402 caps set --per-request 0.02 --daily 1 --total 5

With no caps, pay refuses to pay.

Pay

px402 pay https://devnet.x402.px402.tech/paid/demo

A successful call prints status 200, the latency, a trace id, the transaction signature and the response body. The demo route costs 0.01 devnet USDC.

Calls in parallel

Each transfer spends one whole private output. To pay several calls at once, split the balance first:

px402 split 4

Look before paying

The price is public. You can read a challenge without installing or paying anything:

curl -si https://devnet.x402.px402.tech/paid/demo | grep -i '^payment-required' | cut -d' ' -f2 | tr -d '\r' | base64 -d

Next: what happens during that call, or pay from TypeScript.