All posts
HackathonAIBitcoinLightningTypeScript

Agora — An Economy Where Agents Pay Agents

2026-03-20

AI agents are about to start transacting on their own behalf — verifying facts, buying datasets, hiring specialists, ordering goods. But the payment rails they inherit were built for humans clicking buttons. At the 5th Hack-Nation Hackathon's Spiral Challenge, we built Agora — a multi-component system that turns “agents pay agents” from a slogan into a working economy — and took second place.

Agora — agent-to-agent marketplace on Bitcoin Lightning

Executive Summary

Agora is the first multi-seller marketplace on Bitcoin Lightning where a buyer-agent picks among competing offers, pays, gets the result, and the receipt is verifiable end-to-end. Sub-cent settlement, ~1-second round-trips, identity-free by design, and MCP-native so any modern AI assistant can spend on it out of the box.

1.05sMedian settlement
$0.88Total mainnet spend
115/115Test-gate checks
0 feesRouting in practice

01The Problem

Agents that can reason about thousands of services per day are economically constrained to credit-card-era speeds. The infrastructure simply wasn't built for them:

Card networks

  • ~30¢ minimum per transaction — 100× too high for micropayments
  • Fraud systems demand CAPTCHAs and 3DS challenges
  • Account creation required; settlement takes days

Stablecoins

  • Same gatekeeper model on different rails
  • Centralized control — fees, freezes
  • Transactions tied to public wallets

02Who It's For

Specialist providers

Curated knowledge or compute — cleaned regulatory scrapes, indexed case law, pre-computed embeddings. Their economics are "one expensive build, infinite cheap reads." Agora gives them a per-call sales channel that doesn't exist anywhere else.

AI-native product teams

Building agentic assistants whose users hand the agent a budget and a goal rather than reviewing each call. Agora is the discovery + billing layer their agent talks to.

Enterprises

Running internal agents that need to spend on external services — a private Agora instance gives them an audited, budget-capped, kill-switchable spending surface.

03The System

Agora is a multi-component system. Each piece does one job well:

Public registry

Sellers register with an Ed25519 pubkey — no email, no password, no account. Each lists services with type, price, latency, and a free preview. FTS5 search, type/price filters, signed-write protection.

L402 paywall

On every paid endpoint: the agent posts a request, gets HTTP 402 Payment Required with a Lightning invoice, pays it, replays with the payment-proof header, and gets the work back. The payment is the credential — no API key, no session.

Orchestrator

Ranks candidate services with an explainable score — 60% intent match, 20% honor-normalized reputation, 20% price-fit — and returns the breakdown so the agent can show its reasoning.

Reputation + peer review

Buyers rate sellers (gated by a real, recent transaction); sellers request paid peer reviews against a structured rubric, with blind reviewer assignment and slashing for bad-faith work. 90-day honor decay rewards consistent activity.

PayMyAgent (MCP server)

A stdio server giving Claude Desktop, Cursor, and Claude Code access to Agora's tools — with a per-call cap, per-session sat budget, kill-switch, and persisted spend counter, so a human can hand a budget to the agent without anxiety.

Public web index + live feed

A read-only, crawlable browser surface (/sellers, /services, /search, /recommend, /activity) that lets humans inspect the marketplace and directories like 402index.io discover the catalog. Every settled payment surfaces on /activity.

04Why Agora Is Different

Every other agent-payment project today is one of two things: a single shop (Origram, Clank, unhuman.coffee — each one vendor) or a read-only directory (402index.io, agentic.market, x402 Bazaar — browse but don't transact). Agora is the bid layer in between.

  • Sub-cent settlement, ~1s round-trips, zero routing fees in practice. A 240-sat call costs ~$0.0016 and clears in under a second — below the floor of every legacy rail.
  • Identity-free by design. Pubkey is the account — no email, no password, no KYC layer with freeze authority.
  • Explainable orchestration. Every recommendation ships a 60/20/20 breakdown, not a black-box ranking — the answer to "why this seller, not that one?"
  • MCP-native buyer SDK. Any modern AI assistant can use Agora's tools with zero buyer-side integration.
  • Open infrastructure. Lightning belongs to no one — no platform can freeze a seller, throttle throughput, or rewrite the fee schedule unilaterally.

05Under the Hood

A six-workspace TypeScript / Node.js monorepo. The registry is Next.js 16 + SQLite (better-sqlite3) with FTS5 full-text search, numbered migrations, Ed25519 signed-request middleware, deterministic-hash pseudo-embeddings for semantic search, and a 90-day honor decay job. The provider implements L402 with HMAC-signed macaroons (HMAC-SHA-256 over a base64url claims payload), preimage verification, single-use enforcement via atomic SQLite transitions, pino structured logging, per-IP token-bucket rate limiting, and a dual-mode wallet adapter that switches between mock and real Lightning over Nostr Wallet Connect via @getalby/sdk.

TypeScriptNext.js 16better-sqlite3 + FTS5@noble/ed25519@noble/hashes@modelcontextprotocol/sdkNostr Wallet Connect (NIP-47)@getalby/sdk

The MCP server exposes 24 canonical tools over stdio transport, plus a localhost-only HTTP control plane for the desktop dashboard and a three-layer spending guardrail. A suite of nine end-to-end phase-gate tests spawns the full stack and validates real behavior — signed-write rejection, replay-protection, budget guardrails, blind reviewer assignment, escrow split arithmetic, dataset signed-URL gating. A Cloudflare-Tunnel ephemeral URL exposes the whole stack publicly in 30 seconds.

06Results — A Live Demo, Not Slideware

Six successful mainnet Lightning payments end-to-end from MCP through the provider, settled at ~1.05s median with zero routing fees in practice — total spend $0.88 USD across the run, each settlement a discrete transaction in Alby Hub's log. 115 / 115 documented test-gate checks green across nine phases.

Explainable Orchestration In Production

A freshly-rated seller's score moved from 0.317 (im=0.27, hn=0.00, pf=0.76) to 0.519 (im=0.27, hn=1.00, pf=0.76) on a single rating — demonstrating that the 60/20/20 ranking is honest and reactive, not a static leaderboard.

Real OSM-geocoded ground truth came back for every paid listing-verify call — Tour Eiffel, Hotel Adlon, Brandenburger Tor, Sydney Opera House — with HMAC-signed proofs, real osm_id references, and confidence scores up to 0.989. Subscriptions worked too: 50-sat-per-event GitHub advisory feeds, balance-debited correctly, top-up working, balance-exhausted alerts firing, refund on cancel.

BitcoinLightningL402MCPAgentsTypeScriptHackathonSpiral

Agora · Second place, Spiral Challenge · 5th Hack-Nation Hackathon

Enjoyed this post? Check out what else I've been building.

See my other posts