SurgePass

A fair line in front of booking sites: real people via World ID, a draw anyone can verify on Hedera

SurgePass

Created At

ETHGlobal Mumbai

Winner of

Hedera

Hedera - "No Solidity Allowed": Build with Hedera SDKs

Project Description

SurgePass is a fair line that sits in front of a booking website at its busiest minute.

THE PROBLEM When train Tatkal quotas, first-day movie shows or concert tickets open at a fixed time, everyone arrives in the same second. Scripts click faster than people, so bots take the seats; the rush overloads the site so real customers get errors; and reserved agent or partner quotas leak to touts who hoard and resell them. "Block the bots" no longer works either: AI agents acting for real people are arriving, so a site needs to know which automation has a real human behind it, and fairness has to be something anyone can check, not a promise from the seller.

WHAT SURGEPASS DOES SurgePass is a reverse proxy. The provider points its booking domain at it and adds about ten lines of code. Outside a drop's peak, every request passes straight through untouched. During a drop's peak, only the routes the provider chose are gated:

  • People wait in a calm waiting room and verify once with World ID. One human gets one entry, and no personal data is collected.
  • Entries go into a draw that is recorded on Hedera and can be recomputed by anyone.
  • Everyone who gets a seat receives a short-lived signed pass and books on the provider's own site, with its own inventory, fares and checkout.
  • Bots never reach the provider: they are sent to the waiting room, blocked, or asked to pay per request (x402) for extra availability checks, so hammering the site has a real cost.

FOUR LANES, ONE RULE: A REAL PERSON BEHIND EVERY SEAT

  1. People (fair draw): verify with World ID, ask for up to the seat limit, and get a seat in a verifiable random order. Unused seats go to the next person in line.
  2. Premium (sealed bids): bids stay sealed (commit/reveal) until bidding closes; everyone who gets a seat pays the same clearing price, the highest bid that didn't get one.
  3. Partners (seat tokens): authorised agencies are allowlisted by their Hedera account. Their seats are Hedera tokens only approved partners can hold, they put down a refundable deposit, and unused seats are taken back and returned to the public draw.
  4. Agents (with permission): an AI agent can act for its human only after the human approves it with World ID. The agent then enters, bids and pays for extra checks by itself, within a budget, and still counts as that one person. The approval link stays open until the drop closes, so the agent can ask the night before and act alone at drop time.

HOW WE USE WORLD ID SurgePass signs a one-time World ID request for each drop (action "enter:<drop>") with a nonce that can't be replayed. The person scans with World App (proof of human); the proof is verified with the World Developer Portal (v4) and turned into an anonymous ID per drop, so the same person entering twice is refused as a duplicate. Agent approvals use the same proof, bound to that agent, the seat count and the maximum bid. World ID is the only way to say "one per person" at internet scale without collecting identities, and it works for the agents people will send.

HOW WE USE HEDERA (THE REFEREE)

  • Consensus Service (HCS): every drop has its own topic. Every entry, sealed bid, partner hold, the cutoff, the result, passes issued and seats returned are written there; consensus time decides who was first.
  • PRNG: the draw's random seed comes from Hedera after entries close, under a transaction ID committed in advance, so nobody (the provider included) can pick who gets a seat.
  • Token Service (HTS): partner seats are NFTs with KYC, freeze and wipe keys. Only KYC'd partner accounts can hold a seat, so a transfer to a reseller is refused by the Hedera network itself (ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN). Used seats are wiped, unused seats are wiped back to the public, and a misbehaving partner can be frozen.
  • Scheduled transactions: deposits are refunded automatically.
  • x402 payments in HBAR: surge-priced availability checks, agent bid deposits and partner deposits are paid per request and settled on Hedera.
  • Mirror node: the waiting room rebuilds the draw (Fisher–Yates with sha256(seed + counter)) from public Hedera data in the browser and shows "Matches Hedera".

PROVIDER INTEGRATION Each allowed booking reaches the provider with a signed X-SurgePass-Assertion header (Ed25519 JWT) stating how many seats it may take and, for premium, the price. The provider verifies it with SurgePass's public keys and caps the booking. We ship the check in Node.js, Python, Java and Go, with the Node, Python and Java versions run against the live gateway.

WHAT'S IN THE DEMO

  • A provider console to create drops (route patterns, seats, peak windows, lanes), watch live decisions with a step-by-step trace for every request, run agent and partner test cases side by side, and see who was let through or turned away.
  • A bot flood button: the same flood hits two identical booking sites. The one without SurgePass crashes; the one behind SurgePass stays healthy, with a live globe view of bots stopping at the gate while real people pass through.
  • A World App-styled waiting room, a live draw reveal, a sealed-bid auction page, and a public "verify this draw" page.
  • A reference AI agent (CLI and MCP server) that asks its human for approval and pays x402 on its own, and a partner client that signs with its Hedera key.

Everything runs on Hedera testnet with real transactions (HCS topics, PRNG seeds, HTS seat tokens, scheduled refunds, x402 settlements) and real World ID verification with the production World App. The booking sites in the demo are mock providers we built to show the integration.

