Zokrates / ZoKrates

A toolbox for zkSNARKs on Ethereum
https://zokrates.github.io
GNU Lesser General Public License v3.0
1.81k stars 361 forks source link

Project: Bringing (libsnark) gadgets to ZoKrates #19

Closed nicola closed 5 years ago

nicola commented 6 years ago

Hello everyone, I finally wrapped my head around what is needed to make #2 happen :)

Current state: ZoKrates is really great - however, as soon as more complex primitives (SHA #2 and others) are required for designing a circuit, you either end up using libsnark or you will have to reimplement those carefully designed gadgets from libsnark again in ZoKrates (really prone to errors!)

There is hope: What if we could export gadgets from libsnark into R1CS that can be imported into ZoKrates? Then ZoKrates would be a really simple glue to combine gadgets and make circuts that Libsnark can then use. Once we have the ability of re-using circuits, then ZoKrates can really reach a wider audience which is not just "prototyping".

Note: This might even be a project where ZoKrates as a community could apply for grants (Zec? Protocol Labs? Eth?)

Ack: So talking to @JacobEberhardt @lgarron, I assembled this list of tasks/projects that we as a community should look into to make the leap with ZoKrates


Project: Gadgets to ZoKrates

Objectives

There are three objectives, and they can be run in parallel:


/cc @amiller, @JacobEberhardt, @barryWhiteHat, @Schaeff

nicola commented 6 years ago

Update: @barryWhiteHat has done some progress towards Objective 1 here: https://github.com/howardwu/libsnark-tutorial/compare/master...barryWhiteHat:master

Also, implicitly has defined a new format for R1CS :)

nicola commented 6 years ago

For reference https://github.com/QED-it/r1cs_proto where @kobigurk is also working on a standard format for r1cs

Schaeff commented 6 years ago

A first version is being actively worked on here https://github.com/schaeff/ZoKrates/tree/bind-libsnark-sha256 with the approach of generating witnesses in libsnark. Stay tuned!

JacobEberhardt commented 5 years ago

Sha is available as libsnark import as well as as native ZoKrates implementation

nicola commented 5 years ago

wooow!

daniben31 commented 5 years ago

Nice proposal @nicola, I definitely agree that this is a direction that different projects should be working towards to enable interoperability.

We published a proposal as part of the community standards of zkproof.org. It is a procedural method for generating constraints (both instance reduction and witness reduction) that can be used for all the front-ends and back-ends that are "R1CS friendly"

https://github.com/QED-it/gadget_standard

We are thinking of implementing the ZoKrates frontend and bellman backend