# Onchain / Offchain Interplay

USD.AI's core innovation is a hybrid legal-and-technical structure that operates simultaneously across two record systems. Neither is complete on its own, and the form documents are engineered so that the two systems remain synchronized at every material event.

#### The Two Layers

**The offchain layer** consists of real-world legal, banking, and physical infrastructure:

* The Delaware SPV (a registered legal entity)
* UCC filings at state filing offices
* Deposit accounts at regulated U.S. banks
* The escrow account at a qualified trust company
* Physical GPU servers in data center facilities
* Insurance policies, tax filings, regulatory compliance
* Executed hard-copy legal contracts with Parent, lenders, data center operators, and service providers

This is where the loan is actually legally enforceable. The offchain layer gives lenders real rights in a real court: perfected liens, priority in bankruptcy, the ability to take possession of servers, the ability to sue for breach.

**The onchain layer** consists of the USD.AI Protocol smart contracts:

* Loan NFTs, Lender NFTs, and Participation NFTs
* The Borrower's onchain smart account wallet (used for all stablecoin inflows and outflows)
* The Onchain Record (the authoritative ledger of loan positions, balances, and payment history)
* The automated payment waterfall and reserve-drawdown logic
* Default freeze and NFT lifecycle controls (mint / freeze / burn)

This is where the loan is transparent, programmable, and composable. The onchain layer gives depositors real-time visibility into performance, automated execution of the waterfall, and a tokenized position that can be held, transferred, or composed into other onchain products.

#### Why Both Layers Are Necessary

The offchain layer exists because:

* GPU servers are physical property; only UCC filings and a true-sale structure can give the SPV enforceable title and the Agent an enforceable first lien
* Bankruptcy remoteness requires a Delaware LLC with an Independent Manager and real-world separateness covenants
* Customer revenue often arrives in U.S. dollars via traditional banking rails; control agreements and a bank-held collection account are how you capture that revenue before it commingles with operator funds
* Real-world compliance (insurance, tax, anti-terrorism, securities law) requires real-world actors
* Smart contracts cannot physically enter a data center; only legal process and executed lien waivers do

The onchain layer exists because:

* Depositors need a liquid, transparent, composable instrument to hold
* Lender position tracking (the "lender register") in a syndicated loan is traditionally a bottleneck; onchain, it becomes a public, tamper-evident record
* Automated waterfall execution and reserve drawdowns remove administrative friction and operational risk from payment processing
* Payment status, collateral status, and default status become publicly verifiable in real time, rather than sitting in private agent reports
* A tokenized collateral position (the Loan NFT) allows onchain parties to interact with a verifiable representation of a real, perfected, legally enforceable loan

#### The Loan NFT: The Bridge Between the Two Layers

The Loan NFT represents:

* The specific GPU collateral securing a given series
* The Agent's first-priority lien on that collateral
* The rights of the lenders and participants to receive payment

The Loan NFT is only minted once every offchain condition is satisfied (servers delivered, installed, tested, liens released) and every onchain condition is satisfied (wallet provisioned, Onchain Record populated). The minting is itself a **closing condition**: escrowed funds cannot be released to pay the Parent until the Loan NFT exists and is recorded. This ensures the onchain and offchain pictures of the deal snap into place at the same instant.

Throughout the life of the loan, the Loan NFT is held and controlled by the Agent, so that onchain control mirrors the offchain collateral agent relationship.

#### Capital Flow: End-to-End

The structure is cleanest when viewed as a sequence of flows that cross the onchain / offchain boundary multiple times:

1. **Depositor capital in (onchain)**: Lenders deposit stablecoin into the USD.AI Protocol. The Protocol mints a Participation NFT and deposits it into the sUSDai vault, representing the pro rata claim to cash flows generated from the relevant financing.
2. **Funding (onchain → offchain)**: The Agent applies the capital onchain to pay closing fees and fund the Reserve Account. The remainder is transferred into an **offchain escrow account** at the Escrow Agent, where it earns a reduced rate pending release.
3. **Escrow release (dual-layer)**: When both sets of conditions are satisfied (offchain: servers delivered, installed, tested, third-party-verified, prior liens released; onchain: Loan NFT minted and Onchain Record updated), the Agent delivers a release instruction. The Escrow Agent releases the escrowed funds offchain to pay the parent for the servers.
4. **Revenue generation (either layer, depending on the customer)**: End customers pay the SPV for use of the servers. Cash payments go to the collection account (offchain); the Borrower is obligated to convert collection account cash into stablecoin and deposit it into the digital wallet in advance of each payment date.
5. **Distribution to lenders (onchain)**: Stablecoin distributions flow through to lenders via the Protocol, verifiable onchain in real time.

#### The Onchain Record as the Authoritative Ledger

The Onchain Record is not a mirror or reporting layer; it is the **authoritative lender register** for the loan. It records:

* Each lender's share of the loan
* Principal outstanding
* Interest accrued and paid
* Required payments due and due dates
* Aggregate outstanding amount across all series
* Payment performance and delinquency status

Absent manifest error, the Onchain Record is determinative evidence of payment status. This replaces the paper lender register that traditionally sits with the agent in a syndicated loan and that historically has been opaque to anyone outside the lender group.

#### Enforcement: Dual-Track Default

On an Event of Default, enforcement runs on both layers simultaneously:

**Onchain (immediate, automatic):**

* The Loan NFT is automatically frozen on the USD.AI Protocol. It cannot be transferred, pledged, or encumbered except as directed by the Agent.
* The Onchain Record is updated to reflect the default and to accrue interest at the default rate.
* The Protocol's automatic distribution logic shifts from the standard waterfall to the acceleration waterfall, with all Collections directed to lenders pro rata until the loan is repaid.

**Offchain (agent-driven, real-world remedies):**

* The Agent accelerates the loan and declares all obligations immediately due.
* The Agent exercises UCC remedies: foreclosure sale, taking possession, private sale.
* The Agent uses the data center lien waivers to enter the facility, disconnect, and remove the servers (or assume the master services agreement in place of the Borrower).
* The Agent can foreclose on the parent's equity in the SPV, taking direct control of the entire enterprise rather than having to enforce against each asset individually.
* The Agent directs all bank accounts (collection account, reserve account) via the control agreements.

**Convergence (onchain reflection of offchain outcome):**

* Once an offchain foreclosure, sale, or other disposition is complete, the Agent permanently burns the Loan NFT on the Protocol by deposting the proceeds from the sale or insurance claim (or combination thereof) to the sUSDai vault.

#### Why This Works

The offchain layer provides enforceability in the real world. The onchain layer provides transparency, programmability, and composability for depositors. The documents are engineered so that:

* Every major state change (funding, release, payment, default, enforcement, close-out) happens in both layers at the same time
* Onchain events are conditioned on offchain performance, and vice versa, so the two records cannot drift apart
* The Agent is a single counterparty with authority in both layers, preventing coordination failure between the legal and technical sides
* Lenders can rely on the onchain record for day-to-day interaction with their position, without giving up any of the protections that come from a real, legally enforceable, first-priority-secured GPU loan
