Coder Social home page Coder Social logo

babysnark's Introduction

BabySNARK

The simplest possible SNARK for NP. You know, for kids!

This is a self-contained development of SNARKs for NP. It is based on Square Span Program SNARKs by Danezis et al., which are expressive enough to encode boolean circuits.

This code accompanies a tutorial on defining and analyzing the security of a SNARK, focusing on the soundness proof. (writeup.)

Recommended usage

This is for educational purposes only. It's not efficient overall compared to state-of-the-art SNARK implementations, it doesn't come with a type system or any program analysis to rule out mistakes, and it doesn't support the zero-knowledge feature. It does, however, demonstrate some important SNARK design concepts and algorithm optimizations. It's succinct: the proof is constant size, and verifying it depends only on the size of statement, not the circuit and witness. It also achieves quasilinear overhead, through the use of FFT-based optimizations.

So, use it to study how SNARKs can be implemented, and to check your understanding of the accompanying tutorial As a project, consider extending this library to implement additional optimizations or protocol variants. This may also be useful in development for prototyping and reference implementations.

Components

Setting up

This uses Python3. There are a few python dependencies, mainly numpy and py_ecc, an implementation of pairing cryptography including bls12-381.

pip install -r requirements.txt

To run:

python babysnark.py
python babysnark_opt.py

To rebuild the jupyter notebooks:

py2nb babysnark.py
py2nb babysnark_opt.py
py2nb polynomial_evalrep.py

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.