GithubHelp home page GithubHelp logo

gmh5225 / zkllvm-knazarov-playground Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nilfoundation/zkllvm-knazarov-playground

0.0 0.0 0.0 30 KB

Konstantin Nazarov's zkllvm playground

C++ 2.01% Nix 97.99%

zkllvm-knazarov-playground's Introduction

A zkllvm playground compiled with Nix

I've written this Nix flake to be able to play with zkllvm without installing lots of dependencies. It can also be used to test whether or not latest versions of all repositories build together.

Getting started

To get a shell with the zkllvm and a prover, just do this:

nix develop

And wait for about 30 minutes. It will drop you to a shell where the "clang" binary would point to the one from zkllvm toolchain.

Compiling circuits

This is how you can compile a simple circuit for a strlen function

cd example

clang -target assigner -I$ZKLLVM/include/zkllvm/c++ -I$ZKLLVM/include/zkllvm -D__ZKLLVM__ -emit-llvm -S -o circuit.ll integer_arithmetics.cpp

llvm-link -S -o final_circuit.ll circuit.ll $ZKLLVM/lib/zkllvm/zkllvm-libc.ll

assigner -b final_circuit.ll -i integer_arithmetics.inp -t assignment.tbl -c circuit.crct -e pallas

Then generate a file that is suitable for the prover:

prepare_statement.py --circuit final_circuit.ll --name strlen --type placeholder-zkllvm --private --output integer_arithmetics.json

Then generate a proof:

proof-generator --circuit_input integer_arithmetics.json --public_input integer_arithmetics.inp --proof_out proof.txt -c config.ini

zkllvm-knazarov-playground's People

Contributors

knazarov 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.