EYBlockchain / nightfall_3

a mono-repo containing an optimistic version of nightfall
Creative Commons Zero v1.0 Universal
261 stars 57 forks source link

Migrating to snarkjs backend. #985

Closed IlyasRidhuan closed 1 year ago

IlyasRidhuan commented 1 year ago

We currently use bellman for proof generation in ZoKrates-worker and zokrates-js. Since 0.8.2, ZoKrates can generate compiled circuits and witness that are compatible with the circom-ecosystem.

This should also significantly clean up the code in ZoKrates worker by removing the need for spawn-ing system processes.

Finally this opens the opportunity for us to utilise the impressively quick rapidsnark prover. Early benchmarks for rapidsnark show it is 30x faster than bellman.

Task list (all wallet updates will replace zokrates-js calls)

druiz0992 commented 1 year ago

Not sure if related, or should go under a different issue, but for the client we should allow to use rapid snark on multiple servers

IlyasRidhuan commented 1 year ago

Yeah that is a good point, we could either have it as a toggle as part of the config (e.g. PROVING_CONFIG = ${rapidsnark_url} or zokrates-worker.

So either

  1. You run it locally (containerised) with ZoKrates-worker (or I guess circom-worker) and snarkjs is used.
  2. You provide it a url that handles proof generation (this could then be an AWS cluster where rapidsnark is deployed)

rapidsnark seems to be perfect for big machines with multi-cores, so we should be fine with snarkjs local