scipr-lab / libsnark

C++ library for zkSNARKs
Other
1.81k stars 572 forks source link

Documentation enhancement #133

Closed AntoineRondelet closed 5 years ago

AntoineRondelet commented 5 years ago

Good afternoon,

Just opened this issue as I believe that an enhanced documentation of libsnark would be very valuable to users of this library. In fact, to the best of my knowledge (and sorry if I missed something...) I have never seen a "libsnark for dummies" or "Tutorial on how to build gadgets using libsnark" document so far (a part from the tutorial made by Howard: https://github.com/howardwu/libsnark-tutorial that uses the example written in libsnark/relations/constraint_satisfaction_problems/r1cs/examples/r1cs_examples.tcc). For this reason, I tried to do a high-level "tutorial" on how to build a gadget using libsnark (see: https://github.com/AntoineRondelet/libsnark-playground) in order for me to look into libsnark and get familiar with the way the protoboard works and how we can generate constraints and a witness.

While this tutorial might be imprecise at some points, or just completely wrong, I think it is important to make this library easier to use by enhancing the documentation. My view is that the current lack of documentation makes the library pretty hard to use for a developer who might just want to use it to build gadgets for his app (not saying that building "production ready" software that uses a library without understanding anything about this library is the best idea though..). Eg: I have stumble upon a few cases where the argument of pb.set_input_sizes(); was not set to the good number of primary inputs for instance, which included some auxiliary inputs as primary inputs...

This might be the kind of things the tuto can help fix (?)

Happy to discuss it/help writing the tuto if you feel this is a good idea :)

AntoineRondelet commented 5 years ago

Looks like I missed this tutorial by Christian Lundkvist and Sam Mayo that gives a good introduction on how the library works.