A Deep Dive into the Use Cases and Future of ZKML in Web3

Abstract: This article will explore the development and challenges of ZKML technology through the cases of Worldcoin and Vanna, and promote the widespread application and prosperity of this technology in the blockchain field.

With the rapid development of blockchain technology, data privacy and security have become core issues. Zero-knowledge machine learning (ZKML), as an emerging technology, effectively combines the security of zero-knowledge proofs (ZKP) and the intelligence of machine learning (ML), bringing unprecedented opportunities to the Web3 world.

Currently, ZKML technology has a wide range of applications in the blockchain field, mainly including the following aspects:

  • Hardware Acceleration: Due to the computational complexity of ZK proofs, some projects like Cysic and Ulvetanna use hardware acceleration to improve the efficiency of on-chain computation.

  • On-chain Data Processing: Projects like Axiom and Herodotus focus on converting on-chain data into formats suitable for ML training and ensuring that ML output results can be easily accessed from the chain.

  • Computational Circuit: To enable ML computations to be processed by blockchain ZK, some projects like Modulus Labs and Jason Morton convert ML computation models into circuit forms.

  • ZK Proof of Results: To address the trust issue of ML models, projects like RISC Zero and Axiom use ZK-SNARKs-based proofs to verify the authenticity of the models.

ZKML is currently developing rapidly and can assist in the construction of Web3 decentralized identity (DID). Previously, identity management modes like private keys and mnemonic phrases made Web3 user experience poor. True DID construction can be achieved through ZKML for the identification of Web3 entity biometric information, while ensuring the privacy and security of user biometric information. Worldcoin is applying ZKML to achieve zero-knowledge DID verification based on iris scanning.

This article will delve into the development and challenges of ZKML technology through the cases of Worldcoin and Vanna, and promote the widespread application and prosperity of this technology in the blockchain field.

1. Worldcoin Case Study: Use Case of ZKML in Identity Verification and Privacy Protection

1.1 DApp Integration with Worldcoin

Worldcoin ID can be used for identity authentication. Worldcoin provides an IDKit SDK for identity authentication using the World App, the specific process is as follows:

Source:https://github.com/worldcoin/wallet-bridge
Source:https://github.com/worldcoin/wallet-bridge
Source:https://github.com/worldcoin/wallet-bridge
Source:https://github.com/worldcoin/wallet-bridge

After processing the above process, the user's biometric information is used as a login credential, and a proof is generated in the Worldcoin App to prove identity.

1.2 Use Case of ZKML in Worldcoin

1.2.1 Use Case of ML in Worldcoin

By running the IrisCode model on self-hosted biometric data (user terminal), it verifies whether the user has created a valid and unique WorldID locally and calls the _addMember(uint256 groupId, uint256 identityCommitment) function on the WorldID Semaphore identity group with a valid identity commitment to make the protocol publicly permissionless.

1.2.2 Application of ZK in Worldcoin

Registration Process

During the registration process of Worldcoin, users generate a WorldID through iris scanning and call the _addMember function on the Semaphore identity group with a valid identity commitment to achieve publicly permissionless access to the protocol.

Proof process generated during registration process
Proof process generated during registration process

Signup Sequencer: The registration sequencer sorts the data (identities) submitted in batches to the Ethereum smart contract. Semaphore MTB: SMTB is a service for batch processing Merkle tree updates. It accepts Merkle tree updates and merges them into one update in batches. This is useful for reducing the number of transactions that need to be submitted to the blockchain. The correctness of batch Merkle tree updates can be ensured by generating SNARKs.

Tx Sitter: Signs transactions and sends them to the blockchain Proof input is the external nullifier (a public 32-byte value that scopes the uniqueness of verifications) and the secret identity nullifier. The nullifier hash is calculated based on these two for user identity recognition.

Login Process

During the login process, the identity nullifier submitted by the user will be converted into a proof, a process similar to zkrollup. After the user submits the identity nullifier, multiple Merkle state updates are aggregated and published to the blockchain.

Proof process generated during login process
Proof process generated during login process

1.3 Summary

The technical implementation of Worldcoin involves multiple layers, including the local operation of the IrisCode model, the generation of External-nullifier, the batch processing of Semaphore MTB, and the transaction processing of Tx Sitter. Since the process of running the IrisCode model to convert the iris into a World ID occurs on the user terminal, this part is not run by external nodes to protect user privacy. The combination of these technologies enables Worldcoin to achieve efficient and secure identity verification while protecting user privacy.

The Worldcoin case demonstrates the potential and effectiveness of ZKML technology in practical applications. By combining zero-knowledge proofs and machine learning, Worldcoin not only enhances the security of identity verification but also provides strong support for user privacy protection. This case provides valuable references and insights for other blockchain projects.

2. Vanna Network and ZKML: Intelligent Reasoning and Verification in Blockchain

2.1 Overview of Vanna Network

The Vanna network is an innovative blockchain platform focused on providing efficient zero-knowledge proof generation and verification services. It combines the transparency and immutability of blockchain with the privacy protection characteristics of zero-knowledge proofs, providing users with a secure and reliable data processing environment.

2.2Vanna Network Functions

  • Query Data: Access Oracle feed data or on-chain status through inter-chain queries of smart contracts.

  • Preprocessing: Use Vanna's built-in precompiler to preprocess the queried raw data in preparation for reasoning.

  • Inference Execution: Run inference seamlessly and scalably at any cryptographic security level suitable for your use case.

  • Inference Verification: All cryptographic proofs ensuring inference are verified by validator nodes on the Vanna network.

  • Publishing and Traceability: Inference results can be sent to contracts on any chain through cross-chain messaging and published to the data availability layer.

