privacy-scaling-explorations / acceleration-program

Accelerate Early Stage Programmable Cryptography Talents
99 stars 7 forks source link

Self Proposed Open Task: Accelerate Client-Side ZK with WebGPU #38

Closed guni7 closed 6 months ago

guni7 commented 8 months ago

Executive Summary

Project Name: Astra: Accelerating Client-Side ZK with WebGPU

Astra is a cutting-edge library designed to accelerate zero-knowledge proof generation directly within web browsers. By harnessing the power of WebGPU, Astra aims to overcome the computational barriers that have traditionally hindered the performance of privacy-preserving applications. Our project focuses on optimizing critical operations like MSMs and NTTs and aims to establish a comprehensive ecosystem for seamless integration across various proof systems.

Project Overview

Astra leverages the emerging WebGPU standard to tap into the parallel processing capabilities of GPUs directly within the browser. This approach promises to bridge the gap between the computational demands of zero-knowledge proofs and the limitations of traditional browser-based environments. By optimizing key operations such as multi-scalar multiplications (MSMs) and number-theoretic transforms (NTTs), Astra aims to set a new benchmark for performance in the realm of client-side zero-knowledge proofs.

Project Details

Background on WebGPU

WebGPU is a groundbreaking API that provides web applications with access to the computational power of modern GPUs. Unlike its predecessors, WebGPU is designed with both graphics and general-purpose computation in mind, making it an ideal choice for computationally intensive tasks like zero-knowledge proof generation. By utilizing the parallel processing capabilities of GPUs, WebGPU can execute operations much faster than traditional CPU-based approaches, especially when dealing with large datasets or complex calculations.

Motivation

The generation of zero-knowledge proofs is a resource-intensive process that has traditionally been hampered by the constraints of browser environments. With the advent of WebGPU, a new pathway has opened up, allowing direct access to GPU resources within the browser. Astra seeks to exploit this opportunity to accelerate proof generation, making zero-knowledge applications more practical and user-friendly.

Scope of Work

The project is divided into three milestones, each focused on a different aspect of the library's development:

Total Estimated Duration: 8 weeks Full-time Equivalent (FTE): 2

Milestone 1 - Shader Implementation and Integration

Estimated Duration: 2 weeks
FTE: 2

In this phase, we plan on implementing shaders for field arithmetic and curve operations for BN254.

No. Deliverable Specification
1 WebGPU Primitives Implement WGSL shaders for field arithmetic and curve operations for the BN254 family of curves.
2 Interfacing for Primitives Implement helper functions to interface with WebGPU primitives for testing and benchmarking
3 Testing Framework Develop a regression test suite to ensure the correctness and stability of the implemented primitives.
4 Benchmarking Tools Create tools for benchmarking the performance of primitives across different hardware configurations.
5 Documentation Provide comprehensive documentation for the implemented primitives and testing framework.

Milestone 2 - Integration and Benchmarking

Estimated Duration: 3 weeks
FTE: 2

In this phase, we focus on integrating the primitives with the halo2 library and benchmarking it.

No. Deliverable Specification
1 MSM, NTT with WebGPU Implement Pippenger's Algorithm for MSM and NTT with WebGPU primitives
2 Integrate with halo2 Dirty integration of WebGPU primitives with the halo2
3 Benchmarking Compare results of halo2 MSMs and NTTs with WebGPU MSMs and NTTs
4 Testing Unit/Integration/Regression/Stress Testing for MSMs, NTT with WebGPU

Milestone 3 - Expansion and Tooling

Estimated Duration: 3 weeks
FTE: 2

No. Deliverable Specification
1 Rust Library Create a library that enables easy usage of WebGPU crypto and integrate it with halo2
2 Optimizations Study the biggest bottlenecks and work on optimizing them
3 Security Analysis Conduct an internal security analysis to identify potential vulnerabilities, such as timing attacks or side-channel attacks.
4 Documentation Documentation of the Rust Library

Expected Outcomes

By the end of 8 weeks, we aim to establish the groundwork for a robust ecosystem dedicated to zero-knowledge proof generation utilizing WebGPU. Future work will involve further optimizations and integrations with other proof-generation libraries.

Current Work

We have made considerable strides in advancing the Astra project, effectively mitigating risks associated with key milestones. Our achievements thus far include:

Project Repo

Team

Name Email Telegram
Gunit Malik gunitmalik@gmail.com @gumnut
Saurabh Chalke saurabhchalke@gmail.com @saurabhchalke

Team Experience

The team has been deeply involved in the zk space for over a year. We have previously built distributed versions of the primitives required to generate proofs to enable distributed proof generation in Arkworks and halo2.

Administrative Details

Estimated Duration of the project: 8 weeks
Project Complexity: Medium, requiring expertise in Rust, Zero Knowledge Proofs, and WebGPU.

NOOMA-42 commented 7 months ago

Hey @guni7 Are you going to proceed with this proposal? Or as we discussed in hackerhouse, you will turn to MPC instead

NOOMA-42 commented 6 months ago

close it as it's stale atm