How it's Made

SurgePass is a TypeScript monorepo (npm workspaces) with six parts that talk over HTTP and one WebSocket.

  1. THE GATEWAY (the core) A Node.js reverse proxy built on Hono, with Redis (ioredis) for all shared state. Every request goes through one pipeline, and each step is recorded in a trace (with the gate's own time in microseconds) that the console shows live: route match → is this drop at peak? → who is this (World ID session cookie, agent bearer token, or signed partner request) → waiting room / draw / sealed bid / partner hold → pass check → x402 for extra reads → forward to the provider with a signed header.
  • Route matching uses each drop's URL pattern plus query/header conditions (e.g. ?quota=TQ), so only the routes a provider chooses are gated, and only during their peak (a schedule, or automatically when the backend's p95 latency or error rate crosses a threshold).
  • All tokens (sessions, agent tokens, passes, provider assertions) are Ed25519 JWTs made with jose, each with its own "typ" so one can never be replayed as another.
  • The provider gets an X-SurgePass-Assertion header (seats allowed, price, pass id, partner) and verifies it against our JWKS endpoint. The gateway strips any assertion a client tries to send itself.
  • A live WebSocket feed sends sampled decisions plus per-second stats to the console; under a bot flood, bot lines are sampled but every human, agent and Hedera event always gets through.
  1. HEDERA (via the Hiero SDK, @hiero-ledger/sdk)
  • HCS: a topic per drop. Writes go through an async queue so a burst of entries never blocks a request; each entry gets its consensus timestamp and sequence number back.
  • PRNG: when the window closes we write a "window_closed" message containing the seat count and a transaction ID generated in advance, then run the PrngTransaction under exactly that ID. The seed can't exist before the cutoff, and anyone can check the order. The draw is Fisher–Yates using sha256(seed ‖ counter) (@noble/hashes), shared by the gateway and the browser.
  • HTS: each partner quota mints NFT seat tokens with KYC, freeze, wipe and supply keys. Partners associate the token with their own key, we grant KYC, transfer seats in consensus order, wipe used seats after booking, and wipe unused ones back to the public draw.
  • Scheduled transactions: deposit refunds are ScheduleCreate transfers.
  • Mirror node: partner public keys are looked up when they're allowlisted, and the waiting room's "Verify" page downloads the whole topic and recomputes the draw in the browser.
  1. x402 ON HEDERA (@x402/core + @x402/hedera) Paid endpoints answer 402 with x402 v2 payment requirements in HBAR. Clients sign a Hedera transfer with the "exact" scheme, and a public facilitator settles it on testnet. The same path is used for surge-priced availability reads (the price rises with load), agent bid deposits and partner hold deposits.

  2. WORLD ID (@worldcoin/idkit, @worldcoin/idkit-core) The gateway signs a one-time RP request per action (enter:<drop>), with a nonce stored in Redis so it can't be replayed. The waiting room opens the IDKit widget (proof of human, production World App). The gateway verifies the proof with the World Developer Portal's v4 verify API and turns the nullifier into an anonymous ID per drop. Agent approvals reuse the same action, with a signal binding the proof to that agent, the seat count and the max bid. Approvals work like a TV sign-in code: the agent gets a 401 "HumanApproval" with a link, the human approves with World App, and the agent polls for its token.

  3. FRONTENDS (React 19, Vite, Tailwind, framer-motion)

  • The waiting room is built on World's own UI kit (@worldcoin/mini-apps-ui-kit-react), so it looks and feels like World App. It has the live draw reveal, the sealed-bid page and the public "verify this draw" page.
  • The provider console: drop builder, live decision log with step-by-step traces, partner management, side-by-side test runs (agents and partners run as real jobs against a chosen drop), an integration guide, and the bot-flood demo with a canvas "gate view" driven by the gateway's real per-second counts.
  • A landing page and pitch deck from the same app, hosted on Vercel.
  1. AGENTS, PARTNERS AND LOAD
  • A reference AI agent with a CLI and an MCP server (@modelcontextprotocol/sdk), holding its own Hedera account. It asks its human for approval, enters, seals bids and pays x402 by itself.
  • A partner client that signs every request with its Hedera key (timestamp, method, path, body hash).
  • A flood generator (undici) that hits two identical mock booking sites at once (one direct, one behind SurgePass), and a mock provider (Hono) that verifies the assertion in about ten lines.

HOW THE PARTNER TECHNOLOGIES HELPED

  • World ID gave us the one thing a ticket queue has never had: "one entry per real person" without collecting identities. It also made AI agents safe to let in, because every agent traces back to one verified human.
  • Hedera turned "trust us, it was fair" into something anyone can check. Consensus timestamps give a fair order nobody can backdate, the PRNG gives a seed nobody controls, HCS gives a public record, and HTS KYC means a partner seat physically can't be moved to a reseller's account: the network refuses it, not our server. Fast finality and low, fixed fees made it practical to write every entry and settle per-request x402 payments during a rush.
background image mobile

Join the mailing list

Get the latest news and updates