Skip to main content

Build

Compiles the guest crate to a RISC-V ELF binary with the ZisK toolchain — the artifact every other cargo-zisk subcommand consumes. Covers compilation options, feature selection, and where the ELF is written.

Compile the guest crate to a RISC-V ELF binary using the ZisK toolchain. The resulting ELF is the artifact every other cargo-zisk subcommand consumes. The output path is target/elf/riscv64ima-zisk-zkvm-elf/<mode>/<program-name>, where <mode> is release or debug depending on whether --release was passed. Use --artifact-dir to also copy the ELF to a stable location for packaging or CI.

cargo-zisk build [OPTIONS]
Always use release mode for proving

Proof size and prover cost are dominated by the number of RISC-V steps your guest executes. A debug build can be 10×–100× larger in step count than the release build of the same program, which translates directly into proof time and memory. Reserve debug builds for source-level debugging and switch back to --release before running execute or prove.

Compilation Options

FlagShortDefaultDescription
--releasefalseBuild with rustc optimizations enabled. Almost always what you want. Debug builds run far more RISC-V steps under proof.
--artifact-dir <PATH>After building, copy the final ELF into this directory in addition to the standard target path.
--bin <BIN>Build only the binary named <BIN>. Pass --bin multiple times to build a subset of targets in a multi-bin crate.
--package <PACKAGE>-pIn a workspace, build only the given package (repeat -p for several). Without this flag every workspace guest builds.

Feature Selection

Cargo features the guest crate exposes. These behave identically to cargo.

FlagShortDefaultDescription
--features <FEATURES>-FNoneActivate the named features on top of the defaults. Accepts a single string with values separated by spaces or commas.
--all-featuresActivate every feature declared by the crate. Useful for CI smoke tests; usually heavier than what you need at runtime.
--no-default-featuresSkip the crate's default feature set entirely. Combine with --features to opt back in to just the ones you need.

Examples

Release build (the most common invocation):

cargo-zisk build --release

Debug build (skip --release for an unoptimized binary with symbols, useful for diagnostics):

cargo-zisk build

Copy the final ELF into a stable directory next to other release artifacts, ready for packaging or upload:

cargo-zisk build --release --artifact-dir ./dist

Build a specific binary in a crate that defines multiple [[bin]] targets (repeat --bin for more):

cargo-zisk build --release --bin prover-guest --bin verifier-guest

Outputs

The compiled ELF is written to the standard target directory by default:

target/elf/riscv64ima-zisk-zkvm-elf/<mode>/<program-name>

Use --artifact-dir to copy the final ELF to a different directory.