Coder Social home page Coder Social logo

wasm-zkp-challenge's Introduction

WASM Z-prize challenge proposal (Draft)

Introduction

WASM (WebAssembly) is the de-facto standard for smart contact VM like Polkadot, Definity, Cosmos. And also critical for wallet adoption. However, making ZKP works efficiently on WASM is still a challenge today. In Manta’s internal benchmark, we can observe 10x - 15x performance penalty on WASM compared with X86 native binary. This WASM ZKP challenge is bring breakthroughs in compilation to make ZKP on WASM (both prover and verifier)

Goal: Test the correctness and performance of WASM binaries on some operations that are common in ZKP systems.

(Note: Bls12-381 can be replaced with any ZK friendly curves)

In particular, we consider three types of test suites:

  • Low-Degree Extension: Measure the performance of (I)FFT
  • Product of Pairings: Measure the performance of billinear pairing
  • Multi-Scalar Multiplication: Measure the performance of scalar multiplication

Please check detailed documents at our proposal.

Dependencies:

Run the benchmark

  • WASM time:
    ./serve.sh
    You can view the result at localhost:8080. Please update this line to benchmark different test suites.
  • Native time:
    cargo bench

Initial Results

Platform

Intel i7-6560U CPU @ 2.2GHz, 8GB Memory, Linux 16.04 LTS.

FFT Results

Input Vecotr Length Output Vector Length WASM (ms) Native (ms) Ratio
2^14 2^15 111 18 6.2
2^16 2^17 496 86 5.8
2^18 2^19 2373 450 5.3
2^20 2^21 9912 2118 4.7

We note that, for the same input vector length, the output vector length also has impact over the latency. Please see below:

Input Vecotr Length Output Vector Length WASM (ms) Native (ms) Ratio
2^14 2^15 111 18 6.2
2^14 2^16 190 32 5.9
2^14 2^17 358 62 5.8
2^14 2^18 773 129 6.0

MSM Results

Input Vecotr Length WASM (ms) Native (ms) Ratio
2^8 478 14 34.1
2^10 1627 38 42.8
2^12 6191 125 49.5
2^14 24243 393 61.7

Pairing Results

Input Vecotr Length WASM (ms) Native (ms) Ratio
2^2 97 7 13.9
2^4 368 30 12.3
2^6 1479 121 12.3
2^8 5916 485 12.2

wasm-zkp-challenge's People

Contributors

boyuanfeng avatar 0x0ece avatar dengjianping avatar mmaker avatar stechu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.