Proving
Last updated
Last updated
Now that we have all the structure we need, how do we actually create a proof? In order to do this, we are going to make use of the provided MockProver
. As you play around some more you will discover more in depth methods to do the proving in the examples
folder.
Firstly we need to create an integer k
and give it a value. Generally speaking k
will represent the size of the circuit in that the number of rows in our columns does not exceed (so as long as k
is large enough you're all good).
Next we need to initialise the values that are going to go into our circuit struct.
You will also see that we initialised a value for the expected result, z
. Recall that in this tutorial circuit we check that the result created at the end is indeed what is expected (of course in most zk applications you probably don't want to know what result is expected, but here we are just exploring how the system works). Also recall that in order to enforce this check we ensure the computed result is the same as the value in the second row of the public inputs column, so guess where we have to put z
!
Now we just have to run our prover using the provided function. We also run the prover again with a different public input column to ensure that it fails (this photo shows you the whole function so you can see everything together).
Can you create a proof of the zk circuit you came up with and check it? Does it also fail under some expected circumstances?