Inspiration

When a paid service fails, a human can call customer support. Agents cannot.

As AI agents pay for more APIs on their own - weather, search, tools, data etc.. a failed or slow response after payment leaves them with no recourse. x402 makes agent-to-API payments real; x500 asks the next question: who refunds a 500 after the agent already paid?

What it does

x500 is a micro-insurance for AI agent's x402 based API payments.

  • Agents call merchant APIs through an insured gateway
  • Merchants get paid via x402 Exact
  • Agents pay a flat insurance premium from on-chain escrow
  • If the call fails or misses SLA, the protocol refunds them automatically - no tickets, no claims desk

Try it live: dashboard · chat demo (normal + SLA-breach refund) · pitch · demo video

Who benefits

Merchants

  • List a paid API once and receive HBAR per call via x402
  • Set slug, origin URL, API price, and SLA in the dashboard
  • Stay focused on serving the API — premiums and refunds settle in the protocol
  • Become discoverable to agents that resolve your origin through x500

Agent builders

  • One insured fetch path: pay the merchant + pay the premium
  • Automatic parametric refunds on failure / SLA breach
  • No need to know the merchant slug — pass the public origin URL
  • Drop-in SDK for any agent runtime (CLI, LangChain, custom bots)

How merchants use x500

  1. Host an HTTP API with a public HTTPS origin (e.g. ngrok for demos)
  2. Open the dashboardMerchants
  3. Connect HashPack and register slug, origin, API price, and SLA
  4. Serve the route with x402 Exact HBAR — agents reach you through the insured proxy

How agents use x500

Install the SDK, fund escrow once, then call any registered merchant by origin URL:

npm install x500-sdk
import { createX500 } from "x500-sdk";
const x500 = createX500({
  network: "testnet",
  accountId: process.env.X500_AGENT_ACCOUNT_ID!,      // 0.0.x
  privateKey: process.env.HEDERA_AGENT_PRIVATE_KEY!, // ECDSA hex 0x...
});
// 1. Fund insurance escrow once
await x500.setup({ escrowTinybars: 50_000_000n }); // 0.5 HBAR
// 2. Call a registered merchant by origin URL — slug resolved automatically
const res = await x500.fetchMerchant(
  "https://your-merchant.example/paid/weather?city=Paris",
);
console.log(res.status, await res.text());
await x500.close();

How we built it

End-to-end stack:

  • ContractsX500Registry, X500Pool, X500Settler
  • Agent SDK / CLIx500-sdk, x500 (npm)
  • Market proxy + wrap/classifier — route, classify outcomes, price premium/refund
  • Facilitator — x402 Exact HBAR verify & settle
  • Settler + indexer — on-chain settleBatch + mirror sync API
  • Dashboard — HashPack merchant registration & explorer
  • Examples — merchant server + LangChain agent

Challenges we ran into

  • Keeping x402 merchant payment and insurance escrow as separate rails without confusing agents or merchants
  • Making outcomes parametric (HTTP status / latency → refund) instead of subjective claims
  • Reliable settlement: idempotent callIds, settler batching, and readable Hashscan links in demos
  • Machine-specific client quirks (e.g. Node 22 + node-fetch vs native fetch for Groq in the example agent)

Accomplishments that we're proud of

  • A full path from register → pay → insure → refund on Hedera testnet
  • Published x500-sdk and a HashPack-powered dashboard
  • Live chat demo for success and SLA-breach refund scenarios
  • Clear separation: merchants keep their x402 servers; x500 only settles risk

What we learned

  • Agent commerce needs refunds as much as payments
  • Parametric triggers beat manual claims for autonomous callers
  • Hedera primitives (x402 Exact, HSCS contracts, mirror reads) are a strong fit for prepaid escrow + settlement
  • Good demos need honest payment breakdowns and explorer links, not just “it worked”

What's next for x500

  • Mainnet migration
  • Broader merchant onboarding and richer SLA policies
  • Hardening settlement UX and observability for production agents
  • Exploring additional networks / assets beyond V1 (like USDC, USDT etc)

For a deeper walkthrough — architecture, headers, contracts, and integration guides — see the full GitHub README.

Built With

Share this project:

Updates