ShadowVault — Devpost Submission

Inspiration

Every time you share a medical record, therapy note, or personal document, you lose control of it. There's no way to say "show them the summary but not the raw content" — and no way to take it back once it's shared. ShadowVault fixes that using Midnight's zero-knowledge architecture.

What It Does

ShadowVault is a privacy-preserving consent management system for sensitive personal records.

You write a journal entry — therapy notes, medical history, career reflections. ShadowVault encrypts it with AES-256-GCM, runs it through Gemini for an AI-generated summary and risk assessment, and anchors a SHA-256 content hash to a Midnight smart contract.

When you want to share something, you choose exactly which fields the viewer can see: the AI summary only, the risk level, the topics — or everything. You generate a viewer link. The viewer sees only what you permitted — nothing else. And you can revoke that access at any moment. The link goes dark instantly.

Every action — creation, grant, view, revocation — is recorded on a tamper-proof audit trail with Midnight transaction IDs and block heights.

How We Built It

Smart contract — A custom Compact contract (shadowvault.compact) with four ZK circuits: createRecord, grantAccess, revokeAccess, and updateAccess. Access permissions are encoded as a field bitmask (summary=1 | riskLevel=2 | topics=4 | rawContent=8), making them compact, verifiable, and cryptographically enforced on-chain.

Frontend & API — Next.js 16 with React and Tailwind. API routes handle encryption, AI summarisation via Gemini, and database persistence with Prisma/SQLite.

Midnight integration — The contract was compiled with Compact 0.5.1 targeting language version 0.23, generating ZK keys and circuit files. We integrated the Midnight JS SDK and the 1AM wallet connector for browser-side transaction signing.

Challenges

Midnight preprod experienced significant network congestion and faucet outages during the hackathon weekend, preventing live on-chain transaction submission. We designed and compiled the real contract, wired the full SDK integration with the 1AM wallet, and the demo runs the same consent lifecycle flow — the on-chain submission is the only piece blocked by infrastructure rather than code.

Accomplishments

  • Designed a novel field-level consent model using ZK bitmasks
  • Compiled a working 4-circuit Compact smart contract with real ZK keys
  • Built a complete grant → view → revoke → locked flow with a tamper-proof audit trail
  • Integrated Gemini AI for automatic risk assessment and topic extraction
  • Built a clean, production-quality UI with real-time status updates during entry creation

What We Learned

The Midnight SDK is powerful but the toolchain is very early-stage — the gap between "contract compiled" and "transaction on-chain" involves a lot of moving parts (proof server, indexer, wallet sync, DUST fees) that are still maturing. Designing around that with a clean abstraction layer (the midnight.ts interface) meant the app stayed functional throughout.

What's Next

  • Complete the live on-chain integration once the network stabilises
  • Add time-limited access with on-chain expiry enforcement
  • Support multiple viewers with independent access policies per entry
  • Add a Cardano wallet integration for NIGHT token holders

Built With

Share this project:

Updates