Prove you qualify. Reveal nothing else.
Brainwave 2026 โ Midnight Blockchain Track
๐ Live Contract ยท ๐ Architecture ยท โ๏ธ Setup ยท ๐ฌ Demo ยท ๐ง How ZK Works
Every year, millions of students hand over their entire academic transcript to employers or universities just to answer a single binary question:
"Do you meet the minimum CGPA requirement?"
This exposes everything โ failed courses, personal grades, irrelevant subjects, retake history โ to a third party who only needed one data point. Traditional systems have no concept of selective disclosure.
Cygnus is a privacy-preserving academic credential system built on the Midnight Network, the first blockchain with native privacy built into the consensus layer.
Using Zero-Knowledge cryptography and Compact smart contracts, Cygnus enables a paradigm shift:
| Role | What They Do | What They Reveal |
|---|---|---|
| ๐๏ธ University (Issuer) | Signs & publishes a cryptographic commitment of the student's grade | Only a hash. Raw grade stays off-chain. |
| ๐ Student (Holder) | Generates a ZK proof locally that grade โฅ threshold | Nothing. Proof is computed entirely on-device. |
| ๐ข Employer (Verifier) | Reads the on-chain verified status | Only PASS or FAIL. Never sees the grade. |
The core of Cygnus is a ZK circuit written in Compact โ Midnight's purpose-built smart contract language. Here is the end-to-end cryptographic lifecycle:
sequenceDiagram
autonumber
actor University
actor Student
actor Employer
participant API as Attestation API<br/>(Off-Chain)
participant Contract as Midnight Smart Contract<br/>(On-Chain Ledger)
participant ProofServer as Local Proof Server<br/>(Docker Container)
University->>API: POST /sign-credential {studentId, cgpa, threshold}
API->>API: HMAC-SHA256 sign credential hash
API-->>University: { credentialHash, signature }
University->>Contract: issueCredential(credentialId, commitmentHash)
Contract-->>University: โ
Commitment stored on ledger
Note over Contract: Only the HASH lives on-chain.<br/>Raw CGPA never stored.
Student->>ProofServer: Generate ZK Proof (private: cgpa, witness)
ProofServer->>ProofServer: Run Compact ZK circuit locally
ProofServer-->>Student: ZK Proof object (verifiable, non-revealing)
Student->>Contract: proveEligible(credentialId, proof)
Contract->>Contract: Verify proof against on-chain commitment
Contract-->>Student: โ
On-chain status โ ELIGIBLE
Employer->>Contract: checkEligibility(credentialId)
Contract-->>Employer: โ
PASS (grade never disclosed)
graph TB
subgraph Client["๐ฅ๏ธ Client Layer"]
FE["โ๏ธ React + Vite<br/>DApp Frontend<br/>(localhost:5173)"]
LACE["๐ Midnight Lace<br/>Chrome Wallet Extension"]
end
subgraph Backend["๐ ๏ธ Backend Layer"]
API["๐ก Express Attestation API<br/>(localhost:4000)<br/>HMAC-SHA256 Signing"]
PS["๐ณ Proof Server<br/>Docker Container<br/>(localhost:6300)<br/>ZK Circuit Execution"]
end
subgraph Blockchain["๐ Midnight PreProd Network"]
CONTRACT["๐ Compact Smart Contract<br/>credential.compact<br/>issueCredential()<br/>proveEligible()<br/>checkEligibility()"]
LEDGER["๐ On-Chain Ledger<br/>Stores only:<br/>โข Commitment Hashes<br/>โข ZK Verification Status"]
INDEXER["๐ PreProd Indexer<br/>rpc.preprod.midnight.network"]
end
FE -->|"REST calls"| API
FE -->|"Wallet connect / sign tx"| LACE
FE -->|"ZK proof generation"| PS
LACE -->|"Submit signed transactions"| INDEXER
INDEXER -->|"Block sync / state queries"| CONTRACT
CONTRACT --> LEDGER
style Client fill:#1e1e2e,color:#cdd6f4
style Backend fill:#181825,color:#cdd6f4
style Blockchain fill:#11111b,color:#cdd6f4
Cygnus/
โ
โโโ ๐ contract/ # Compact smart contract
โ โโโ src/
โ โ โโโ credential.compact # ZK circuits: issue, prove, verify
โ โ โโโ managed/ # Compiled keys & TypeScript bindings
โ โโโ package.json
โ โโโ tsconfig.json
โ
โโโ ๐ก api/ # Express Attestation API (off-chain signer)
โ โโโ src/
โ โ โโโ server.ts # Route handlers (POST /sign-credential)
โ โ โโโ index.ts # Server entrypoint
โ โโโ .env.example
โ โโโ package.json
โ
โโโ โ๏ธ frontend/ # React + Vite DApp
โ โโโ src/
โ โ โโโ components/
โ โ โ โโโ ConnectWallet.tsx # Midnight Lace wallet connector
โ โ โ โโโ IssuerPanel.tsx # University credential issuance UI
โ โ โ โโโ StudentWallet.tsx # Student ZK proof generation UI
โ โ โ โโโ VerifierPanel.tsx # Employer verification panel
โ โ โโโ contexts/
โ โ โ โโโ MidnightContext.tsx # Global wallet & contract state
โ โ โโโ App.tsx
โ โ โโโ main.tsx
โ โ โโโ styles.css # Glassmorphism dark theme
โ โโโ package.json
โ
โโโ ๐ง cli/ # CLI deployment utilities
โ โโโ src/deploy.ts # Network config & node mapping
โ
โโโ ๐ preprod-deploy/ # Midnight deployment runner
โ โโโ contracts/ # Template hello-world contract
โ โโโ src/
โ โ โโโ setup.ts # Wallet init, sync, faucet detection
โ โ โโโ deploy.ts # Contract deployment logic
โ โ โโโ wallet.ts # Wallet & DUST token management
โ โโโ docker-compose.yml # Local Midnight proof server
โ โโโ .midnight-state.json # Deployed contract address (gitignored)
โ
โโโ package.json # NPM Workspaces root
โโโ README.md
โโโ DEMO.md # Hackathon demo script
Cygnus is live on the public Midnight PreProd Network:
| Field | Value |
|---|---|
| ๐ Network | Midnight PreProd Testnet |
| ๐ Contract Address | 53fe8fbc9c9cf5477266d6bf60e8be66525016d55a5e69bddf2a5bf2c3d6b3e1 |
| ๐ Deployer Wallet | mn_addr_preprod1vc393m7q2n60... |
| ๐ Deployed At | 2026-08-22T14:26:08 UTC |
| ๐ RPC Endpoint | wss://rpc.preprod.midnight.network |
| ๐ Indexer | https://indexer.preprod.midnight.network/api/v1/graphql |
Ensure the following are installed:
| Tool | Version | Link |
|---|---|---|
| Node.js | v22+ | nodejs.org |
| npm | v11+ | Bundled with Node.js |
| Docker Desktop | Latest | docker.com |
| Compact Compiler | v0.31.1+ | Midnight Docs |
| Chrome Browser | Latest | For Midnight Lace Wallet |
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
source ~/.zshrc
compact update
compact --version # Should print 0.31.1 or highergit clone https://github.com/AdeshDeshmukh/Cygnus.git
cd Cygnus
npm install # Installs all workspaces: contract, api, frontend, cliEnsure Docker Desktop is running, then start the proof server:
docker run -d \
-p 6300:6300 \
midnightntwrk/proof-server:8.1.0 \
midnight-proof-server -vcd contract
npm run compact # Compiles ZK circuits, generates proving keys & TS bindings
npm run build # TypeScript build
cd ..cd api
cp .env.example .env # Configure HMAC signing secret
npm run dev # Starts on http://localhost:4000cd frontend
npm run dev # Starts on http://localhost:5173Once all services are running, open http://localhost:5173 in Chrome.
flowchart LR
A["๐ Connect Wallet\nMidnight Lace\nPreProd Network"] --> B
B["๐๏ธ UNIVERSITY PANEL\nEnter Student ID\nEnter CGPA: 8.7\nThreshold: 8.0\nClick: Issue Credential"] --> C
C["โ๏ธ On-Chain\nCommitment Hash\npublished to\nMidnight Ledger"] --> D
D["๐ STUDENT PANEL\nEnter Credential ID\nEnter private CGPA: 8.7\nClick: Generate ZK Proof"] --> E
E["๐งฎ Local ZK Circuit\nRuns via Proof Server\nProof generated\n(grade never leaves browser)"] --> F
F["โ
EMPLOYER PANEL\nEnter Credential ID\nClick: Verify\nResult: ELIGIBLE"] --> G
G["๐ Privacy Preserved\nEmployer learns:\nOnly PASS / FAIL\nNever raw grade"]
style A fill:#6A0DAD,color:white
style B fill:#1e3a5f,color:white
style C fill:#0f4c35,color:white
style D fill:#1e3a5f,color:white
style E fill:#4a1f5f,color:white
style F fill:#0f4c35,color:white
style G fill:#1a1a2e,color:#a78bfa
Midnight is the only blockchain where privacy is a first-class primitive at the protocol level. Unlike Ethereum with opt-in privacy tools, Midnight distinguishes between public (on-chain) and private (off-chain, shielded) state natively in its smart contract execution model.
Compact is Midnight's purpose-built language that compiles directly to ZK circuits. It treats all function arguments as private witnesses by default, requiring explicit disclose() annotations for any data that should flow onto the public ledger. This makes it impossible to accidentally leak private data on-chain.
The HMAC-SHA256 signing step in the Attestation API serves as an institutional trust anchor. It binds the University's server-side secret key to the credential hash, meaning only the legitimate university can issue credentials. This prevents students from fabricating their own commitments.
Midnight uses a two-token model โ NIGHT for transaction fees and DUST for shielded, privacy-preserving operations. ZK proof submissions happen in the DUST layer, ensuring that even the act of submitting a proof does not link the student's public identity to the transaction on the transparent layer.
| Property | Status | Mechanism |
|---|---|---|
| Grade Confidentiality | โ Guaranteed | ZK proof: grade never leaves student's browser |
| Commitment Integrity | โ Guaranteed | HMAC-SHA256 institutional signature |
| Proof Soundness | โ Guaranteed | Compact ZK circuit verifies witness matches hash |
| Non-Repudiation | โ Guaranteed | On-chain immutable commitment timestamp |
| Verifier Privacy | โ Guaranteed | Employer only reads on-chain boolean flag |
| Replay Prevention | โ Guaranteed | Credential IDs are unique per issuance |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CYGNUS STACK โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Blockchain โ Midnight Network (PreProd Testnet) โ
โ Smart Contract โ Compact v0.31.1 (ZK Circuit Language) โ
โ ZK Proofs โ Compact-generated WASM proving keys โ
โ Proof Server โ Docker: midnightntwrk/proof-server:8.1.0 โ
โ Frontend โ React 18 + Vite + TypeScript โ
โ Wallet โ Midnight DApp Connector + Lace Extension โ
โ API Backend โ Express.js + TypeScript (HMAC-SHA256) โ
โ Build Tools โ npm Workspaces + tsx + tsc โ
โ Deployment โ create-mn-app PreProd template โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MIT ยฉ 2026 Adesh Kishor Deshmukh โ See LICENSE for details.