# Zero-Knowledge Proofs (Midnight)

### Flow

<figure><img src="/files/MAK0h05cZkY3t1qYdD7p" alt=""><figcaption></figcaption></figure>

***

### What’s Proven in the Circuit

* The user’s **KYC data** satisfies required rules (e.g., `KYC2_OK`, jurisdiction).
* The proof is **bound to a specific wallet address**.
* The proof is linked to a **timestamp of KYC verification** (`kyc_verified_at`).
* The proof is **anchored on Midnight** as an immutable reference (`midnight_ref`).
* Cross-chain (Cardano/EVM) contracts only verify **Merkle membership, Fairway sig, sanctions\_epoch, and KYC recency** — no raw PII.

***

### Verifier Checklist (Cardano/EVM)

* ✅ Verify **Merkle membership** for `address`.
* ✅ Verify **Fairway signature** over `(root, sanctions_epoch, midnight_ref)`.
* ✅ Enforce **KYC recency** → `now - kyc_verified_at ≤ max_age`.
* ✅ Enforce **sanctions freshness** → `sanctions_epoch == latestEpochRoot`.
* ⬜ Optional audit: **resolve `midnight_ref`** on Midnight for regulator review.

***

### Notes on Keys & Curves

* **Fairway signature** uses chain-appropriate keys:
  * secp256k1 for EVM chains.
  * Cardano-compatible key for UTXO scripts.
* Midnight Compact supports Schnorr signatures inside circuits.
* On-chain verifiers don’t recompute the ZK — they only check Fairway’s signature + Merkle inclusion.

***

### Next Steps

* See [Build on Cardano](https://fairway.gitbook.io/docs/~/revisions/2bV85LKrNLQL0C6MEOcr/developers/build-on-cardano) → validator checks for Merkle, timestamp, and sanctions epoch.
* See [Build on EVM](https://fairway.gitbook.io/docs/~/revisions/2bV85LKrNLQL0C6MEOcr/developers/build-on-evm) → attestation schema with `kyc_verified_at` + `sanctions_epoch`.
* Review[ Revocation Epochs & Freshness](https://fairway.gitbook.io/docs/~/revisions/2bV85LKrNLQL0C6MEOcr/developers/core-concepts/revocation-epochs-and-freshness) → how long-term KYC vs short-term sanctions are combined.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fairway.global/developers/core-concepts/zero-knowledge-proofs-midnight.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
