The zkFusion Layer: Bridging Applications and Web3
The zkFusion layer serves as a conduit between applications and Web3. It leverages the expansive WASM ecosystem, which enjoys widespread support by major corporations and extensive use within browser and mobile environments. In practical terms, this implies that we can load WASM directly in the browser, and interact with it seamlessly.
Crucial to this process is the zkWasm virtual machine, which emulates the code and execution to generate Zero-Knowledge (ZK) proofs. These proofs are fundamental in ensuring the honest and correct execution of the WASM code. Once produced, these proofs are posted to the blockchain where they are verified and settled.
In reality, applications operate not solely on the client-side as WASM, but also on the server-side. The zkFusion layer addresses this duality by providing a unified infrastructure that integrates both client and server components.
Within WASM, there exists a category of functions known as host functions. Invoking a host function essentially equates to calling a remote function provided by the host. This capability facilitates the partitioning of our architecture into two distinct parts: the guest circuit and the host circuit.
Whenever a client-side WASM code initiates a Remote Procedure Call (RPC), it can be perceived as invoking a host circuit. The client presents the witness at the frontend, and proofs are generated for the guest's WASM virtual machine. The guest zkWASM circuit ascertains that the witness is enforced by the host API call trace, while the host circuit verifies the accuracy of the input and output fields of the host API call trace. The proof aggregator ensures the congruity between the guest circuit and host circuit in sharing the same host API call trace.
This methodology culminates in a cohesive client-server ZK architecture, paving the way for the development of more advanced applications utilizing the zkFusion platform.
ZKCross Node implements the zkFusion layer, it facilitate the interaction between applicationsand relevant services. It comprises three modules: the Dedicated Sequencer, ZkProver Dispatcher, Data Availability (DA), and Contract Proxy.
RPC server The RPC forms the first point of contact for application requests. It provides a user-friendly JSON-RPC interface that processes these requests. Depending on the request type,the RPC then organizes the request data and forwards it to the DA layer and ZKProver Dispatcher.
When the RPC server generates a new batch of requests, the Dispatcher comes into action. It collects the execution trace of the batch from the Sequencer, then sends it to a zkWasm prover from the network to generate a zkSNARK.
Each application require certain services run, those services are used not only during the client side execution, but they are also called by zkWasm host circuits while doing the proof generation. Listed below are some services existing today, we will add more in the future, either build by ourselves or integrate third-party's zkWasm compatible service
One type of zkService is the state service which offers a scalable solution to the issue of state availability. Utilizing a Merkle tree structure for system state storage and built on MongoDB, it provides APIs like kv_setroot(), kv_getroot(), kv_get() and kv_set() as WASM host function APIs. This allows WASM programs to leverage DA as a data and state storage backend.
zkWasm prover service
A service provided by Distributed Proving Network (DPN), a distributed infrastructure powered by zkwasm-vm. It enables automatic generation of Zero-Knowledge Proofs (ZKP) by emulating wasm execution and calling zkServices within the network. The DPN combines the benefits of distributed computing and zkWasm technology to provide a scalable platform for zkproof generation.
The Verifiable Random Number Generator (VRF) service provides cryptographically secure randomness, essential for wasm applications. This function plays a crucial role in fostering fairness and unpredictability in diverse areas of decentralized applications, including but not limited to gaming, lotteries, and other probabilistic services
More services to be added