1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00
A toolbox for zkSNARKs on Ethereum
Find a file
2017-08-25 14:06:27 +02:00
examples Support for inline comments added. 2017-08-25 14:06:27 +02:00
lib Serialization and curve init fixed. Proof works!!! 2017-07-06 16:08:32 +02:00
src Support for inline comments added. 2017-08-25 14:06:27 +02:00
.dockerignore Add Sub to R1CS; Add Dockerfile 2017-02-01 17:24:44 +01:00
.gitignore Add first tests of parser and equality of structs 2017-02-08 22:06:38 +01:00
build.rs Add Field and the implementation FieldPrime (not used yet) 2017-02-17 16:48:49 +01:00
Cargo.lock Add tests for all examples; Add r1cs swap_sub cases 2017-02-21 13:05:30 +01:00
Cargo.toml Add tests for all examples; Add r1cs swap_sub cases 2017-02-21 13:05:30 +01:00
Dockerfile Dockerfile compiles in release mode 2017-07-06 15:06:09 +02:00
README.md Fix README docker image name 2017-06-18 12:56:12 +02:00

VerifiableStatementCompiler

Using VerifiableStatementCompiler

Set the libsnark library path in LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Command

./code_to_r1cs program [inputs]
  • program: Path to the program that you want to be compiled.
  • inputs (optional): String of variable assignments of the inputs of a program split with whitespaces.

Example

To execute the program

def add(a, b, c):
  return a + b + c

with add(1, 2, 3), call

./code_to_r1cs program "1 2 3"

Building

Currently needs to be build with nightly Rust.

Docker

Example usage:

docker build -t verifiablestatementcompiler .
docker run -ti verifiablestatementcompiler /bin/bash
cd VerifiableStatementCompiler
./target/debug/code_to_r1cs examples/add.code "3"

With libsnark

Install libsnark to /usr/local with

make install lib PREFIX=/usr/local NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 CURVE=ALT_BN128 FEATUREFLAGS="-DBINARY_OUTPUT=1 -DMONTGOMERY_OUTPUT=1 -DNO_PT_COMPRESSION=1"

and build with

cargo build

Without libsnark

Build with the feature nolibsnark

cargo build --features nolibsnark

Testing

Run normal tests with

cargo test

and run long and expensive tests with

cargo test -- --ignored