Skip to content
/ mirage Public

A zk-SNARK for randomized algorithms + linear-size universal circuits

License

Notifications You must be signed in to change notification settings

akosba/mirage

Repository files navigation

Mirage

This is an implementation of Mirage: succinct arguments for randomized algorithms applied in the case of universal zk-SNARK circuits. This work provides linear-sized universal circuits (instead of quasi-linear) and addresses other efficiency aspects.

The implementation consists of the following.

  • MirageBackend: This is a C++ implementation of the underlying zk-SNARK built on top of libsnark.
  • MirageCircuitGenerator: This is a Java implementation for the universal circuit generation. This also includes examples for how to specify computations like matrix multiplication, merge sort, SHA-256, AES-128 and Hawk's manager circuit for an auction application. Note that specifying computations at this point requires detailed knowledge of the universal circuit structure in order to use the circuit efficiently and securely (more usability improvements and tutorials could be added in the future).

Disclaimer

This is an initial release that could contain errors. The code has not been thoroughly reviewed and it is not ready for production use. More documentation and testing are needed and will be added incrementally.

Prerequisites

  • libsnark prerequisites for MirageBackend
  • Java 8 or higher for MirageCircuitGenerator

Steps to build and run the implementation

  • Run git clone --recursive https://github.com/akosba/mirage.git

  • To set up the back end:

    • Integrate the modified and new files from MirageBackend into the libsnark directory, by running the script integrate.sh.

      cd mirage/MirageBackend

      sh integrate.sh

    • To build libsnark, run:

      cd mirage/libsnark

      mkdir build && cd build && cmake ..

      make run_universal_gg_ppzksnark

    • The executable run_universal_gg_ppzksnark will be found inside the mirage_interface directory. This executable receives two inputs: an .arith file and a .in file and runs all the steps of the protocol. Both can be generated by the MirageCircuitGenerator.

  • To set up the circuit generator:

    • cd MirageCircuitGenerator

    • mkdir -p bin

    • javac -d bin $(find ./src/* | grep ".java$")

    • To generate a small universal circuit, specify an application and run it with the above executable: java -cp bin examples.MatMulSpecifier

The output two files from the last step can be used with the executable run_universal_gg_ppzksnark above.

More details and examples will be added in the future.

About

A zk-SNARK for randomized algorithms + linear-size universal circuits

Resources

License

Stars

Watchers

Forks