Udhaar

Invoices become Hedera tokens: suppliers get paid today and pay their own suppliers with them

Udhaar

Created At

ETHGlobal Mumbai

Project Description

Udhaar is invoice financing for Indian small businesses (MSMEs), built on Hedera.

THE PROBLEM A small supplier like Ramesh sells cement to a big construction company, then waits 60 to 90 days to get paid, even though the law says 45. Meanwhile he still has to pay his workers and his own suppliers. Banks rarely lend to him without collateral, and today’s invoice-discounting platforms only reach the first supplier in the chain, never the sand supplier or truck driver below him.

HOW UDHAAR WORKS

Ramesh uploads an invoice with a signed e-invoice. Its fingerprint is written to a public Hedera Consensus Service (HCS) registry, so the same invoice can never be financed twice. The buyer confirms on-chain, with its own key, that it owes the money. That confirmation is the investor’s real guarantee. The invoice becomes an ATS bond (Hedera’s Asset Tokenization Studio): for example 100 units of ₹1,000, maturing on the due date, allowlist-only so only KYC-approved accounts can hold it. Investors buy units at a discount priced by the buyer’s grade and days to maturity (Grade A, 12% a year, 90 days = ₹970.41 per unit), paying in uINR, our rupee test stablecoin on HTS. Ramesh is paid today. The new part: Ramesh can pay his own suppliers with the same tokens, so financing reaches the whole supply chain. On the due date the buyer pays once. A Hedera Scheduled Transaction can pre-sign this so it runs automatically. Every holder’s units are burned first, then each is paid ₹1,000 per unit.

TRUST Before buying, investors see a 300-900 Udhaar Trust Score for the seller and the buyer. Payment history comes from real repayments recorded on Hedera; GST registration, the e-invoice signature, the buyer’s confirmation, duplicate checks and late-payment signals are shown as a checklist with HashScan proof. New companies are capped at ₹1 lakh per invoice until they have repaid on time three times. KYC approval includes a wallet check on the mirror node. A daily NAV per token is published to an HCS topic.

AI AGENT (x402) Investors can run an auto-invest agent. It pays ₹1 per risk report using x402, settled on Hedera, buys invoices that pass its rules, skips fraud, and logs every payment and decision to an HCS audit topic. Its budgets and limits are enforced in code.

HEDERA SERVICES ATS bonds (issue, allowlist, transfer, freeze, pause, redeem), HTS (uINR with a 1% protection-pool custom fee and fee-free repayments), HCS (registry, confirmations, NAV feed, agent audit), Scheduled Transactions (automatic repayment), the mirror node, x402 via the official facilitator, and a read-only HashPack connection. We also contributed a server-side signing guide back to ATS (PR #1412).

Everything on Hedera is real testnet activity; the GST registry, e-invoice signer and credit bureau data are clearly labelled mocks of production integrations.

How it's Made

Stack. Backend: Node.js + TypeScript + Express, using the Hedera SDK (@hiero-ledger/sdk) and ethers.js. Frontend: Next.js 16 + React + Tailwind v4, with GSAP and Lenis for the scroll-driven “invoice splits into 100 tokens” animation, styled as an Indian bahi-khata ledger. Everything trust-critical lives on Hedera testnet; the backend keeps working state in a JSON store with idempotency keys so no step can run twice.

ATS without a wallet (hacky). The ATS SDK only signs through wallets, which doesn’t work for a backend. So we call the ATS v8 bond contracts directly: ABI-encode with ethers.js, send with ContractExecuteTransaction, assign roles (issuer, control list, pauser, freeze manager, maturity redeemer) at deploy time, and read results and events from the mirror node. The documented factory and resolver addresses were stale, so we found the working v8 deployment ourselves. We wrote this up and contributed it back to ATS as a guide (PR #1412). An invoice maps neatly to a zero-coupon bond: bought at a discount, redeemed at face value on the due date.

uINR and the fee trick (hacky). Custom fees can’t attach to ATS tokens, so we created our own rupee stablecoin on HTS with a 1% fractional fee to an investor-protection pool. To make repayments fee-free, we added a second, zero-charge fee row whose collector is the REPAYMENT account. HTS exempts fee collectors, so money into and out of REPAYMENT pays no fee, without any special code.

Repayment: burn first, then pay. When the buyer pays, the backend snapshots holders, burns each holder’s units with fullRedeemAtMaturity, then pays ₹1,000 per unit. It’s crash-safe and idempotent. A nasty gotcha: in ATS v8 a freeze emits the same Transfer(holder → 0x0) event as a burn, so we confirm burns with the RedeemedByPartition event instead.

Scheduled Transactions. At bond issue, the buyer pre-signs a scheduled uINR repayment that Hedera executes at maturity. We probed the network limit on testnet (61.5 days worked, 63 failed), so longer invoices get their schedule created by a watcher once maturity is within about 62 days. Manual repay waits while a schedule is pending, so nobody can pay twice.

HCS as the trust layer. Separate topics for the invoice-fingerprint registry (duplicate guard), buyer confirmations signed with the buyer’s own key, a daily NAV feed per bond, and a tamper-evident audit log of every agent payment and decision.

x402. The risk report is an x402-protected endpoint (@x402/core + @x402/hedera, official facilitator). It settles in uINR, so the HTS custom fee automatically splits revenue: ₹1.00 to the risk agent, ₹0.01 to the pool. The facilitator pays the HBAR fee, and the server verifies each settlement on the mirror node to stop replays. The auto-invest agent discovers the endpoint, pays within budgets enforced in code, and stops if it can’t write to its HCS audit log first.

Trust and compliance. GSTIN validation with the official checksum plus a registry lookup, and an ES256-signed e-invoice that mimics the government IRP’s signed QR (a mock signer, clearly labelled). A 300–900 trust score where payment history is computed from on-chain repayments on the mirror node, and a KYC wallet check of account age and counterparties.

Why Hedera helped. Fixed, tiny fees make ₹1 micropayments and per-invoice HCS messages practical; ATS gave us compliance controls (allowlist, freeze, pause, redemption) out of the box; Scheduled Transactions let the repayment run itself; and the mirror node made every claim verifiable on HashScan.

background image mobile

Join the mailing list

Get the latest news and updates