zkmopro / mopro

Making client-side proving on mobile simple.
https://zkmopro.org
Apache License 2.0
114 stars 29 forks source link

Build wasm based npm package #202

Open chancehudson opened 2 months ago

chancehudson commented 2 months ago

Problem

Our current app_config module supports building a static library for iOS, and for Android. We offer no support for javascript.

Details

We should add build logic for nodejs (e.g. cargo run --bin nodejs). This should build an npm package with javascript handles for controlling the wasm module.

Note that public key management should still be delegated outward. e.g. the application is responsible for passing the zkey path/data to the wasm function.

This is effectively a way to compile a faster alternative to snarkjs, though it's specific to each application.

Acceptance criteria

Add nodejs project in test-e2e, write bindings manually to start.

Next steps (optional)

Add url support to zkey in web Improve ark-zkey for web use

vivianjeng commented 1 month ago

18 July Updates: I tried with waku/rln implementation https://github.com/waku-org/js-waku https://github.com/vacp2p/zerokit but I noticed that snarkjs performs better than the ark-works bindings in browser ark-works ~1600ms v.s. snarkjs ~500ms

and their developer said

there are plans to move to using snarkjs due to the overhead of using zerokit in wasm form in the browser 🙂

the ark-works might not perform better than snarkjs with circom circuits but it is still worth with halo2 or other proving systems to generate nodejs bindings