Git Product home page Git Product logo

demo-zk's Introduction

Demo ZK

⚠️ This is a demo project, it is not intended to be used in production. ⚠️

This project is a demo of a simple ZK application that allows verifying a proof generated using the groth16 scheme and the BLS12_381 curve.

This demo only shows the verification of a proof using BLS12_381 but BN254 is also supported in the AVM. However, Zokrates does not support BN254 curve, so a different library will be needed to generate a proof for that curve.

Use

First clone this repo down

Note: This demo requires Python >= 3.10

Node Setup

In the sandbox directory, run ./setup.sh to

  1. clone down the sandbox
  2. setup configuration, so it may run with the EC math ops
  3. start the sandbox node

Note: This will start a sandbox node using the barnjamin/ec-math-wiggle branch of go-algorand, which has the EC math ops enabled in version 8 of the AVM. The AVM version they'll be enabled with is more likely to be version 10, but this is sufficient to start testing.

Demo Setup

Install Zokrates using the instructions here.

Run the generate_proof script to generate the Verification Key and Proof

./generate_proof.sh

Note: This must be done prior to running the contract since it relies on the Verification Key and Proof generated during this step

Demo

Install python prerequisites

$ python -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install -r requirements.txt

Run the demo

(.venv) $ cd contracts 
(.venv) $ python main.py
Created app: 1
Contract verified? True

Going Further

Modify the .zok file to change the proof that is generated to something more interesting.

Generate a proof using a different library to use the BN254 curve

demo-zk's People

Contributors

barnjamin avatar

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.