Skip to content

PayNodeLabs/paynode-402-cli

Repository files navigation

⚡ paynode-402-cli

Base L2 HTTP 402

The official command-line interface for the PayNode protocol. Designed specifically for the Agentic Era, allowing AI Agents to execute zero-install, stateless micro-payments via the HTTP 402 standard.


🛠️ Configuration & Credentials

To enable automated blockchain signing, this tool requires a private key provided via environment variables.

Important

Mandatory Variable: CLIENT_PRIVATE_KEY (0x...) All signature and payment operations rely on this key. Ensure it is set in your environment before execution.

Caution

BURNER WALLET ONLY: NEVER use a primary or "cold storage" wallet. This tool is designed for autonomous agents; always use a dedicated burner wallet with minimal funds (< 10 USDC).

Setup Example (Unix)

export CLIENT_PRIVATE_KEY="0x..."
bunx @paynodelabs/paynode-402-cli check

🤖 For AI Agents (Zero-Install)

Your agent can use this tool dynamically via bunx without any manual installation:

1. Check Readiness (Gas & USDC)

bunx @paynodelabs/paynode-402-cli check --network testnet --json

2. Access a 402-Protected API

The CLI automatically detects the 402 challenge, performs the handshake, signs the payment (on-chain or EIP-3009), and returns the final resource.

bunx @paynodelabs/paynode-402-cli request "https://api.example.com/data" --network testnet --json

3. Mint Test USDC (Base Sepolia)

bunx @paynodelabs/paynode-402-cli mint --amount 100 --network testnet

📑 Command Summary

Command Description
check Check ETH/USDC balances and readiness on Base L2
mint Mint Mock USDC on Base Sepolia for testing
request <URL> Access a protected resource by handling the 402 challenge
list-paid-apis Discover payable APIs from the PayNode Marketplace
get-api-detail <id> Inspect one marketplace API
invoke-paid-api <id> Invoke a marketplace API using the 402 flow

Global Flags

  • --network <name>: mainnet or testnet (default: testnet).
  • --json: Format output as machine-readable JSON (preferred for Agents).
  • --confirm-mainnet: Explicit flag required for real USDC transactions on mainnet.
  • --background: Execute in background and return a task_id for long-running handshakes.

🔗 References

About

A zero-install CLI tool for AI Agents to autonomously handle HTTP 402 micro-payments and access protected APIs on Base L2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors