Try   HackMD

ZK Grant Proposal: ZK-ML-IOS Integration

Project Abstract

This project aims to enhance the existing iOS toolkit for Zero-Knowledge Proofs (ZKP) deevelopment. Specifically, the project aims to add support to the mopro library for an very common proving system - Halo2. Additionally, the project will use the achieved integration to port the state-of-the-art Zero-Knowledge Machine Learning (ZKML) library, EZKL, to iOS devices. These both integrations would benefit a wider community and unlock more sophisticated ZKML applications directly on mobile devices, thereby expanding the possibilities for data privacy and secure computing on edge devices.

Objectives

Our goal is to successfully integrate the most performant ZKML library, EZKL, into the iOS platform, which itself leverages the Halo2 proving system. This integration aims to facilitate the deployment of ZKML applications on mobile devices, marking a significant advancement in privacy-preserving technologies.

To achieve this, we will improve the versatility and usability of Mopro by integrating Halo2, benefitting a wider community. This has been discussed with Oskar, Mopro core contributor.

Success will be measured through:

  1. Integration of Halo2 (PSE Fork) support into Mopro via coordinated resiese of pull requests.
  2. A comprehensive review and tutorial on integrating Halo2 circuits into Mopro.
  3. Nessessary adjustments and integrations for EZKL fork to work on iOS.
  4. A demo project showcasing the deployment of EZKL-prepared Halo2 circuits on iOS.
  5. Tooling to prepare EZKL-fit circuit input on iOS.
  6. A blog post summarising the work and detailing the performance benchmarks of running EZKL on an iPhone.

Outcomes

This project is poised to significantly benefit the Ethereum ecosystem by promoting the adoption of ZK technologies. By enabling iOS and Android developers to utilize a more efficient proving system natively, we anticipate a surge in interest for on-device ZK applications. This initiative will pave the way for innovative applications like secure on-device machine learning and privacy-preserving data processing, enhancing the security and utility of mobile applications within the Ethereum ecosystem.

The example of projects that could be done are:

Grant Scope

The grant will focus primarily on the integration and deployment phases, with no direct research component required. We aim to:

  1. Integrate the Halo2 proving system into the mopro library.
  2. Enable the deployment and 'execution' of ZKML circuits on iOS devices.

These efforts are expected to culminate in a series of deliverables, including code integrations, tutorials, and demonstrations, which will be detailed in the project timeline.

Project Team

Name Role Time Commitment
Artem Grigor Main Contributor 120 hours/month
Anton Kravchenko ML Consultant 5 hours/month

Background

Artem Grigor

- elus.aegis@gmail.com
- tg.me/ElusAegis
- https://github.com/ElusAegis
- http://www.elusaegis.xyz

Artem Grigor has been working for the past four years in the domain of Privacy Enhancing Technologies, with a particular focus on Zero-Knowledge Proofs (ZKP). He has worked as a Research Engineer for the Aragon ZK Team and more recently, as a Lead Protocol Engineer at Mozak, ZK EVM. Currently, he is studing at UCL and and preparing for a PhD in intersection of Cryptography and Machine Learning.

Artem was a co-recipient of an EF PSE Grant previously, aimed at the exploration of efficient ZKML leveraging Weightless Neural Networks, under the supervision of Cathie So. His academic contributions include two published works: one on the Impossibility of Succinct and Anonymous Off-chain Voting, accepted at the 5th DLT workshop, and another on Multi-Input Non-Interactive Functional Encryption, accepted at the C2SI conference. Artem has also produced several pre-prints, two of which are outcomes of the before mentioned grant.

More recently, Artem has started an self-sovereign data project for on-device use, that was partially implementation during Eth Oxford. There, his team achieved first place in two main tracks, in addition to receiving honorable mentions in two others. In the course of this project, he effectively utilized Mopro and adapted keras2circom for iOS compatibility.

In addition, Artem possesses substantial experience with the Plonk and Halo2 proving systems. He has implemented the PLONK proving system from scratch using Python Sage and has gained practical experience with Halo2.

Methodology

Our approach is to follow the outlined deliverables, ensuring each step is completed thoroughly and effectively. This structured approach will keep the project on track and ensure all objectives are met within the set timeline.

Timeline

Milestone 1 - Integration of Halo2 into Mopro

  • Estimated Duration: 1 month
  • FTE: 0.8
  • Costs: $8,000

The initial milestone focuses on integrating the Halo2 proving system into the mopro library, including code reviews, testing, and documentation to facilitate this new capability:

Number Action Deliverable Estimated Time
1. Code Review Conduct a thorough review of the existing Mopro codebase to gain a comprehensive understanding of its Foreign Function Interface (FFI) mechanisms. Learn about the intricacies of linking and draft sample Rust code that can be converted into an FFI executable on iOS. 20 hours
2. Halo2 Integration Execute the integration of the Halo2 PSE fork into a dedicated halo2 branch of Mopro, ensuring its compilation into an FFI compatible with the XCode simulator environment. 50 hours
3. Bechmark & Testing Perform rigorous testing of the Halo2 integration across various circuits to verify complete coverage and functionality. Provide a benchmark for running various circuits. 8 hours
4. CLI Integration Incorporate the Halo2 proving system into Mopro's Command Line Interface (CLI), enabling users to select their desired proving system seamlessly. 20 hours
5. Tutorial Development Develop a tutorial detailing the conversion of a Halo2 circuit using the Mopro CLI. Additionally, include sample Halo2 circuits within the mopro-core module, offering optional compilation features. 15 hours
6. Documentation Enhancement Make sure there the inline and overall documentation to include detailed instructions on utilizing the Halo2 version of the prover. 5 hours
8. Milestone Summary Craft a concise blog post summarizing the work so far and explaining the potential of the work. 2 hours

Milestone 2 - Support of EZKL on IOS

  • Estimated Duration: 1.5 month
  • FTE: 0.8
  • Costs: $12,000

The second milestone aims to enable the deployment of EZKL-prepared ZKML circuits on iOS, encompassing code review, proving, input generation, and verification processes.

Number Action Deliverables Time Estimation
1. Comprehensive Review of EZKL Codebase Conduct a thorough examination of the EZKL codebase and EZKLJS to gain a deep understanding of its functionalities and existing platform adaptations, including web implementations. 30h
2. EZKL Proof Execution on iOS With a properly formatted input ready, execute the proof process for a sample EZKL model on iOS, ensuring full operational capability. 40h
3. Input Generation for EZKL on iOS Enable the creation of valid formatted input directly from sample data on iOS, facilitating seamless generation and proof of input in a unified process. 40h
4. Proof Verification for EZKL on iOS Implement and ensure the capability to verify EZKL-generated proofs on iOS devices, confirming the integrity and validity of the proof. 20h
5. EZKL iOS Tutorial Creation Develop a comprehensive tutorial, including any necessary helper scripts, to guide users through using EZKL-supported models on iOS. Ensure the instructions are clear, concise, and accompanied by well-documented code. 20h
6. Comprehensive Project Summary & Benchmark Craft a detailed summary highlighting the achievements of both milestones, and explain how developers can leverage the advancements proposed for building on this platform. Additionally, include the benchmarks for both EZKL and plain Halo2 running on latest iPhone. 10h

Budget

  • Total Estimated Duration: 3 month
  • Full-time equivalent (FTE): 0.6(6)
  • Total Costs: $20,000

The total budget for this project is $20,000, covering a duration of 3 months with a full-time equivalent (FTE) workload of 0.67. The funds will primarily support the main contributor, ensuring dedicated effort towards achieving the project's objectives.