# What is Fairway?

Fairway is a **decentralized compliance infrastructure** for making **KYC/AML checks programmable** across **Cardano, Midnight, and EVM,** without putting PII on-chain.

We store KYC data in **decentralized off-chain storage** (the “Vault”), use a **Fairway Cloud Agent** via API with a **Witness** to generate a **Midnight ZK-proof** *bound to a specific wallet address*, and record that proof on **Midnight’s public ledger**.

A reference to that Midnight proof (the **proof UTXO**) is then **embedded in Merkle trees** on Cardano and/or EVM, alongside Fairway’s signature and the user’s eligibility flags. dApps verify **Merkle membership + Fairway signature + epoch freshness**, and can later **audit** the referenced Midnight UTXO.

***

### Why It Matters

* **For Developers** → add a single eligibility check (Merkle inclusion + signature verify) to your validator/contract.
* **For Institutions** → get auditability (via Midnight proof references) without handling raw PII on-chain.
* **For Users** → prove once, reuse across chains; no document leakage.

***

### How It Works

<figure><img src="https://3812774301-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfDULdwa6BuKx0DZyvBO%2Fuploads%2FLy6idR6LvTNEvLT4gDGr%2Fimage.png?alt=media&#x26;token=d975356b-6c64-40fa-972e-8e45bd16aa76" alt=""><figcaption></figcaption></figure>

**Core components**

* **Vault (decentralized storage)** — holds KYC documents/PII **off-chain**.
* **Cloud Agent** — verifies inputs, runs Witness logic, and **generates ZK-proofs on Midnight** bound to the user’s wallet.
* **Midnight proof UTXO** — immutable record of the ZK result on Midnight’s public ledger.
* **Merkle Trees (Cardano & EVM)** — compact allowlists of **wallet → claims/flags + midnight\_ref**, signed by Fairway.
* **Policy Engine** — dApp-side rule evaluation (YES/NO) based on Merkle membership + epoch freshness.

***

### Merkle Leaf (Cardano/EVM) — canonical fields

```json
{
  "address": "addr1... | 0x...",
  "claims": ["KYC1_OK", "EU_RESIDENT"],
  "midnight_ref": "0x<txid>#<index>",
  "epoch": 391,
  "fairway_sig": "sig(fairway_key, hash(root || epoch || midnight_ref))"
}

```

**Verifier MUST:**

1. Verify **Merkle membership** of `address` with the on-chain root.
2. Verify **Fairway signature** over `(root, epoch, midnight_ref)` using the chain-appropriate key.
3. Enforce **epoch freshness** (revocation).
4. (Optional, for audits) Resolve `midnight_ref` on Midnight to validate provenance.

> EVM note: you can integrate via (A) Merkle allowlist guard or (B) ERC-3643 adapter that internally checks Fairway eligibility. Both carry the midnight\_ref for auditability.

***

### Key Principles

* **No PII on-chain** — only commitments, signatures, and references.
* **Auditability by reference** — every Merkle leaf links to a **Midnight proof UTXO**.
* **Composable** — same proof powers Cardano and EVM integrations.

***
