Running a Program
After building and transpiling a program, you can execute it using the run
command. For example, you can call:
cargo openvm run
--exe <path_to_transpiled_program>
--config <path_to_app_config>
--input <path_to_input_or_hex_input>
If --exe
is not provided, OpenVM will call build
prior to attempting to run the executable. Note that only one executable may be run, so if your project contains multiple targets you will have to specify which one to run using the --bin
or --example
flag.
If your program does not require inputs, you should omit the --input
flag.
Run Flags
Many of the options for cargo openvm run
will be passed to cargo openvm build
if --exe
is not specified. For more information on build
(or run
's Feature Selection, Compilation, Output, Display, and/or Manifest options) see Compiling a Program.
OpenVM Options
-
--exe <EXE>
Description: Path to the OpenVM executable, if specified
build
will be skipped. -
--config <CONFIG>
Description: Path to the OpenVM config
.toml
file that specifies the VM extensions. By default will search the manifest directory foropenvm.toml
. If no file is found, OpenVM will use a default configuration. Currently the CLI only supports known extensions listed in the Acceleration Using Pre-Built Extensions section. To use other extensions, use the SDK. -
--output-dir <OUTPUT_DIR>
Description: Output directory for OpenVM artifacts to be copied to.
-
--input <INPUT>
Description: Path to OpenVM program input, or a hex string containing the input as specified here. In the latter case, the hex string must be of an even length.
-
--init-file-name <INIT_FILE_NAME>
Description: Name of the generated initialization file, which will be written into the manifest directory.
Default:
openvm_init.rs
-
--mode <MODE>
Description: Execution mode. Available options are
pure
,meter
, andsegment
.- pure: Runs the program normally
- meter: Runs the program and estimates the execution cost in terms of number of cells
- segment: Runs the program and calculates the number of segments that the execution will be split into for proving (see Continuations Design)
Default:
pure
Package Selection
-
--package <PACKAGES>
Description: The package to run, by default the package in the current working directory.
Target Selection
Only one target may be built and run.
-
--bin <BIN>
Description: Runs the specified binary.
-
--example <EXAMPLE>
Description: Runs the specified example.
Examples
Running a Specific Binary
cargo openvm run --bin bin_name
Skipping Build Using --exe
cargo openvm build --output-dir ./my_output_dir
cargo openvm run --exe ./my_output_dir/bin_name.vmexe