SlaveCode LogoSlaveCode.
Academy
RoadmapProblemsSystem Design
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
SlaveCode LogoSlaveCode.

Standardize your coding journey. From basic academy courses and guided roadmaps to advanced system design, company interview prep, and real-time coding arenas. The all-in-one platform to master algorithms and prove your engineering excellence.

Learn & Practice

  • Academy
  • Problems
  • Roadmap
  • System Design

Compete & Tools

  • Arena
  • Contests
  • Compilers

Legal & Support

  • Report an Issue
  • Privacy Policy
  • Terms of Service
  • Contact Us

© 2026 SlaveCode. All rights reserved.

Cairo

Cairo

Cairo is a general purpose language for writing zero-knowledge provable programs, without the need for a deep understanding of zero-knowledge concepts.

Master Cairo with
Interactive Learning

Elevate your Cairo skills through 91 curated exercises across 23 core concepts. Master problem-solving with a structured learning path designed for modern developers.

Cairo

About Cairo

Cairo is a Rust-inspired language that aims to make it easy to compute trustworthy values on untrusted machines using validity proofs. It is a programming language designed for a virtual CPU of the same name, which is capable of efficiently proving the execution of any program running on it. This means that you can perform time consuming operations on a machine you don't trust, and check the result very quickly on a cheaper machine.

One major usecase of Cairo is writing smart contracts for Starknet, a Layer 2 built on top of Ethereum. Instead of having all the participants of the network verify all user interactions, only one node, called the prover, executes the programs and generates proofs that the computations were done correctly. These proofs are then verified by an Ethereum smart contract, requiring significantly less computational power, which increases throughput and reduces transaction costs while preserving Ethereum security.

Another notable use case of Cairo is in AI model training. Suppose you have a large dataset and wish to train an AI model on it but lack the necessary infrastructure. You can pay a major AI model provider to train the AI on your data and return the trained model. Since the provider used Cairo to write and train their AI model, they can produce a "proof" that you can use to verify that they did actually use the complete dataset you provided, ensuring the integrity of the training process and guaranteeing that no other data or partial data was used.

Cairo differs significantly from traditional programming languages, particularly in its execution and performance optimizations. Programs can be executed by a prover, similar to other languages, though with some performance overhead due to virtualization of the language. When proofs are verified, efficiency is crucial as verification may occur on small machines, and Cairo has various advantages to improve verification speed. A notable one is non-determinism, which is the idea that you can theoretically use a different algorithm for verifying than for computing. Take the example of sorting an array in Cairo - the prover has to sort the array, while the verifier only needs to check that the array is sorted, which is much cheaper. Additionally, Cairo's memory model is immutable, meaning values cannot be changed once written. Cairo provides abstractions that help developers work with these constraints, but it does not fully simulate mutability. This means that developers are required to be mindful of memory management and data structures to optimize performance.

The home page for Cairo is cairo-lang.org. List of Cairo resources at cairo-lang.org/documentation.html. Newcomers should start with "The Book" located at book.cairo-lang.org/.

Key Features of Cairo

Developer-friendly

Write Rust-like code and generate proofs for program execution - math isn't a barrier.

Provable

Produces provable programs, making it possible to compute trustworthy values on untrusted machines.

Efficient

Cairo compiles down to an ad-hoc assembly engineered specifically for efficient proof generation.

Immutable

Cairo uses the immutable memory model, improving data integrity and security.

General purpose

From blockchain gaming to provable ML, Cairo makes building trustless applications possible.

Innovative

Cairo is a fast-growing language that keeps delivering new and exciting features to its developers.

Track icon

Developer-friendly

Write Rust-like code and generate proofs for program execution - math isn't a barrier.

Provable

Produces provable programs, making it possible to compute trustworthy values on untrusted machines.

Efficient

Cairo compiles down to an ad-hoc assembly engineered specifically for efficient proof generation.

Immutable

Cairo uses the immutable memory model, improving data integrity and security.

General purpose

From blockchain gaming to provable ML, Cairo makes building trustless applications possible.

Innovative

Cairo is a fast-growing language that keeps delivering new and exciting features to its developers.

A taste of Cairo concepts you'll cover

Fu

Functions

In

Integers

Mu

Mutability

Th

The Boolean Type

Fe

Felt Type

Ar

Arrays

En

Enums

Ma

Match Basics

Co

Control Flow

St

Strings

Di

Dictionaries

Ow

Ownership

St

Structs

Re

References and Snapshots

Mo

Modules

Me

Method Syntax

Tr

Traits

Pr

Printing

Th

The Tuple Type

Ge

Generic Types

Op

Option

Ty

Type Conversion

Op

Operator Overload

Er

Error Handling

Sm

Smart Pointers

As

Associated Items

Dive into Cairo practice challenges

Hello World
Hello World
Level 1

SlaveCode's classic introductory exercise. Just say "Hello, World!".

Reverse String
Reverse String
Level 1

Reverse a given string.

Acronym
Acronym
Level 2

Convert a long phrase to its acronym.

Atbash Cipher
Atbash Cipher
Level 2

Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.

Collatz Conjecture
Collatz Conjecture
Level 2

Calculate the number of steps to reach 1 using the Collatz conjecture.

Bob
Bob
Level 2

Bob is a lackadaisical teenager. In conversation, his responses are very limited.