v0.1.0npm install →

Architecture

System Architecture

Auron is structured as five independent layers. Each is replaceable without touching the others — the blockchain is infrastructure, not the product.


Layers

AI LayerClaude Sonnet · natural language → structured payment action
Financial OrchestrationQuote engine · routing · preflight · liquidity gate
Stablecoin Settlement LayerOn-chain verification · state machine · ledger · workers
Blockchain NetworksSolana (primary) · chain-independent design
Local Financial RailsOnMeta (primary) · Razorpay X (fallback) · UPI

Settlement lifecycle

Every payment moves through a deterministic, persisted state machine. No payment skips a state. No settlement fires on an unverified transaction.

initiatedPayment record created
quotedFX rate locked for 60 s
signedUser approved in Phantom
verified7-step on-chain hard gate passed
routingProvider selected — OnMeta or Razorpay
settlingPayout dispatched to provider
completedUTR received · merchant paid · terminal ✓
failedTerminal ✗ · triggers auto-refund if eligible
refund_pendingUSDC return queued
refundedUSDC returned on-chain · terminal ✓

Every transition is atomic (both transactions and status_history update together), immutable (history rows are never updated or deleted), and recoverable (failure classification determines retry, provider switch, or auto-refund automatically).


Internal ledger

Auron maintains a financial ledger independent of blockchain state — the same pattern used by Stripe, Razorpay, and Wise to manage payment state across unreliable external systems.

Blockchain finality ≠ settlement finality. A confirmed Solana transaction does not mean a merchant received INR.

transactionsSingle source of truth for every payment intent — created at phase 1, updated through all 14 states
settlementsOne row per attempt. Tracks: provider, payout ID, UTR, failure stage, retry count
status_historyAppend-only audit trail — every state transition with timestamp and reason. Never updated or deleted
NOTE
Row-level security is enabled on all three tables. All writes go through the service role key on server-side routes — the client never touches the ledger directly.

Replayable receipts

Every completed payment produces a cryptographically verifiable receipt. The receipt_hash is a SHA-256 of canonical fields — anyone can independently recompute it and verify Auron's records have not been altered.

json
{
  "payment_id": "pay_8x92kL",
  "on_chain_hash": "5KtPxQ...wR2",
  "usdc_amount": 5.41,
  "inr_amount": 450,
  "fx_rate": 83.18,
  "merchant_upi": "merchant@paytm",
  "utr": "YESB178011620946032853",
  "receipt_hash": "sha256:a3f9...",
  "audit_trail": [
    { "state": "initiated",  "at": "T+0.0s" },
    { "state": "verified",   "at": "T+2.1s" },
    { "state": "settling",   "at": "T+2.4s" },
    { "state": "completed",  "at": "T+14.2s" }
  ]
}

Receipts are available at GET /api/receipt/:paymentId — permanently, without authentication.


Failure & recovery

When a settlement fails, the failure system answers three questions automatically — no manual intervention required.

01
What category is this?

14 pattern-matched failure categories: invalid UPI, timeout, rate limit, 5xx, FX expiry, slippage, insufficient balance, duplicate signature, and more.

02
Can we recover?

Retry with exponential backoff (5s → 15s → 45s), switch to fallback provider (OnMeta → Razorpay → manual), or queue for operator review.

03
Should we refund?

Auto-triggers USDC return to user's wallet on terminal failures — on-chain, verifiable, receipted.

Additional guards

Price guardIf FX rate moves >150 bps between quote and settlement → auto-refund
Quote expiryServer-side TTL check before every settlement attempt — 60 s hard limit
Stuck payment detectorpayment in settling >30 min → flagged · processing >10 min → reset to pending
Signature replaySettled signature stored in KV — re-submission returns 409 before touching Razorpay

Liquidity model

Every payment goes through a pre-payment liquidity gate before a Solana transaction is even built.

ts
C8F135">"color:#3F3F46">// Pre-payment gate — checked BEFORE Phantom is invoked
const MIN_RESERVE_USDC   = 50        C8F135">"color:#3F3F46">// always keep in treasury
const MAX_IN_FLIGHT_USDC = 10_000    C8F135">"color:#3F3F46">// max concurrent exposure
const MAX_PAYMENT_USDC   = 5_000     C8F135">"color:#3F3F46">// per-transaction cap
const MIN_PAYMENT_USDC   = 0.5       C8F135">"color:#3F3F46">// minimum viable payment

C8F135">"color:#3F3F46">// Decision:
C8F135">"color:#3F3F46">// amount < 0.5 USDC                    → reject
C8F135">"color:#3F3F46">// amount > 5,000 USDC                  → reject
C8F135">"color:#3F3F46">// treasury < (reserve + amount)        → reject (503)
C8F135">"color:#3F3F46">// inFlight + amount > 10,000           → reject
C8F135">"color:#3F3F46">//                                      → ALLOWED

Reserve alerts fire at 2× minimum. Critical alert at 1× minimum. Both are surfaced at GET /api/stats. In-flight USDC is tracked across all non-terminal payments in the Zustand store and cross-checked against the Supabase ledger.


Settlement providers

PATH AOnMeta (primary)~20 s · 0.5%

USDC → INR directly. Requires KYB.

PATH BRazorpay X (fallback)~15 s · 0.99%

INR float → UPI. Requires RazorpayX KYB.

PATH CManual review24–48 h ·

Triggered when both providers fail or amount > $25K.