Cairo 🐺 is a blazing fast compiler for the Cairo language, written in 🦀 Rust 🦀. It provides a powerful toolset for creating provable programs for general computation, leveraging the speed and safety of Rust.


Cairo is the first Turing-complete language for creating provable programs. It is designed to support general computation in a verifiable manner.

Getting Started


To get started with Cairo, you need to install Rust. Set up Rust with the following commands:

rustup override set stable && rustup update

Ensure Rust was installed correctly by running the following command from the root project directory:

cargo test

Compiling and Running Cairo Files

Compile Cairo to Sierra:

cargo run --bin cairo-compile -- --single-file /path/to/input.cairo /path/to/output.sierra --replace-ids

Compile Sierra to CASM (Cairo assembly):

cargo run --bin sierra-compile -- /path/to/input.sierra /path/to/output.casm

Run Cairo code directly:

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

For more information and examples, refer to the examples directory in the project repository.

Compiling Starknet Contracts

Compile a Starknet Contract to a Sierra ContractClass:

cargo run --bin starknet-compile -- --single-file /path/to/input.cairo /path/to/output.json

Or specify the contract path if multiple contracts are defined in the same project:

cargo run --bin starknet-compile -- /path/to/input/crate /path/to/output.json --contract-path path::to::contract

Compile the ContractClass of a CompiledClass:

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


To develop with Cairo, install the language server by following the instructions provided in vscode-cairo.

Project Assistance

If you wish to support the development of Cairo, consider the following:

  • Add a GitHub Star to the project.
  • Tweet about your work with Cairo.
  • Write articles about the project on, Medium, or your personal blog.


Cairo follows good security practices, but 100% security cannot be assured. Cairo is provided "as is" without any warranty. Use at your own risk. For more information and to report security issues, please refer to our security documentation.

Similar Projects


  1. Home
  2. Learn Rust
  3. Get Started
  4. Practice Rust
  5. Challenges
  6. Tutorials
  7. Blog
  8. Open source
  9. Learn Gleam


  1. GitHub
  2. X


  1. Privacy Policy
  2. Terms of Service