Circom-MPC - a project, that allows to port Circom zk-circuits to MPC circuits and to run it with a picked backend.
This topic covers two tools:
Most up to date info can be found in README.md
Aim of the project - to have a DSL that developers are familiar with - for MPC, + to port currently available circuits/protocols with no need to change the code.
Current state - supports Circom 2.1.0; has some minor bugs & not optimized (for big circuits, esp. with many loops, takes much time to compile).
Circom-2-arithc can compile circuits to both Arithmetic circuits & Boolean circuits (specified by the flag); also it has minimal support of types (e.g. MP-SPDZ's sint
| sfloat
) - the info is added to output file and e.g. can be used on a .mpc file generation stage.
Set of scripts to transpile (from Bristol to .mpc), run (with MP-SPDZ), benchmark (including remote machines benchmarking) and check accuracy of the output (used for ML circuits).
ML circuits are used as a main use-case and example for the project.
The circuits were taken from [socathie/circomlib-ml])(https://github.com/socathie/circomlib-ml), they can be ported to MPC with no changes.
As a result we executed, benchmarked and checked the accuracy for all circuits. More info on results can be found in BENCHMARK.md and ACCURACY.md.
An in-depth review of circomlib-ml-mpc can be found here. This file also contains the instruction on how we can benchmark/test the circuits.
As a part of Circom-MPC project we also were able to run synthetic and real-world ML model in MPC.
For that we used Keras2Circom. Keras2Circom allows to compile Keras model to Circom circuit - thus, having the compiler we can run Keras2Circom generated circuit in MPC.
We generated two circuits with Keras2Circom: