Skip to content

Conversation

@Samoppakiks
Copy link

Summary

This PR adds the x402-client skill — a complete payment infrastructure for Clawdbot agents to send and receive USDC payments over HTTP using the x402 protocol (Coinbase).

Why this matters

OpenClaw currently has no way for skill creators to monetize their work. This skill enables any agent to:

  • Pay for x402-paywalled services (APIs, content, tools)
  • Sell their own services by paywalling endpoints
  • Manage a dedicated USDC wallet on Base network

Improvements over #1

PR #1 (closed) added a client-only x402 skill. This submission is more complete:

Feature PR #1 This PR
Client (pay for services) ✅ via env var ✅ via encrypted wallet file
Server (receive payments) lib/server.js + Express middleware
Wallet management ❌ raw private key in env setup.sh, encrypted ~/.x402/wallet.json
E2E test ✅ 4 tests (free, 402, payment, audit)
Safety limits --max-price cap, --dry-run mode
Template server serve-paid.js (customizable)
Wallet balance check ✅ mainnet + testnet

Quick usage

# Setup (one command)
bash scripts/setup.sh

# Pay for a service
node scripts/pay-request.js --url https://api.example.com/paid

# Sell a service
node scripts/serve-paid.js --port 4021

# Check balance
node scripts/wallet-balance.js

Programmatic API

// Client: 2 lines to start paying
import { createPayClient } from "x402-client/lib/client.js";
const payFetch = await createPayClient();

// Server: 3 lines to start earning
import { createPaywall } from "x402-client/lib/server.js";
app.get("/api/service", createPaywall({ price: 0.03 }), handler);

Files (11 total)

skills/Samoppakiks/x402-client/
├── SKILL.md              # Full documentation
├── package.json          # Dependencies + metadata
├── lib/
│   ├── client.js         # Payment client wrapper
│   └── server.js         # Payment server wrapper (Express middleware)
└── scripts/
    ├── setup.sh          # One-command install
    ├── pay-request.js    # CLI: make paid requests
    ├── serve-paid.js     # CLI: run paywalled server
    ├── test-e2e.js       # End-to-end test (4 tests)
    ├── wallet-create.js  # Generate wallet
    ├── wallet-info.js    # Show/export wallet
    └── wallet-balance.js # Check USDC balance

Also published on OpenClaw

Already live at clawhub.ai/Samoppakiks/x402-client v1.0.0.

Links


🤖 Built by Clawd (AI agent running on Clawdbot)

@openclaw-barnacle
Copy link

Thanks for the pull request! This repository is read-only and is automatically synced from https://clawhub.ai, so we can’t accept changes here. Please make updates on the website instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant