AI agents hold crypto; Indian shops need rupees. Sangam bridges them. A merchant proves who they are with Self (zero-knowledge KYC) and gets an ENS name holding its price, payout address and UPI ID. A buyer's agent finds the shop by that name and pays USDC, over x402 on Hedera or from the buyer's own MetaMask within a spending cap they set. Before paying, the agent checks the invoice against ENS, so a hacked checkout can't overcharge. Sangam then verifies the payment on-chain, 0G decides whether to pay out or hold and refund, the merchant gets INR on UPI through Cashfree, and a hash-chained receipt is written to Hedera Consensus Service for anyone to audit.
Sangam is built as a TypeScript monorepo: one Next.js 16 app (apps/web) plays every role — the merchant's x402 paywall, the settlement pipeline, the dashboards and the identity desk — with small packages for each integration (hedera, ens, og, ondc, mcp).
- Payment (x402 + Hedera): The merchant API serves HTTP 402 challenges with the @x402/* SDK (Hedera exact scheme, Blocky402 facilitator). The buyer agent reads the challenge, signs a USDC transfer with @hiero-ledger/sdk, and retries — no approvals, no deposit flow.
- Settlement pipeline: Every payment is confirmed against the Hedera Mirror Node (with retries for lag), then 0G Compute (@0gfoundation/0g-compute-ts-sdk) makes the payout-vs-hold decision. On hold — underpayment, or an ONDC order the seller never accepted — the USDC refund is a Hedera ScheduleCreateTransaction with no admin key: once created, nobody, including Sangam, can change or cancel it. On payout, RazorpayX pays the merchant INR over UPI.
- Tamper-evident receipts: Each HCS receipt carries prev — the sequence number and sha256 of the receipt before it. The dashboard replays the topic from the Mirror Node, not our own files, and checks every link: drop or reorder one receipt and the chain breaks visibly.
- Discovery & identity: Merchants are onboarded onto ENSv2 (Sepolia) — Sangam issues <label>.sangam.eth subnames, and each product gets its own subname holding its price and payout accounts; the storefront is rebuilt from ENS alone, so the chain is the database. The agent cross-checks every invoice against ENS before signing (shop verified, payouts match, bill ≤ ENS price). Identity uses the Self offchain SDK: a zero-knowledge proof from the Aadhaar QR or passport; our backend learns only the disclosed fields, and stores just the proof's nullifier.