Recharge

Devcon or ETHGlobal? A sponsor gifts you an eSIM pack; your agent tops up your own plan via x402.

Recharge

Created At

ETHGlobal Mumbai

Project Description

Landing in Mumbai for Devcon, ETHGlobal or a token event with a phone that has no data? Recharge lets the event, a sponsor or a friend gift you an eSIM pack before you even clear immigration. Prove you are one human with World IDKit 4 (Orb or Document credential) and a sponsor's campaign pays for your first bundle (up to 1 GB), once per human per campaign. Anyone can also gift data to your ENS name, or hand you a scratch card at the venue, and you claim it with a signature or the card's PIN. Organizers run ticket-linked event campaigns with per-hour caps, a pause switch and refunds of unspent budget.

Behind the gift: the nullifier becomes a quota key and DataDrop.claim on Hedera EVM pays the sponsor's USDC for that one human; the API orders a 1 GB India eSIM from the reseller, seals the activation code to your session key and keeps only a reference on the ledger (the sealed blob goes to Swarm when a Bee gateway is configured), while the entitlement itself is an Arkiv entity whose expiresIn equals the plan's validity, so it dies by protocol when the plan ends.

When your own paid plan runs low (event packs are gift-only and have no top-ups), you, or an agent, buy 1 GB for $4.00 at a time: the API answers HTTP 402 with x402 v2 accepts (Hedera testnet HTS USDC and Base Sepolia USDC), the payer signs, the facilitator settles, the entity is extended and an HCS receipt is written. An operator-run agent, a Hedera Agent Kit wallet with an HCS-14 UAID, runs the top-up loop for the plans enrolled with it under a policy their owner signed (threshold, daily cap, pause), enforced in code, never by a model; anyone can run services/agent for their own plan.

Live on testnet rails at https://app.recharge.ajudiya.com (API https://api.recharge.ajudiya.com): the traveller PWA, the sponsor console and the agent page, in English, with Hindi and Marathi copy via ?lang=hi or ?lang=mr. docs/DISCLOSURE.md, docs/CHANGELOG.md and docs/AUDIT-REPAIR.md record how the project was built; git log v0-prekickoff..HEAD is the complete dated record.

How it's Made

A pnpm monorepo. services/api is a Hono server with one middleware chain (request id, security headers, CORS, rate limit, idempotency, zod validation, x402, octroi) in front of the routes. packages/octroi is the proof-or-pay engine: credential tiers, bundle sizing, challenges, claim locks, settlement markers, the shouldTopUp rule and gift reclaim, with 447 tests behind a coverage gate. packages/adapters has one port per partner with deterministic mocks for MODE=local and live adapters for MODE=live: World cloud verify v4 with a backend-signed rp_context, the x402.org facilitator (plus a self-run facilitator on Anvil), Arkiv rabdi entities with expiresIn, Swarm for the sealed eSIM activation blob when a Bee gateway is configured, HCS for receipts, ENS through viem, and the eSIM Access reseller API. packages/contracts holds DataDrop.sol (sponsor pools with scoped ids, hourly caps, pause, refund and HTS association) with Foundry fuzz and invariant tests, deployed on Hedera EVM 296. services/agent is the top-up agent: it reads the entitlement straight from Arkiv pinned to a trusted writer, applies the owner-signed policy in code, pays over x402 from a Hedera Agent Kit wallet (HTS USDC, fee payer taken from the facilitator), writes an agent-topup HCS receipt carrying its HCS-14 UAID, and keeps a durable trigger journal so a crash or a lost response never pays twice. apps/web is a Next.js PWA with RainbowKit/wagmi (MetaMask on Hedera EVM, HashPack over WalletConnect for native HTS payments), the sponsor console, scratch-card printing and en/hi/mr copy.

Hacky bits worth knowing: the API serves /plans and /healthz from cache and falls over to a second Hedera JSON-RPC relay per request, because the public relay drops out for forty minutes at a time; reseller usage reports lag hours behind the carrier, so the agent's threshold is a field of the signed policy that the owner can set to 100 % to keep one bundle ahead; the eSIM activation code never touches the ledger (sealed to a session key, Arkiv keeps only the reference); and every live adapter runs offline over fixtures (authored from the vendor docs, plus redacted live recordings for Arkiv, the x402.org facilitator, the Hedera mirror, HCS, ENS and the eSIM Access catalogue), so the whole flow (claim, 402, settlement, webhook, gift, scratch card, expiry, reclaim, agent pass) runs offline in about 23 seconds with pnpm e2e, behind a red-team gate of 67 filed findings.

background image mobile

Join the mailing list

Get the latest news and updates