Skip to content

A Claude Code / OpenClaw skill for requesting, accepting, and making payments from / to humans and agents

Notifications You must be signed in to change notification settings

second-state/payment-skill

Repository files navigation

Payment skill for AI agents

A skill for OpenClaw / Claude Code / OpenCode to make and receive payments. Currently supports USDC payments on the Base chain. Try it at https://money.flows.network/

Overview

This project provides four CLI tools for Ethereum wallet management and token payments:

create-wallet

Creates a new Ethereum-compatible wallet with a secure random private key. The wallet is encrypted using the Web3 Secret Storage standard (keystore format) and saved to disk.

create-wallet [OPTIONS]

Key features:

  • Generates cryptographically secure private keys
  • Encrypts wallet using scrypt + AES-128-CTR
  • Auto-generates secure password if not provided
  • Outputs the wallet address to stdout

get-address

Retrieves the Ethereum address and token balance from an existing wallet without requiring the password.

get-address [OPTIONS]

Key features:

  • Reads address directly from keystore (no decryption needed)
  • Queries current token balance from blockchain (if network configured)
  • Outputs JSON with address, balance, token info, and network
  • Creates a new wallet automatically if none exists

pay

Transfers ERC-20 tokens or native ETH from your wallet to a recipient address.

pay --to <ADDRESS> --amount <AMOUNT> [OPTIONS]

Key features:

  • Supports ERC-20 token transfers (USDC, etc.)
  • Supports native ETH/gas token transfers
  • Checks balance before sending
  • Waits for transaction confirmation by default
  • Uses configuration for network and token defaults

payment-config

Manages configuration for all x402 tools. Stores settings in config.toml (located in the skill root directory, alongside the binaries).

payment-config <COMMAND>

Commands:

  • show - Display all current configuration
  • get <KEY> - Get a specific config value
  • set <KEY> <VALUE> - Set config values
  • use-network <PROFILE> - Apply a predefined network profile (base-sepolia, base-mainnet, etc.)
  • list-networks - List available network profiles
  • list-keys - List all valid config keys

Personal Data Storage

All personal data is stored in the skill root directory (the parent of the scripts/ directory where binaries live):

<skill-root>/
├── config.toml      # Network, token, and payment settings
├── wallet.json      # Encrypted wallet keystore (Web3 Secret Storage format)
└── password.txt     # Wallet password (auto-generated, 600 permissions)

The data directory is determined at runtime via std::env::current_exe() — each binary resolves paths relative to its own location (../ from the scripts/ directory).

Skill Directory Structure

Platform-specific skill files live under claude/ and openclaw/:

claude/skills/payment/       # For Claude Code
├── bootstrap.sh
├── config-default.toml
├── install.md
├── SKILL.md
└── scripts/

openclaw/skills/payment/     # For OpenClaw
├── bootstrap.sh
├── config-default.toml
├── install.md
├── SKILL.md
└── scripts/

How Installation Works

  1. Clone skill files: The install script copies the platform-specific directory to the agent's skill path:

    • Claude Code: ~/.claude/skills/payment/
    • OpenClaw: ~/.openclaw/skills/payment/
  2. Bootstrap binaries: Running bootstrap.sh detects your platform (OS + architecture) and downloads the appropriate pre-compiled binaries from GitHub Releases

  3. Binary installation: Binaries are extracted to the scripts/ subdirectory and made executable

Supported platforms:

  • Linux x86_64 / aarch64
  • macOS x86_64 / aarch64 (Apple Silicon)
  • Windows x86_64

Final installed structure

~/.claude/skills/payment/          # (or ~/.openclaw/skills/payment/)
├── bootstrap.sh
├── config.toml          # Created from config-default.toml
├── wallet.json          # Created by create-wallet
├── password.txt         # Auto-generated wallet password
├── SKILL.md
└── scripts/
    ├── create-wallet
    ├── get-address
    ├── pay
    └── payment-config

Development

This is a Rust workspace with the following crates:

Crate Description
payment-common Shared library for configuration, errors, and utilities
create-wallet Wallet creation CLI
get-address Address retrieval CLI
pay Token payment CLI
payment-config Configuration management CLI

Building

cargo build --release

Running tests

cargo test

Cross-compilation

The project uses GitHub Actions to build binaries for all supported platforms. See .github/workflows/ci.yml for the CI configuration.

License

See LICENSE for details.

About

A Claude Code / OpenClaw skill for requesting, accepting, and making payments from / to humans and agents

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •