Building Proof Function

To build a circom proof function, use the 'build' command option of the toolkit and specify the path to the circom file.

Building a circom function is a very compute-intensive task, thus this can take several minutes depending on the performance of your computer.

Below is an example of how to build the proof function for the PayPal subscription payment:

$ ./ozki-toolkit.sh build zkp/proof-functions/ProvePayPalSubscriptionMain.circom
Creating zkp/proof-functions/ProvePayPalSubscriptionMain.out
Building ProvePayPalSubscriptionMain.circom
template instances: 39
non-linear constraints: 8317
linear constraints: 1
public inputs: 0
public outputs: 2
private inputs: 568
private outputs: 0
wires: 8810
labels: 59274
Written successfully: ProvePayPalSubscriptionMain.out/ProvePayPalSubscriptionMain.r1cs
Written successfully: ProvePayPalSubscriptionMain.out/ProvePayPalSubscriptionMain.sym
Written successfully: ProvePayPalSubscriptionMain.out/ProvePayPalSubscriptionMain_cpp/ProvePayPalSubscriptionMain.cpp and ProvePayPalSubscriptionMain.out/ProvePayPalSubscriptionMain_cpp/ProvePayPalSubscriptionMain.dat
Written successfully: ProvePayPalSubscriptionMain.out/ProvePayPalSubscriptionMain_cpp/main.cpp, circom.hpp, calcwit.hpp, calcwit.cpp, fr.hpp, fr.cpp, fr.asm and Makefile
Written successfully: ProvePayPalSubscriptionMain.out/ProvePayPalSubscriptionMain_js/ProvePayPalSubscriptionMain.wasm
Everything went okay, circom safe
^C
hikari@beautiful-dreamer:~/ozki/ozki-toolkit$ ./ozki-toolkit.sh build zkp/proof-functions/ProvePayPalSubscriptionMain.circom 
Creating zkp/proof-functions/ProvePayPalSubscriptionMain.out
Building ProvePayPalSubscriptionMain.circom
template instances: 39
non-linear constraints: 8317
linear constraints: 1
public inputs: 0
public outputs: 2
private inputs: 568
private outputs: 0
wires: 8810
...
... deleted for clarity
...
[DEBUG] snarkJS: Applying key: L Section: 0/8807
[DEBUG] snarkJS: Applying key: H Section: 0/16384
[INFO]  snarkJS: Circuit Hash: 
		63d1f8ae 2e2cdb28 a1391afa 6983a72a
		c9e9ba6b 15d25e76 bf32c529 edee69e5
		55b0e16f 1fcd7b42 3722c96a fcc0a88f
		e3e2275d 9aee392b 41b520fe 8ebc0de7
[INFO]  snarkJS: Contribution Hash: 
		ab9d06af 4b84e900 dc5dd7f4 a7a16943
		19476cd2 a08af0ec 1619019a 2bb58616
		e55551c8 b4400c4b e0406806 733ca235
		6e05f06f a3b7f2c5 5c24d1b3 429bec1d

The ozki-toolkit builds a circom proof function into three zkp components:

  • The wasm file This file has the same base filename as the circom file and ends with .wasm. The file is placed under proof-generator/static directory.

  • The proving key file This file has the same base filename as the circom file and ends with .zkey. Similar to the wasm file, this file is also placed under proof-generator/static directory. Both the wasm and proving key files are used by the proof generator component.

  • The verification key file This file has the same base filename as the circom file and ends with .json. The file is placed under proof-verifier/static directory because it is used by the proof verifier component.

You can build multiple circom proof functions for the toolkit. All the built zkp components will be included inside the toolkit-lib package.

Last updated