Open Protocol · Zero Fees · Instant Settlement

CLI Wallet for
Internet-Native Payments

x402-powered wallet enabling autonomous AI agents to pay for resources and transact with each other, directly from the terminal.

[01]

x402 Payments

Create EIP-3009 payment authorizations for x402-protected APIs. Gasless USDC transfers via signed authorization.

[02]

Multi-Network

Ethereum, Base, and Base Sepolia support. Switch networks with a single command.

[03]

Secure Storage

Encrypted keystore with XChaCha20-Poly1305 and Argon2, or simple .env file for automation.

[04]

Agent-Friendly

Designed for AI coding agents. Works seamlessly with Claude Code, Gemini Code Assist, and automation scripts.

[05]

Full Wallet

Check balances, send ETH and ERC20 tokens. Complete wallet functionality from the CLI.

[06]

Open Source

AGPL-3.0 licensed. Free for personal and open-source use. Contribute on GitHub.

Make a Payment in Three Commands

terminal
$ curl -X POST https://api.example.com/endpoint
HTTP/1.1 402 Payment Required
{"payTo":"0xB360...","amount":"10000"}
$ x402-wallet create-payment --pay-to 0xB360... --amount 10000 > payment.txt
✓ Payment signature created
$ curl -H "X-PAYMENT: $(cat payment.txt)" https://api.example.com/endpoint
{"ok":true,"data":"..."}

Install the CLI

Clone the repository and build from source. You'll be ready to send x402 payments once the binary compiles.

git clone https://github.com/0xKoda/x402-wallet
cd x402-wallet
cargo build --release

Give your agent clear context by referencing the wallet.md file in your prompt. For example:

"I need you to access an x402-protected API. Read @wallet.md to understand how to use the x402-wallet CLI for payments."

The wallet.md file contains complete instructions on the payment workflow: making initial requests, parsing 402 responses, creating payment signatures, and retrying with payment headers.

The wallet.md file acts as a comprehensive instruction manual for AI agents. It explains:

  • The complete x402 payment workflow
  • How to parse 402 Payment Required responses
  • How to use the x402-wallet CLI commands correctly
  • How to handle errors and edge cases
  • Network configuration and token addresses

Without this context, agents may not understand how to properly construct payments or handle the multi-step payment flow.

The resource-list.md file contains a curated list of x402-protected APIs your agent can access. Reference it in your prompt:

"Check @resource-list.md for available x402 services. I need you to use the [Service Name] to [task description]."

This file provides endpoints, request formats, and examples for each service, making it easy for agents to discover and use x402-protected resources.

Here's a complete example of how to prompt your agent:

"I need you to generate a recipe for BBQ pork ribs. Use the Recaipe API listed in @resource-list.md. Follow the payment workflow in @wallet.md to handle the x402 payment. The wallet is already initialized and funded with USDC."

This gives the agent:

  • The task (generate recipe)
  • The resource to use (Recaipe API)
  • Where to find service details (@resource-list.md)
  • Where to find payment instructions (@wallet.md)
  • Context that wallet is ready (initialized and funded)

Always use the .env method for AI agents.

The encrypted keystore requires password input on every command, which blocks automation. AI agents cannot enter passwords interactively.

Setup for agents:

x402-wallet wallet-init
# Follow the prompts to create or import a key
# The CLI automatically creates a .env file with your key

The wallet CLI automatically reads the private key from the .env file when running commands—no export needed. The .env file is secured with 0600 permissions on Unix systems.