2.3 Vanna Network Features

Parallel Inference Pre-execution

Divided into three stages:

Stage 1: Simulation

Vanna runs each transaction through a simulator to find out which inference requests the transaction will make. No execution here.

Stage 2: Inference Memory Pool

Transactions and their inference requests are added to the inference memory pool, which sends requests to Vanna inference nodes. Inference and proof need to be executed here.

Stage 3: EVM Execution

Inject inference results into the EVM so that transactions can read them directly, just like reading any other variable. Then execute the transaction and submit it to the blockchain.

2.3.2 Verification Calculation Separation

Vanna Network adopts two types of nodes, verification nodes and inference nodes, and forks network verification and inference calculations onto these two types of nodes separately.

Verification Nodes: Rollup nodes independently verify transactions and the state of the Vanna network. Rollup nodes on the Vanna network also participate in verifying cryptographic proofs generated by inference nodes.

Inference Nodes: Inference nodes do not verify transactions and blocks on the network but focus only on computing AI/ML inferences and generating cryptographic proofs for inferences.

2.3.3 Staking and Penalties

Vanna Network provides crypto-economic security in the form of application layer staking contracts. When inference nodes go online and participate in securing the network, they must post Vanna tokens as collateral in the staking contract. The staking contract enforces the behavior of inference nodes, with slashing conditions including but not limited to:

  • zkML - Generating invalid and cryptographically unverifiable proofs

  • opML - Successful challenges to inferences generated by nodes

  • zkFP - Successful challenges to inferences generated by nodes or failure to generate a ZK SNARK proof for the inference

2.4 Summary

Through its unique design and functionality, the Vanna network demonstrates the application potential of ZKML in blockchain networks. Its parallel inference pre-execution, verification calculation separation, and staking and penalty mechanisms

3.ZKML Development Tool EZKL: Simplifying Zero-Knowledge Proof Generation and Verification

3.1 Overview of EZKL

EZKL takes a high-level description of a program and sets up zero-knowledge provers and verifiers. The focus is on programs represented by pytorch AI/ML models and other computational graphs. Once set up, the prover can prove statements like:

  • “I ran this public neural network with some private data, and it produced this output”

  • “I ran my private neural network with some public data, and it produced this output”

  • “I correctly ran this public neural network on some public data, and it produced this output”

3.2 The Workflow of EZKL

The workflow of EZKL is as follows:

Source:https://blog.spectral.finance/making-zkml-real-with-ezkl
Source:https://blog.spectral.finance/making-zkml-real-with-ezkl
  • Define Neural Network Model: Define a simple neural network

  • Model Training: Generate input data and get output through the model

  • Model Export: Export the model in ONNX format

  • Generate Zero-Knowledge Proof Setup: Generate setup files

  • Compile Circuit: Compile the model to generate circuit files

  • Generate Zero-Knowledge Proof: Generate SRS, witness files, proof keys, and verification keys

  • Verify Zero-Knowledge Proof: Generate zero-knowledge proof and verify locally or create Solidity code and ABI files for EVM verifiers, deploy contracts, and verify proofs on-chain

4.ZKML Challenges and Prospects

As blockchain technology continues to evolve, zero-knowledge machine learning (ZKML) is gradually becoming a key force in enhancing application privacy and security. It not only heralds the emergence of innovative applications such as smart contract privacy protection and decentralized finance (DeFi) security enhancement but also promises to become an indispensable part of blockchain technology, providing a solid technical foundation for building a safer and more privacy-focused digital world.

4.1 Challenges

Although ZKML has great potential, it also faces some challenges in its application process:

  • Technical Complexity: The implementation of ZKML requires profound knowledge of mathematics and cryptography, which undoubtedly increases the difficulty of development and maintenance, requiring developers to have higher professional skills.

  • Performance Bottleneck: The process of generating and verifying zero-knowledge proofs is computationally intensive, which may affect system response time and processing capacity. To address this issue, some projects like Lumoz provide a modular compute layer to improve performance.

  • User Acceptance: Although ZKML provides powerful privacy protection features, users may hold reservations due to a lack of understanding of its complexity and security.

  • Regulatory Challenges: The development of privacy protection technology requires regulatory agencies to update relevant regulations to adapt to the changes and challenges brought by new technologies.

4.2 Prospects

Despite the challenges, the deep integration of ZKML technology and the future development of blockchain are full of hope:

  • Technological Progress: With in-depth research and technological maturity, the implementation of ZKML will become more efficient and user-friendly.

  • User Education: Through education and popularization, users can better understand the complexity and security of ZKML technology, increasing their acceptance.

  • Regulatory Adaptation: The adaptation and innovation of regulatory agencies will provide legal and policy support for the development of ZKML technology.

  • Application Innovation: The continuous advancement of ZKML technology will stimulate the emergence of more innovative applications, promoting the application of blockchain technology in a wider range of fields.

5.Conclusion

The development of ZKML technology is a significant step in the blockchain field, heralding the arrival of a new era of data privacy and security. In the face of technical complexity, performance bottlenecks, and regulatory challenges, we should remain optimistic and believe that with technological progress and increased user acceptance, ZKML will play a more important role in the blockchain field, driving broader applications and innovations.

References

Subscribe to Lumoz
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.