Welcome to the Zero Knowledge proof-based Identity Verification solution by Brick Towers. This platform is built on Midnight Blockchain ZK technology and showcases privacy-preserving identity attribute verification for real-world applications.
Brick Towers Midnight Identity is a privacy-focused identity verification solution that leverages Zero-Knowledge proofs to enable secure verification of personal information without revealing the actual data. The system allows users to provide proof of age or other identity attributes while maintaining complete privacy of their personal information.
- π‘ Midnight Wallet Integration: Users can link their identity credentials to their Midnight wallet
- π‘ Decentralized Identity Management: Users own and control their identity credentials
- π‘ Privacy-Preserving Identity Verification: Verify age and other identity attributes without exposing the actual data to 3rd parties
- π‘ Secure Signature Verification: Cryptographic signatures of trusted issuers ensure the authenticity of identity claims
- π‘ Integration with Midnight Blockchain: Built on top of Midnight's Zero-Knowledge infrastructure
- π‘ Practical Use Cases: Real-world demonstration through an age-gated wine shop application
- React Frontend: Modern UI built with React and Material-UI
- π‘ Faucet: Obtain tBTC directly from the game page.
- π‘ Wallet Feedback: Detailed feedback on wallet connection status.
- π‘ Transaction Feedback: Step-by-step updates during transaction processing.
- π‘ Error Handling: Clear error messages for common issues.
- π‘ Retry Logic: Resilience against transient failures in public providers.
- π‘ State Recovery: Improved state recovery mechanism for transient failures and browser reloads.
- π‘ Firebase: Signature registry changes are published to Firebase.
- π‘ Indexer: Indexer is monitoring the blockchain using Midnight indexer and publishes information about relevant signature registry changes.
- π‘Signing Key Registration: Users can register their signing keys on the blockchain
- π‘Identity Verification: Verify user's age without revealing the actual date of birth
- π‘Signature verification: Verify ecliptic curve signatures of identity claims
- π‘Coin Payments: Users can pay for orders using tBTC coins
- π‘Modularization: Use modules for cryptographic functions
The repository includes a complete demonstration of the identity verification system through a wine shop use case:
- Identity Verification: Users only share their private data and verify their identity with a trusted Identity Provider (IDP)
- Age Verification: The wine shop verifies the user is at least 21 years old without seeing their actual date of birth or any other personal information
- Secure Transactions: Orders are processed with both payment and age verification in a single transaction, ensuring that only valid orders are registered
- Privacy Protection: All sensitive data remains private, with only the necessary proofs shared on-chain
The solution consists of several components working together:
Challenge: Midnight Lace Wallet does not expose an API to neither to sign custom messages, nor derive signing keys from the wallet seed. This makes it impossible to sign messages with the wallet key directly.
Solution: The signing key registry contract allows users to link their wallet address to a signing key. This key can be used to sign messages and verify the authenticity of the user's identity.
The identity provider provides an API service for users to privately verify their identity. The identity provider issues signed verifyable credentials containing identity attributes, which can be used for verification in other applications.
- Shop Contract: Handles orders and age verification
- Shop API: Interfaces between the Web UI and the shop backend
- Shop UI: User interface for browsing and ordering wines
The system operates through the following workflow:
- Key Generation: User generates a signing key pair and stores it privately
- Key Registration: User registers their signing public key on the blockchain, linking it to their wallet address
- Identity Document Submission: User submits identity documents (ID, proof of life video) to the Identity Provider
- Credential Issuance: Identity Provider verifies documents and issues a signed credential containing identity attributes
- Product Selection: User browses and selects wines in the shop UI
- Order Creation: User creates an order with selected products and submits the details to the shop using an API
- Age Verification: The contract privately verifies the user is over 21 and generates a ZK proof
- Payment Processing: User submits a single transaction including the payment and the ZK proof
- Order Fulfillment: Upon successful verification and payment, the order is confirmed
sequenceDiagram
actor User
participant Signature DApp
participant Signature Contract
participant IDP as Identity Provider
participant Shop DApp
participant Contract as Shop Contract
%% Identity registration phase
User->>Signature DApp: 1. Connect wallet
Note over User: 2. Generate signing key pair<br/>Store privately
User->>Signature Contract: 3. Register wallet & signing public keys
Note over IDP: 4. Generate signing key pair<br/>Publish public key
IDP->>Signature Contract: Register IDP public key
%% Identity verification phase
User->>IDP: 5. Submit identity documents<br/>(ID, proof of life video)<br/>Signed with signing key
IDP->>Signature Contract: Verify signature & resolve keys
IDP->>User: 6. Issue signed credential<br/>(identity attributes + signature)
Note over User: 7. Store credential privately
%% Wine shop order phase
User->>Shop DApp: 8. Connect wallet & browse products
User->>Shop DApp: Select wines & create order
Shop DApp->>User: Show order details
User->>Contract: 9. Submit order with payment<br/>and identity credential
Note over Contract: 10. Private verification:<br/>- Verify credential signature<br/>- Extract & verify age (β₯21)<br/>- Verify payment
- User connects wallet to the Identity DApp
- User generates a signing key and stores it privately
- User registers their wallet public key with the signing public key on the blockchain
- Identity Provider (IDP) generates their own signing key and publishes their public key
- User submits identity documents to IDP, signed with their signing key
- IDP verifies the user's identity and issues a signed credential containing identity attributes
- User stores the credential privately
- User connects to the Wine Shop DApp and browses products
- User creates an order and submits it through the contract
- The contract privately verifies the user's age using the credential, without revealing the actual date of birth
- If verification succeeds, the contract processes the payment and confirms the order
- All sensitive identity information remains private and is never exposed on-chain
- Zero-Knowledge proofs enable verification without revealing the underlying data
- Cryptographic signatures ensure the authenticity of identity claims
- Identity Provider reputation system ensures trustworthiness
- Midnight Compact compiler
- Node.js (LTS/hydrogen)
- Yarn
- Docker
yarn install
npx turbo build
npx turbo test