ZK Circuit Workflow in Privacy-Preserving Computations
The workflow typically involves four key steps:


Input Deserialization
In blockchain systems, the state root is a cryptographic hash representing the entire state (e.g., account balances, model states) through Substrate's Patricia Trie structure. The ZK circuit computes the updated state root after processing the inputs, proving that the state transition is valid without disclosing private details. This step ensures that the blockchain's state remains consistent and verifiable through Substrate's unified state management system, even when private data is involved.

Witness Database Setup
The "witness" consists of private inputs (e.g., sensitive dataset details, model parameters) that the prover (Proof Pod) uses to demonstrate the correctness of the computation without revealing them. Setting up the witness database involves organizing these inputs efficiently within Substrate's secure execution environment, ensuring that the prover (Proof Pod) can access them during proof generation while maintaining privacy. For instance, in an AI inference task, the witness might include the model's weights and biases, which are kept confidential throughout the process.

State Root Computation
Raw data, such as transaction details or AI model inputs, is converted from its serialized format (e.g., bytes) into a structured form that the ZK circuit can process. For example, an AI model's input tensor might be deserialized into a vector of integers, ensuring the circuit can interpret the data correctly for proof generation. This step is critical for ensuring that the circuit operates on the correct data, avoiding errors in proof generation. Substrate's off-chain workers provide a secure environment for this deserialization process.

Block Execution (Computation Verification)
The ZK circuit simulates the execution of the computation (e.g., running an AI model or validating a transaction) and generates constraints to prove its correctness. For example, in an AI model inference task, the circuit might verify that the output matches the expected result for the given inputs, ensuring accuracy while keeping the inputs hidden. This step is the core of the verification process, enabling trustless validation in Substrate's decentralized environment through both EVM contracts and native pallets
ZK Wrappers Architecture and Workflow


