Skip to content

Commit

Permalink
docs: merge verify and onchain-verify (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
PangZhi authored Dec 16, 2024
1 parent 351e068 commit b823f27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
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`.

0 comments on commit b823f27

Please sign in to comment.