Skip to content

Commit

Permalink
Additional documentation on reproducible builds (#872)
Browse files Browse the repository at this point in the history
The PR adds deterministic build motivation and additional details on to
the risczero build docs, including a link to install the Docker
dependency on desktops.

This resolves #867.

---------

Co-authored-by: Sabree Blackmon <sabree@risczero.com>
Co-authored-by: Tim Zerrell <tim.zerrell@risczero.com>
Co-authored-by: Frank Laub <flaub@risc0.com>
  • Loading branch information
4 people committed Sep 13, 2023
1 parent 05924f1 commit 1551429
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions risc0/cargo-risczero/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ After that you can verify it works via:
```bash
cargo risczero --version
```
### Docker
In order to use the `build` command, you will need `docker` available in your PATH. For developer machines, this is simple with [Docker Desktop.](https://docs.docker.com/desktop/)

## install

Expand Down Expand Up @@ -67,15 +69,22 @@ Use the `build-toolchain` command to build the toolchain locally for your host.

## build

Use the `build` command to build a guest code for the target `riscv32im-risc0-zkvm-elf`. The resulting ELF binary will be saved on `target/riscv-guest/riscv32im-risc0-zkvm-elf/docker/`. Warning: this requires having docker installed.
Use the `build` command to build guest code for the zkVM target `riscv32im-risc0-zkvm-elf` deterministically.

### Examples
The compiled ELF is saved in: `./target/riscv-guest/riscv32im-risc0-zkvm-elf/docker/`

```bash
# Build the factors example
cargo risczero build --manifest-path examples/factors/methods/guest/Cargo.toml
With this containerized build process, we ensure that all builds of your guest code, regardless of the machine or local environment, will produce the same ImageID. The ImageID, and its importance to [security,](https://dev.risczero.com/tech_faq#security) is explained in more detail in our [developer FAQ.](https://dev.risczero.com/tech_faq#zkvm-application-design)

Note: The build command requires the docker CLI installed and in your PATH.

# Build the chess example
cargo risczero build --manifest-path examples/chess/methods/guest/Cargo.toml
### Example

```bash
# Build the zkVM's test examples
cargo risczero build --manifest-path risc0/zkvm/methods/guest/Cargo.toml

ELFs ready at:
ImageID: 417778745b43c82a20db33a55c2b1d6e0805e0fa7eec80c9654e7321121e97af - "target/riscv-guest/riscv32im-risc0-zkvm-elf/docker/risc0_zkvm_methods_guest/multi_test"
ImageID: c7c399c25ecf26b79e987ed060efce1f0836a594ad1059b138b6ed2f123dad38 - "target/riscv-guest/riscv32im-risc0-zkvm-elf/docker/risc0_zkvm_methods_guest/hello_commit"
ImageID: a51a4b747f18b7e5f36a016bdd6f885e8293dbfca2759d6667a6df8edd5f2489 - "target/riscv-guest/riscv32im-risc0-zkvm-elf/docker/risc0_zkvm_methods_guest/slice_io"
```

0 comments on commit 1551429

Please sign in to comment.