Public Witnesses
By default, all witnesses generated by Vamp-IR are private. If one wants to make a variable public, they may mark such a variable explicitly using the pub
keyword. Take the following file, for example;
pub x;
x = 1;
Up front, we declare the variable, x
, to be public. If we compile the proof, during solicitation, we will see;
> * Soliciting circuit witnesses...
> ** x[5] (public):
stating that the variable is, in fact, public. If one enters 1
here, during proving they will see;
> * Reading public parameters...
> * Public inputs:
> x[5] = Fp256 "(00[...]001)"
> * Verifying proof validity...
> * Zero-knowledge proof is valid
So the public inputs are shown explicitly.
Public inputs must be put at the start of a file. If one tries the following file;
x = 1;
pub x;
they will get a parsing error during circuit compilation.
Multiple public variables can be declared at once using ,
, and multiple pub
declarations can be made so long as they're at the beginning of the file.
pub x, y, z;
pub h;
x ^ 2 + y = z;
h = z + 1;
There is not currently a way to automatically assign public values; they must be solicited.