OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Cairo

Cairo is a Turing-complete programming language for creating provable programs for general computation, paired with a compiler toolchain implemented in Rust. Its repository documents tools to compile Cairo files to Sierra and CASM, run Cairo files directly, and compile Starknet contracts.

Independent OpenViST project profile, based on linked sources.

Cairo — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Cairo when your development task involves writing provable programs, compiling or running Cairo files, or following the repository's Starknet contract compilation workflow.

Who it is for

  • Developers creating provable programs for general computation.
  • Developers compiling or running Cairo source files.
  • Starknet developers compiling contracts to Sierra ContractClass and CASM outputs.

Documented uses

  • Write programs intended for provable general computation.
  • Compile a single Cairo file to Sierra and then CASM.
  • Run a Cairo file through the documented runner.
  • Compile Starknet contracts from a project path or single-file input, with contract selection when a project defines multiple contracts.
Before you choose

Requirements & limits

The compiler repository is public and open source under the Apache-2.0 license. Building from source requires Rust, with the repository instructions specifying the stable toolchain.

  • The documented source-build path requires Rust and uses Cargo commands from the repository.
  • Cairo-to-Sierra-to-CASM compilation and direct file execution are separate documented workflows.
  • Starknet contract compilation supports project-path and single-file inputs; projects containing multiple contracts can specify a contract path.
  • The repository describes the language as Turing-complete and intended for provable general computation.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Compile and run a Cairo file

Use the documented compiler to produce Sierra and CASM outputs, or run a Cairo file directly.

Before you start

  • Install Rust and set up the stable toolchain.
  • A Cairo source file at the path used in the commands.

Steps

  1. From the repository root, compile a single Cairo file to Sierra with the command below.

    Documented command
    cargo run --bin cairo-compile -- --single-file /path/to/input.cairo /path/to/output.sierra --replace-ids
  2. Compile that Sierra file to CASM with the command below.

    Documented command
    cargo run --bin sierra-compile -- /path/to/input.sierra /path/to/output.casm
  3. Alternatively, run a Cairo file directly with the command below.

    Documented command
    cargo run --bin cairo-run -- --single-file /path/to/file.cairo

Expected outcome

The documented workflow produces Sierra and CASM files, or invokes the runner on a Cairo file.

Guide limitations

  • The commands are repository instructions; this profile does not claim they were executed or verify their results.
  • The repository points to its runner README and examples for further usage details.
Source-based practical guide

Compile a Starknet contract

Compile a Starknet contract to a Sierra ContractClass and then to CASM.

Before you start

  • Install Rust and set up the stable toolchain.
  • A Starknet contract supplied as a crate/project path or a single Cairo file.

Steps

  1. Compile a project path with the command below, or use --single-file for a .cairo input.

    Documented command
    cargo run --bin starknet-compile -- /path/to/input/crate /path/to/output.json
  2. If the project contains multiple contracts, add --contract-path path::to::contract to select one.

  3. Compile the resulting ContractClass with the command below.

    Documented command
    cargo run --bin starknet-sierra-compile -- /path/to/input.json /path/to/output.casm

Expected outcome

The documented stages create a Sierra ContractClass JSON file and a CASM CompiledClass output.

Guide limitations

  • The README documents compilation stages, not deployment or interaction with a Starknet network.
  • These instructions are source-based guidance, not a claim of successful execution.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
22 October 2026
Original website title
starkware-libs/cairo · Official homepage title · retained in its source language