Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: merge verify and onchain-verify #1089

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/src/advanced-usage/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ assert!(success);
> ⚠️ **WARNING**
> The aggregation proving key `agg_pk` above is large. Avoid cloning it if possible.

Note that `DEFAULT_PARAMS_DIR` is the directory where Halo2 parameters are stored by the `cargo openvm setup` CLI command. For more information on the setup process, see the [onchain verify](../writing-apps/onchain-verify.md) doc.
Note that `DEFAULT_PARAMS_DIR` is the directory where Halo2 parameters are stored by the `cargo openvm setup` CLI command. For more information on the setup process, see the `EVM Level` section of the [verify](../writing-apps/verify.md) doc.

> ⚠️ **WARNING**
> `cargo openvm setup` requires very large amounts of computation and memory (~200 GB).
29 changes: 0 additions & 29 deletions book/src/writing-apps/onchain-verify.md

This file was deleted.

18 changes: 14 additions & 4 deletions book/src/writing-apps/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,31 @@ svm use 0.8.19
```

### Generating the Aggregation Proving Key and EVM Verifier Contract
Generate the aggregation proving key and verifier contract at `~/.openvm/agg.pk` and `~/.openvm/verifier.sol` respectively by running

The workflow for generating an end-to-end EVM proof requires first generating an aggregation proving key and EVM verifier contract. This can be done by running the following command:

```bash
cargo openvm setup
```
> ⚠️ **WARNING**
> This command requires very large amounts of computation and memory (~200 GB).

Upon a successful run, the command will write `agg.pk` and `verifier.sol` to `~/.openvm/`, where `~` is the directory specified by environment variable `$HOME`. Every command that requires these files will look for them in this directory.

> ⚠️ **WARNING**
> If the `$HOME` environment variable is not set, this command may fail.

Note that `cargo openvm setup` may attempt to download other files (i.e. KZG parameters) from an AWS S3 bucket into `~/.openvm/`.

This command can take ~20mins on a `m6a.16xlarge` instance due to the keygen time.

### Verify proof
Verifying a proof at the EVM level requires just the proof, as the command uses the verifier generated when `cargo openvm setup` was called.
## Generating and Verifying an EVM Proof

To generate and verify an EVM proof, you need to run the following commands:

```bash
cargo openvm prove evm --input <path_to_input>
cargo openvm verify evm --proof <path_to_proof>
```

If `proof` is omitted, the command will search for the proof at `./openvm/evm.proof`.
If `proof` is omitted, the `verify` command will search for the proof at `./openvm/evm.proof`.