> ## Documentation Index
> Fetch the complete documentation index at: https://docs.axiom.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Reproducible Builds

> Building OpenVM programs deterministically

export const RUST_NIGHTLY = "nightly-2025-08-02";

export const CARGO_TOOLCHAIN = "1.90";

export const OPENVM_VERSION = "v1.5.0";

Using OpenVM securely requires deterministic program compilation, which enables users to verify that OpenVM binaries correspond to the original programs they are interested in.
On the Axiom Proving API, we achieve this by running the compilation process in a Docker container.
We use the following host and guest versions of Rust:

* The host architecture is `linux/amd64` with Rust {CARGO_TOOLCHAIN}.0: `rustc {CARGO_TOOLCHAIN}.0 (05f9846f8 2025-03-31)`.
* The guest target is `riscv32im-risc0-zkvm-elf` with Rust {RUST_NIGHTLY}: `rustc {CARGO_TOOLCHAIN}.0-nightly (a567209da 2025-02-13)`.

The resulting RISC-V ELF is then transpiled to an OpenVM binary.
See [the OpenVM documentation](https://docs.openvm.dev/book/writing-apps/compiling-a-program) for more details about this build process.

## Reproducing a Build

To replicate a build done on the Axiom Proving API, follow the following steps. Before
running them, make sure you have [`cargo-openvm`](https://docs.openvm.dev/book/getting-started/install)
and [Docker](https://docs.docker.com/engine/install/) installed.

1. Download the program source code (a `tar.gz` file) and the OpenVM config (a `openvm.toml` file) from the Axiom Proving API console program page.
2. Prepare the following files locally:

An executable script (`compile.sh`), that compiles a program and puts the output in the `output` directory:

```bash compile.sh theme={null}
#!/bin/bash

cd YOUR_PROGRAM_NAME  # this is the directory name of your program
cargo openvm build
cp openvm/app.vmexe ../output/
```

And the `Dockerfile`.
Note that `--platform=linux/amd64` on the first line is necessary to guarantee that the build is identical.

<CodeBlock language="dockerfile" filename="Dockerfile">
  {`FROM --platform=linux/amd64 rust:${CARGO_TOOLCHAIN}.0-bookworm@sha256:300ec56abce8cc9448ddea2172747d048ed902a3090e6b57babb2bf19f754081

    # These subcommands must be run in the same command to avoid a cross-device linking error
    RUN rustup toolchain install nightly-x86_64-unknown-linux-gnu && \\
      rustup install ${RUST_NIGHTLY} && \\
      rustup component add rust-src --toolchain ${RUST_NIGHTLY}-x86_64-unknown-linux-gnu

    RUN cargo +${CARGO_TOOLCHAIN} install --locked --git http://github.com/openvm-org/openvm.git --tag ${OPENVM_VERSION} cargo-openvm

    COPY openvm.toml ./openvm.toml

    COPY program.tar.gz ./program.tar.gz
    RUN tar -xzf program.tar.gz

    COPY compile.sh ./compile.sh

    CMD ["./compile.sh"]`}
</CodeBlock>

3. And then run these commands:

```bash theme={null}
docker build -f Dockerfile . -t my-reproducible-build:latest

mkdir -p output
docker run -v $(pwd)/output:/output my-reproducible-build:latest
```

4. Finally, download the OpenVM exe from the Axiom Proving API console and confirm that it matches what you obtained locally.

```bash theme={null}
diff output/app.vmexe your-downloaded-exe
```
