Architecture Overview
ZKVAULT implements a modular, layered architecture that separates proof generation, compression, verification, and data storage into distinct subsystems. This design enables optimal performance, maintainability, and security.
High-Level System Architecture
The ZKVAULT system consists of four primary layers:
1. Proving Layer (Off-Chain)
The proving layer handles all computationally intensive cryptographic operations off-chain:
- Circuit Compiler - Transforms high-level constraint definitions into R1CS representations
- Witness Generator - Computes variable assignments that satisfy all circuit constraints
- Prover Engine - Generates zk-SNARK proofs using Groth16 proving system
- Transcript Manager - Implements Fiat-Shamir heuristic for non-interactive proofs
// Proving layer data flow
Circuit Definition → R1CS Constraints → Witness Computation → Proof Generation
Input: { private: {...}, public: {...} }
↓
Constraint Synthesis
↓
Witness = [w₀, w₁, ..., wₙ]
↓
π = Prove(pk, Witness)
↓
Output: Proof π (192 bytes)2. Compression Engine (Off-Chain)
The compression engine minimizes proof size through recursive SNARK composition:
- Aggregation Tree - Combines multiple proofs into a single succinct proof
- Recursive Circuits - Verifies proofs within proofs to achieve logarithmic compression
- Byte Optimizer - Applies field element compression and point encoding optimizations
- Batch Processor - Handles parallel proof aggregation for high throughput
// Compression reduces proof size for on-chain submission
Original Proof: 192 bytes
↓ Recursive SNARK Composition
Compressed Proof: 128 bytes
↓ Batch Aggregation (8 proofs)
Final Proof: 128 bytes (verifies 8 original proofs)3. Solana On-Chain Verifier (BPF Program)
The verifier program runs on Solana validators using the Berkeley Packet Filter (BPF) runtime:
- Pairing Engine - Implements BN254 elliptic curve pairing operations
- Verification Logic - Checks proof validity against public inputs
- State Manager - Uses Program Derived Addresses (PDAs) for vault state storage
- Instruction Router - Handles InitVault, SubmitProof, VerifyProof instructions
// On-chain verification flow
Client submits: (π, public_inputs) → Solana Transaction
↓
Verifier Program validates:
1. Proof structure integrity
2. Elliptic curve point validity
3. Pairing equation: e(A, B) = e(α, β) · e(C, δ)
↓
Result: Valid ✓ / Invalid ✗ → PDA state update4. Data Vault Encryption Subsystem
The encryption subsystem provides confidential data storage with cryptographic access control:
- Key Derivation - Uses HKDF for deterministic key generation from master secrets
- Symmetric Encryption - ChaCha20-Poly1305 AEAD for data confidentiality and integrity
- Identity-Blind Storage - Encrypts data location and access patterns
- Forward Secrecy - Ephemeral keys ensure past data remains secure if keys compromised
Execution Flow Diagram
┌──────────────┐
│ Developer │
│ dApp │
└──────┬───────┘
│ 1. Create circuit + witness
↓
┌──────────────────────────────┐
│ ZKVAULT Prover (Off-Chain) │
│ • Constraint synthesis │
│ • Witness computation │
│ • Proof generation │
└──────┬───────────────────────┘
│ 2. Generate proof π
↓
┌──────────────────────────────┐
│ Compression Engine │
│ • Recursive aggregation │
│ • Byte optimization │
└──────┬───────────────────────┘
│ 3. Compressed proof π'
↓
┌──────────────────────────────┐
│ Solana Transaction │
│ • Serialize proof + inputs │
│ • Sign with wallet │
└──────┬───────────────────────┘
│ 4. Submit to blockchain
↓
┌──────────────────────────────┐
│ ZKVAULT Verifier (On-Chain) │
│ • Validate proof structure │
│ • Execute pairing checks │
│ • Update PDA state │
└──────┬───────────────────────┘
│ 5. Verification result
↓
┌──────────────────────────────┐
│ dApp Integration │
│ • Read verification status │
│ • Execute business logic │
└──────────────────────────────┘Protocol Invariants
ZKVAULT maintains the following cryptographic and system-level invariants:
Cryptographic Invariants
- Soundness - Probability of accepting invalid proof < 2^-128
- Zero-Knowledge - Simulator can produce indistinguishable proofs without witness
- Completeness - Valid proofs always verify (except negligible probability)
- Succinctness - Proof size O(1), verification time O(|public inputs|)
System Invariants
- Deterministic Verification - Same proof + inputs always yield same result
- Replay Protection - Each proof includes unique nonce, cannot be reused
- PDA Uniqueness - Each vault has exactly one PDA derived from seeds
- Memory Safety - BPF verifier never accesses out-of-bounds memory
Performance Characteristics
| Operation | Time | Cost |
|---|---|---|
| Proof Generation (off-chain) | 800ms - 2s | Client CPU |
| Proof Compression | 100ms - 300ms | Client CPU |
| On-Chain Verification | 50ms - 200ms | ~200k CU (gas) |
| Vault Encryption | <10ms | Minimal |
| End-to-End Latency | 1-3 seconds | ~$0.001 |
Security Model
For detailed threat modeling and security analysis, see the Security Model documentation.
For implementation details of each subsystem, refer to: