> For the complete documentation index, see [llms.txt](https://docs.fairway.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fairway.global/~/revisions/xqNJ6bTRIwH1epmr6yrr/developers/core-concepts/zero-knowledge-proofs-midnight.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
