Coder Social home page Coder Social logo

ethsnarks-jsnark's Introduction

jsnark and xjsnark for ethsnarks

This repository provides an example of integrating jsnark circuits with EthSnarks. It allows you to construct circuits using jsnark and xjsnark which can be proven on Ethereum.

Checkout this repository into the same parent directory that contains ethsnarks:

  • project-root
    • ethsnarks
    • ethsnarks-jsnark

How it Works

jsnark and xjsnark output two files:

  • Circuit instructions (ending in .arith)
  • Input values (ending in .in)

EthSnarks ships with an executable called pinocchio, this takes the .arith and .in files to generate the proving and verification keys for the circuit, and then to create a proof.

Evaluate the circuit and its inputs

pinocchio mycircuit.arith eval mycircuit.in

Generate proving key

Generates proving key file named mycircuit.pk and verification key named mycircuit.vk.json

pinocchio mycircuit.arith genkeys mycircuit.pk mycircuit.vk.json

Create proof

Uses the proving key mycircuit.pk to create a proof named mycircuit.proof.json for the inputs mycircuit.in

pinocchio mycircuit.arith prove mycircuit.in mycircuit.pk mycircuit.proof.json

Verify proof

Uses the verification key mycircuit.vk.json and the proof mycircuit.proof.json

pinocchio mycircuit.arith verify mycircuit.vk.json mycircuit.proof.json

Notes

The jsnark tool could be improved in the following ways:

  1. It's not necessary to output the values for every variable if the operations are evaluated
  2. Public inputs must be specified first in the circuit .arith file

The pinocchio tool could be improved in the following ways:

  1. If all variable values are provided by jsnark, there's no need to evaluate the circuit

ethsnarks-jsnark's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zhu1971

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.