How zkthings/zksdk works
Main Components
A. Core Components:
• ZkMerkle Engine (Main Interface)
• PowerOfTau Ceremony Manager
• Trusted Setup Manager
• Circuit Components
• Proof Generation/Verification System
B. Supporting Infrastructure:
• File System Interface
• Configuration Management
• WASM Runtime Environment
• External Libraries Integration
┌─ Application Layer ─────────────────────┐
• User Applications │
• ┬────────────────────┬─┘
┌─ Public API ─────▼────────────────────▼─┐
• ZkMerkle Class │
• ┬────────────────────┬─┘
┌─ Core Services ──▼────────────────────▼─┐
• ┌─────────────┐ ┌──────────┐ ┌─────┐ │
• PowerOfTau │ │Trusted │ │Proof│ │
• Ceremony │ │Setup │ │Gen │ │
• ┘ └──────────┘ └─────┘ │
• ┬────────────────────┬─┘
┌─ Circuit Layer ──▼────────────────────▼─┐
• ┌─────────────┐ ┌──────────┐ │
• Merkle Tree │ │MiMC │ │
• Circuit │ │Sponge │ │
• ┘ └──────────┘ │
• ┬────────────────────┬─┘
┌─ Storage Layer ──▼────────────────────▼─┐
• ┌─────────────┐ ┌──────────┐ ┌─────┐ │
• Circuit │ │Ceremony │ │Proof│ │
• Artifacts │ │Files │ │Keys │ │
• ┘ └──────────┘ └─────┘ │
• ┘
Key Relationships to Highlight
a. Ceremony Flow:
• Multi-participant nature of the trusted setup
• Phase transitions (Phase 1 → Phase 2)
• Coordinator and participant interactions
b. Proof Generation Flow:
• Data input → Circuit processing
• WASM execution path
• Proof output and verification
c. File System Integration:
• Configuration loading
• Artifact storage
• Circuit file management
Implementation Details
src/
• ZkMerkle.ts (Main Interface)
• PowerOfTau.ts (Ceremony Management)
• TrustedSetup.ts (Setup Configuration)
• types/ (Type Definitions)
zkConfig/
• ceremony/ (Ceremony Artifacts)
• circuits/ (Circuit Components)
• templates/ (Contract Templates)
Additional Notes
• Version/compatibility information
• Extension points for custom configurations
• Notes about the maximum supported tree depth (15 levels)
Remember to maintain a balance between detail and clarity, focusing on the core zero-knowledge and Merkle tree functionality while still showing the supporting infrastructure.