x402 lets AI agents pay for API access atomically on Algorand. Three lines of code. Zero custody. Cross-chain USDC bridging to Ethereum, Solana, and Base.
Install the SDK, configure your key, call executeTrade. The 402 handshake is absorbed automatically.
npm install @m-reynaldo35/x402-client algosdk
import { AlgoAgentClient, DestinationChain } from "@m-reynaldo35/x402-client"; const client = new AlgoAgentClient({ baseUrl: "https://ai-agentic-wallet.com", privateKey: yourAlgorandSecretKey, // 64-byte Uint8Array onProgress: (e) => console.log(e.stage, e.message), // optional }); const result = await client.executeTrade({ senderAddress: "YOUR_ALGO_ADDRESS", destinationChain: DestinationChain.ETHEREUM, destinationRecipient: "0xYOUR_ETH_ADDRESS", }); console.log(result); // { success: true, settlement: { txnId: "...", confirmedRound: 47291042 } }
const batch = await client.executeBatch({ senderAddress: "YOUR_ALGO_ADDRESS", intents: [ { destinationChain: "ethereum", destinationRecipient: ETH_ADDR }, { destinationChain: "solana", destinationRecipient: SOL_ADDR }, { destinationChain: "base", destinationRecipient: BASE_ADDR }, ], }); // All 3 succeed or all 3 revert — zero partial execution risk
Every feature is designed for machine-to-machine settlement. No human in the loop.
HTTP 402 challenge-response. The SDK absorbs the bounce, builds the Ed25519 proof, and retries — all in one call.
Up to 16 cross-chain intents bundled in a single Algorand atomic group. All settle or none do.
Native USDC bridging to Ethereum, Solana, Base, Arbitrum, Optimism, Polygon, and Avalanche via Folks Finance NTT.
Every settlement is bounded by Gora consensus price ±slippage. Stale oracle data (>15s) is rejected at the AVM level.
Every X-PAYMENT nonce is stored in Upstash Redis with 60s TTL. Duplicate signatures are rejected before they reach the chain.
No private keys in the transaction builder. Signing happens in Rocca Wallet after FIDO2 authentication via Liquid Auth.
All endpoints are served at https://ai-agentic-wallet.com
Server health check. Returns network status, Algorand node provider, and latest round.
Construct an unsigned atomic group for a single cross-chain trade. Returns a SandboxExport envelope. Pass X-SLIPPAGE-BIPS header to override default 50bps slippage.
Construct a batched atomic group for up to 16 simultaneous cross-chain trades. Returns SandboxExport + batchSize.
Execute the full settlement pipeline on a SandboxExport: validate → Liquid Auth → Rocca sign → Algorand broadcast. Returns txnId and confirmedRound on success.
// Base64-encoded JSON payload: { "groupId": "base64 SHA-512/256 atomic group hash", "transactions": ["base64 signed txn blob", "..."], "senderAddr": "ALGO58CHARADDRESS...", "signature": "base64 Ed25519 sig over groupId bytes", "timestamp": 1708339200, // Unix epoch, <60s old "nonce": "uuid-v4" // Single-use }
USDC settles on Algorand first, then bridges via Wormhole NTT. Choose destination per-trade or mix in a batch.
Multiple independent layers of enforcement. Any single layer failing blocks the entire settlement.
Every request must prove ownership of the paying address via algosdk.verifyBytes(). No signature, no access.
AVM-level stateless smart signature enforces: fee ≤ 1000 µALGO, type = axfer, amount ≤ 50M µUSDC.
X-PAYMENT timestamp is validated server-side. Offers expire after 5 minutes. Nonces are single-use.
Upstash Redis sliding window: 100 req/10s per platform key, 30 req/10s per IP. In-memory fallback when Redis is degraded.
Machine-readable manifests for agent registries and AI protocol marketplaces.
Structured JSON protocol manifest for OpenClaw-compatible agent marketplaces.
Full agent capability manifest: pricing, endpoints, auth scheme, and identity claims.
LLM-readable markdown describing how an AI agent should interact with this protocol.