Search projects, hackathons, sponsors and tech

    ← All projects

    Agora402

    Agent marketplace on Hedera: discover, negotiate and pay per request over x402, with HCS receipts.

    Demo

    About

    Agora402 is an agent-to-agent services marketplace on Hedera. AI agents need to buy inference, data and compute from other agents and services without API keys, subscriptions or a human at a checkout page. Agora402 gives them three things: discovery, negotiation and payment, all settled on Hedera at machine speed. Discovery: sellers publish a listing (endpoints, pricing model, HCS-14 agent identity) to a Hedera Consensus Service registry topic. Buyers read it from the public mirror node. A listing only counts if the HCS message was paid for by the payTo account it names, so there is no registry operator to trust. Negotiation: an A2A-style quote handshake. The buyer states the work and a price ceiling, the seller answers with a signed, time-limited quote. Buyers can counter below list price, sellers have a floor. The paid request references the quote, so the HTTP 402 carries exactly the agreed amount. Payment: x402 exact scheme on Hedera, settled through the Blocky402 facilitator on Hedera testnet. Prices are metered per request: the LLM endpoint charges a base fee plus per 1k input tokens plus per 1k budgeted output tokens, the data feed charges per query. Payment is in HBAR or in TOLL, an HTS token with a custom fee schedule. The buyer agent enforces a cap per call and a session budget before it ever signs. Audit: for every settled payment the seller writes a receipt (transaction id, payer, amount, resource, quote id, token usage, hash of the response) to a second HCS topic. The CLI recomputes every bill against the mirror node and flags mismatches. Failed calls are never charged. Included: two live x402-gated services (metered inference, live HBAR/USD rate), a buyer agent with CLI and a live dashboard, setup scripts for topics and the HTS token, and 27 tests that run the real x402 client and server code paths.

    How it's made

    TypeScript monorepo (npm workspaces, Node 20, Vitest). Four packages plus scripts. Seller: Express with @x402/express and @x402/hedera (exact scheme server). Each route's price is a DynamicPrice function that reads the request body, so the 402 amount is computed per request from a BigInt pricing model (flat, per-token, per-unit). Quotes are signed with the seller's Hedera ECDSA key over canonical JSON and pinned in the 402 when the request carries a quoteId. The x402ResourceServer onAfterSettle hook builds the receipt from the settled transaction, the request path, a usage header set by the handler and a sha256 of the buffered response, then publishes it to HCS with TopicMessageSubmitTransaction (async, so consensus never delays the paid response). A 4xx or 5xx from the handler makes the middleware cancel settlement. Buyer: @x402/fetch wrapFetchWithPayment with the Hedera client signer. Spend controls give the per-call cap; two registered policies filter 402 options by asset and by remaining session budget; a custom selector picks the cheapest option. Discovery reads the registry topic via the mirror node REST API (chunked HCS messages are reassembled), prices every seller locally with the same priceFor function, negotiates with the cheapest, then verifies the settlement transaction on the mirror node and shows the HashScan link. A dashboard streams every stage over Server-Sent Events. Hedera: HCS for the registry and receipts topics, HTS for the TOLL settlement token (6 decimals, custom fixed fee to the seller), ECDSA account keys for quote signatures, mirror node for registry reads, receipt audit, signer checks and the paid HBAR/USD data feed. Facilitator: Blocky402 hosted testnet (api.testnet.blocky402.com), which co-signs as fee payer and submits the transfer. Identity: HCS-14 uaid:aid identifiers (SHA-384 of the six canonical fields, Base58) for seller and buyer, plus an A2A agent card at /.well-known/agent.json declaring the x402 extension. Notable: the test suite drives the real @x402 client and server code with a fake facilitator that decodes the partially signed Hedera transaction, so the whole 402 -> sign -> verify -> handler -> settle -> receipt loop is exercised offline. LLM provider is abstracted (Groq during development, Anthropic for the demo, mock for tests). Built with Claude as coding assistant, documented in the README and docs/PLAN.md.