Practical overview
When it fits
Use Cairo VM when a Rust project or developer workflow needs to execute Cairo programs, including programs designed for provable computation. Choose the library route for integration in a Rust application, or the CLI route for compiling and running programs as separate steps.
Who it is for
- Rust developers integrating Cairo execution into an application or tool.
- Cairo developers who want to compile programs and run the compiled output locally through a command-line interface.
- Teams building tools around provable computation that need a Cairo VM execution component.
Documented uses
- Execute compiled Cairo programs through a Rust library or command-line tool.
- Compile Cairo source into JSON and pass that output to the VM.
- Select a VM layout to determine which builtins a CLI run can use.
- Request proof-mode execution or save relocated trace and memory output from CLI runs.
Requirements & limits
- The project is a Rust library and CLI, not a hosted service; building and using it requires Rust 1.85.0 or newer and Cargo.
- Cairo source compilation is a distinct step and requires cairo-lang; the README documents make deps for creating the associated environment.
- The CLI's --layout setting controls which builtins can be used.
- The README describes --proof_mode separately from the default secure checks, which are enabled when not in proof mode.
- The repository specifies an Apache-2.0 license.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Compile and run a Cairo program with the CLI
Build the command-line tool, compile a Cairo source file to JSON, and invoke the VM on that compiled program.
Before you start
- Rust 1.85.0 or newer and Cargo.
- The cairo-vm repository and its CLI source.
- The cairo-lang package and the environment used for Cairo compilation; the README describes setting it up with make deps, with make and uv listed for optional setup.
Steps
Build the CLI from the repository's cairo-vm-cli directory with cargo build --release.
Activate the Cairo environment created during dependency setup.
Compile a .cairo file with cairo-compile, specifying an output JSON path.
Run the compiled JSON file with target/release/cairo-vm-cli and choose a --layout, which determines the available builtins.
Expected outcome
The selected compiled Cairo program is passed to the Cairo VM for execution; optional CLI arguments include proof mode and output files for relocated trace or memory.
Guide limitations
- This recipe follows the README's documented CLI flow; it does not establish compatibility for arbitrary programs or layouts.
- The documented command-line run consumes compiled JSON, so compilation is a separate prerequisite.
- The README states that secure checks are enabled by default when not in proof_mode.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 10 October 2026
- Original website title
- starkware-libs/cairo-vm · Official homepage title · retained in its source language

