Skip to content

Circuit Transpilers for zkLLVM provable computations compiler

License

Notifications You must be signed in to change notification settings

NilFoundation/zkllvm-transpiler

Repository files navigation

Circuits Traspiler Library for =nil; Foundation's zkLLVM circuit compiler

Run tests

Building

This library uses Boost CMake build modules (https://github.com/BoostCMake/cmake_modules.git). To actually include this library in a project it is required to:

  1. Add CMake Modules as submodule to target project repository.
  2. Add all the internal dependencies using CMake Modules as submodules to target project repository.
  3. Initialize parent project with CMake Modules (Look at crypto3 for the example)

Run examples

This library is used in the zkLLVM transpiler binary. It produces gate argument for EVM from zkllvm-assigner which consists of circuit.crct and assignment.tbl file. It can also create test proof to check gate argument by evm-placeholder-verification To build transpiler app follow zkLLVM instructions to prepare evironment and input data. Use this branch zkLLVM.

  1. Build transpiler binary file
make -C ${ZKLLVM_BUILD:-build} transpiler -j$(nproc) 
  1. Let input_folder is a folder contains transpiler input (circuit.crct and assignment.tbl file). Let output_folder is a folder for transpiler output. Run to generate gate argument files:
${ZKLLVM_BUILD:-build}/bin/transpiler/transpiler -m gen-gate-argument -i input_folder -o output_folder

Use --optimize-gates option to place small sequental gates to one .sol file Let public_input_file is a file with public input. Run to generate test proof:

${ZKLLVM_BUILD:-build}/bin/transpiler/transpiler -m gen-test-proof -i input_folder -o output_folder -p public_input_file
  1. Copy output_folder to evm-placeholder-verification/contracts/zkllvm.

  2. Run hardhat to verify proof:

npx hardhat deploy
npx hardhat verify-circuit-proof --test output_folder

Dependencies

Internal

Crypto3 suite:

zkLLVM compiler ecosystem:

External

About

Circuit Transpilers for zkLLVM provable computations compiler

Resources

License

Stars

Watchers

Forks

Packages

No packages published