Skip to content

TruCore Product Docs

x402Fuel

Non-custodial HTTP 402 wallet daemon for AI agents. Give your agent a USDC wallet on Base with one command. Keys never leave your machine.

What is x402Fuel?

x402Fuel is a single Go binary that runs on your machine next to your AI agent. It acts as a local wallet daemon and HTTP 402 payment proxy.

When your agent hits an API that returns 402 Payment Required, x402Fuel intercepts the response, checks your budget policy, signs a USDC payment on Base with EIP-3009 authorization, and retries the request with the payment attached. The agent gets the resource — no human intervention, no credit card, no prepaid API key.

Non-custodial by construction. Your agent holds its own keys — encrypted at rest on your machine. x402Fuel never sees your funds. Settlement flows directly from your agent's wallet to the merchant on-chain.

Architecture

Six components in one binary:

ComponentRole
Key StoreGenerates and stores encrypted secp256k1 keys locally. Never transmits key material.
Proxy InterceptorSits between your agent and the internet. Catches 402 responses, parses payment requirements.
Policy EngineEnforces per-txn max, daily cap, per-service allowlist, and global kill switch. Blocks BEFORE signing.
Chain ClientReads USDC balance, signs EIP-3009 authorization, submits to Base via public RPC.
HTMX DashboardLocal web UI at localhost:8420 — balances, transaction history, budget utilization.
Event LoggerStructured JSONL log of every 402 encounter and payment attempt. Opt-in aggregate telemetry.

Quickstart

Install, create a wallet, start the daemon:

$ go install github.com/trucore-ai/x402fuel@latest
$ x402fuel create --name my-agent
  Created wallet 0x... on Base. Keys stored at ~/.x402fuel/keys/

$ x402fuel serve
  Proxy listening on :8420
  Dashboard at http://localhost:8420

Point your agent's HTTP proxy at localhost:8420. When the agent hits a 402 paywall, x402Fuel handles the rest.

CLI Reference

x402fuel create

Creates a new Base USDC wallet. Keys encrypted at rest.

x402fuel create [flags]

Flags:
  --name string       Wallet name (required)
  --output string     Output format: text (default), json
  --config string     Config file path (default: ~/.x402fuel/config.yaml)

x402fuel serve

Starts the daemon — proxy + REST API + dashboard.

x402fuel serve [flags]

Flags:
  --port int          Proxy + dashboard port (default: 8420)
  --rpc-url string    Base RPC endpoint (default: public Base RPC)
  --config string     Config file path

x402fuel pause

Global kill switch. Blocks all new payments within 1 second. In-flight payments still settle.

x402fuel pause
  Payments paused. All future 402 requests will be blocked.

x402fuel pause --resume
  Payments resumed.

x402fuel status

Shows wallet balances, budget utilization, pause state, and recent activity.

x402fuel status [flags]

Flags:
  --output string     Output format: text (default), json
  --json              Short for --output json

Budget Policy

Configured via ~/.x402fuel/config.yaml. Policy is enforced locally — no cloud dependency.

wallet:
  address: "0x..."

policy:
  max_per_txn_usdc: 5.00        # Block any single payment over $5
  daily_cap_usdc: 50.00          # Block when daily total exceeds $50
  allowed_hosts:                 # Only pay these services
    - "api.openai.com"
    - "data-provider.example.com"
  kill_switch: false             # true = block all payments

logging:
  event_log: ~/.x402fuel/events.jsonl
  telemetry: false               # Opt-in aggregate counts only

How Payment Works (E2E)

  1. Agent requests a resource. Your agent sends an HTTP request through the x402Fuel proxy.
  2. Server returns 402. The API responds with 402 Payment Required plus an X-PAYMENT-REQUIREMENTS header describing cost, asset, and network.
  3. x402Fuel checks policy. Is the host allowed? Is the amount under max-per-txn? Is the daily cap not exceeded? If any check fails → payment blocked BEFORE signing, agent receives original 402 with a machine-readable block reason.
  4. Signs EIP-3009 authorization. Uses the locally stored key to sign a gasless USDC transfer authorization. No ETH needed for gas — EIP-3009 permits are submitted by the payee.
  5. Retries with payment. Repeats the original request with the signed authorization in the X-PAYMENT header.
  6. Server delivers resource. API verifies the payment, delivers the resource, and submits the authorization on-chain. USDC transfers from your agent's wallet to the merchant.

Security Model

Keys never leave your machine

Private keys are generated and stored encrypted locally. x402Fuel has no server-side component that could access them.

Budget is enforced BEFORE signing

Policy checks happen in the proxy interceptor before the key store is ever touched. A blocked payment never produces a signature.

No custody = no money-transmitter risk

Like MetaMask, x402Fuel is wallet software. It never holds, controls, or intermediates funds. You hold the keys.

Kill switch in 1 second

`x402fuel pause` blocks all new payments immediately. Designed for emergency shutdown when an agent goes rogue.

Zero key material in logs

Enforced by automated test — grep for hex private keys in log output returns zero matches. Not a convention, a test.

Event log is local-first

Every 402 encounter and payment attempt is logged to your local JSONL file. Telemetry is opt-in and publishes counts only — no URLs, no addresses.

Event Log

Every 402 encounter and payment attempt is recorded as structured JSONL:

{"ts":"2026-08-23T02:00:00Z","host":"api.example.com","amount":"1.50",
 "asset":"USDC","network":"evm:8453","decision":"approved","outcome":"settled",
 "tx_hash":"0xabc...","latency_ms":183}
{"ts":"2026-08-23T02:01:00Z","host":"unknown-service.io","amount":"10.00",
 "asset":"USDC","network":"evm:8453","decision":"blocked",
 "reason":"host_not_allowed","latency_ms":4}

FAQ

Do I need ETH for gas?

No. x402Fuel uses EIP-3009 (gasless transfer with authorization). The merchant submits the signed authorization and pays gas. Your agent wallet only needs USDC.

What if the agent goes rogue?

The daily cap and max-per-txn limit constrain damage. x402fuel pause stops all new payments immediately. Review the event log to see what happened.

Can I use chains other than Base?

Base is the only supported chain at MVP. Multi-chain (Solana, EVM L2s) is on the roadmap — the architecture supports it, the proxy iterates over accepts[] entries in payment requirements.

Does x402Fuel charge transaction fees?

No. x402Fuel is MIT-licensed and self-hosted. It's your binary on your machine. A managed cloud control plane with multi-wallet dashboards and org budgets is planned (Q4 2026), but the core wallet daemon is free forever.

Integrations & Next Steps