Building a Privacy-Preserving Custodian App with Selective Disclosure
Learn to construct custodial asset management systems using zero-knowledge proofs. Implement selective disclosure to prove claims without revealing underlying data.
Overview
This comprehensive guide demonstrates how to construct a custodial asset management system using Midnight Network's privacy features and zero-knowledge proofs. The article covers the complete development cycle from contract design through frontend integration.
Core Concepts
Selective Disclosure enables users to verify specific claims about their data without exposing underlying information. Examples include proving account balance exceeds a threshold without revealing the exact amount, or demonstrating KYC completion without sharing personal documents.The custodian model traditionally requires entities to either fully reveal client information or provide no verifiability. Midnight's approach resolves this tension by allowing custodians to prove claims about client assets while keeping sensitive details private.
Key Use Cases
The article outlines five primary applications:
- Proof of Reserves - Exchanges demonstrate sufficient asset coverage without revealing individual balances
- Accredited Investor Verification - Investment platforms confirm accreditation status without collecting sensitive financial documents
- Credit Scoring - Lenders verify creditworthiness without accessing complete financial history
- Regulatory Compliance - Demonstrate AML/KYC adherence while maintaining client privacy
- Asset Verification - Prove specific asset ownership without disclosing full portfolios
Technical Architecture
The system comprises four primary layers:
- Public Ledger State - Records account existence, verification status, and proof validity
- Private State - Stores actual balances, personal data, and asset holdings
- ZK Circuits - Generate cryptographic proofs without revealing private information
- Verification Functions - Allow auditors to validate proofs independently
Smart Contract Implementation
The Compact language contract manages:
- Account registration and status tracking
- Deposit/withdrawal operations with privacy preservation
- KYC and accreditation verification
- Multiple selective disclosure circuits for different claim types
Key circuits include:
- Balance Threshold Proof - Verify balance exceeds specified amount
- Range Proof - Confirm balance falls within defined boundaries
- Tier Proof - Demonstrate account tier based on asset thresholds
- Combined Eligibility Proof - Multi-factor verification combining KYC and balance requirements
Frontend Integration
The React dashboard provides:
- Account overview with privacy controls
- Proof generation interface for various disclosure types
- Historical tracking of generated proofs
- Proof verification component for auditors
Users can generate proofs through an intuitive interface without exposing underlying financial data.
Testing and Deployment
The development process includes comprehensive test coverage for account management, KYC verification, and selective disclosure circuits. Deployment utilizes Compact compiler version 0.27.0 with Docker containerization.
Security Considerations
The architecture maintains a critical principle: Your sensitive financial data is encrypted and stored privately. Only you can generate proofs about your data, and you control exactly what information is disclosed.