Valida zk-VM

Prerequisites

These instructions assume that you have installed the toolchain and produced or obtained a Valida executable, such as by using the compiler toolchain following the instructions above. They assume that you are in the Docker shell or the valida-shell.

Executing programs

Executing (input from standard in)

To execute a program, where the path to the program executable file is $PROGRAM, and the path to write the output to is $OUTPUT:

valida run --fast $PROGRAM $OUTPUT

The input to the program will be read from stdin. The output of the program will also be written to stdout, in addition to $OUTPUT.

Executing (input from a file)

To execute a program, where the path to the program executable file is $PROGRAM, the path to write the output to is $OUTPUT, and the path to read the input from is $INPUT:

valida run --fast $PROGRAM $OUTPUT $INPUT

The output of the program will also be written to stdout, in addition to $OUTPUT.

Proving and verifying executions

Proving (input from standard in)

To prove an execution of a program, where the path to the program executable file is $PROGRAM, and the path to write the proof file to is $PROOF:

valida prove $PROGRAM $PROOF

The input to the program will be read from stdin. The output of the program will be written to stdout.

Proving (input from a file)

To prove an execution of a program, where the path to the program executable file is $PROGRAM, the path to the input file is $INPUT, and the path to write the proof file to is $PROOF:

valida prove $PROGRAM $PROOF $INPUT

The output will be written to stdout.

Verifying a proof

To verify a proof, where the path to the program executable file is $PROGRAM, the path to a file containing the claimed output is $OUTPUT, and the path to the proof file is $PROOF:

valida verify $PROGRAM $PROOF --claimed-output $OUTPUT

The result (success or an error message) will be written to stdout. The above command verifies the claim that there exists some input which, when provided to $PROGRAM, results in the program halting with output $OUTPUT. It verifies the claim by checking the provided proof, $PROOF.

Advanced usage

See zk-VM: Advanced Usage for "power user" options for the zk-VM.

Last updated