The Cairo Book
By the Cairo Community and its contributors. Special thanks to StarkWare through OnlyDust, and Voyager for supporting the creation of this book.
This version of the text assumes you’re using Cairo version 2.11.4 and Starknet Foundry version 0.39.0. See the Installation section of Chapter 1 to install or update Cairo and Starknet Foundry.
This book is open source. Find a typo or want to contribute? Check out the book's GitHub repository.
Additional resources for mastering Cairo:
-
The Cairo Playground: A browser-based playground for Cairo, enabling to explore and experiment with Cairo by writing, compiling, debugging, and proving Cairo code without any setup
Note: You can use the Cairo Playground to experiment with the book's code snippets and see how they compile into Sierra (Intermediate Representation) and Casm (Cairo Assembly).
-
The Cairo Core Library Docs: The documentation for Cairo's Core library, the standard set of types, traits, and utilities built into the language which provides essential building blocks basic used throughout the Cairo ecosystem and is automatically available in every Cairo project
-
The Cairo Package Registry: The host for Cairo's growing collection of reusable libraries, including Alexandria, Open Zeppelin Contracts for Cairo, all of which can be easily integrated via Scarb, streamlining development and dependency management
-
The Scarb documentation: The official documentation for Cairo’s package manager and build tool, covering how to create and manage packages, use dependencies, run builds, and configure projects
-
The Cairo whitepaper: The original paper introducing Cairo by StarkWare, which explains Cairo as a language for writing provable programs, details its architecture, and shows how it enables scalable, verifiable computation without relying on trusted setups