kroma-network / circom-example

0 stars 0 forks source link

Circom Example

Prerequisites

  1. Update submodules.

    git submodule update --init
  2. Install prerequisite for Tachyon by following the instructions.

  3. Install snarkjs.

    npm install -g snarkjs@latest
  4. Prepare .bazelrc.user.

    • On Linux

      echo "build --config linux" > .bazelrc.user
      echo "build --@kroma_network_tachyon//:has_openmp" >> .bazelrc.user
      echo "build -c opt" >> .bazelrc.user
    • On Macos ARM64(After M1)

      echo "build --config macos_arm64" > .bazelrc.user
      echo "build -c opt" >> .bazelrc.user
    • On Macos x86(Before M1)

      echo "build --config macos_x86_64" > .bazelrc.user
      echo "build -c opt" >> .bazelrc.user
  5. Sync the rust dependencies.

    CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index

Circuit Descriptions

How to run

bazel run //src/{circuit_dir}:prover_main

{circuit_dir} should be one of these: adder, multiplier_2, multiplier_3 or sha256_512.

How to compile circom

This task is automatically called when running //src/{circuit_dir}:prover_main, but you can also compile a circuit manually like this example below.

bazel build //circuits/multiplier_2:compile_multiplier_2_main

As a result, these 3 files are generated.