Skip to main content
This guide gets you from zero to a working agent that fetches live price data via x402 and executes a token swap on Base. What you’ll need:
  • Node 22.16+ (Node 24 recommended)
  • A funded wallet — complete wallet setup first

Install OpenClaw

1

Install the CLI

macOS / Linux:
Terminal
curl -fsSL https://openclaw.ai/install.sh | bash
Windows (PowerShell):
Terminal
iwr -useb https://openclaw.ai/install.ps1 | iex
Verify:
Terminal
openclaw --version
2

Run onboarding

Terminal
openclaw onboard --install-daemon
3

Start the gateway

Terminal
openclaw gateway --port 18789
Claude Code, Codex, and OpenCode users — the wallet and trading skills below are compatible with any skills-enabled AI coding tool. Run the same npx skills add commands from within your tool.

Configure a trading wallet

Bankr provides cross-chain wallet access with gas sponsorship and built-in swap support — ideal for trading agents:
install the bankr skill from https://github.com/BankrBot/skills
Create a dedicated account at bankr.bot and generate an API key at bankr.bot/api. For CDP Agentic Wallet or Sponge Wallet, see wallet setup.

Execute a swap

Ask your agent to execute a trade using wallet-native tools:
Buy $50 of ETH on Base
With Bankr or CDP Agentic Wallet, built-in swap tools handle the trade — no external DEX integration needed. The wallet constructs, signs, and broadcasts the transaction. For best execution on Base, use the preconf endpoint to simulate before signing:
Simulate buying $50 of ETH then execute if the price impact is below 1%

Next steps

Data fetching

Full catalog of x402 data sources for trading agents.

Trade execution

Flashblocks timing, fee calibration, and failure modes on Base.

Wallet setup

Configure Bankr, CDP, or Sponge for your agent.

x402 protocol

How x402 works for data fetching and payments.