# Valida zk-VM

## Prerequisites

These instructions assume that you have [installed the toolchain](https://lita.gitbook.io/lita-documentation/quick-start/installation-and-system-requirements) 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 Valida Docker image shell or the `valida-shell`.&#x20;

## 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`:&#x20;

```
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`:&#x20;

```
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 $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](https://lita.gitbook.io/lita-documentation/advanced-usage-1/zk-vm-advanced-usage) for "power user" options for the zk-VM.
