1. The Cairo Book
  2. Foreword
  3. Introduction
  4. The Cairo Programming Language
  5. 1. Getting Started
    ❱
    1. 1.1. Installation
    2. 1.2. Hello, World!
    3. 1.3. Proving That A Number Is Prime
  6. 2. Common Programming Concepts
    ❱
    1. 2.1. Variables and Mutability
    2. 2.2. Data Types
    3. 2.3. Functions
    4. 2.4. Comments
    5. 2.5. Control Flow
  7. 3. Common Collections
    ❱
    1. 3.1. Arrays
    2. 3.2. Dictionaries
  8. 4. Understanding Ownership
    ❱
    1. 4.1. What is Ownership?
    2. 4.2. References and Snapshots
  9. 5. Using Structs to Structure Related Data
    ❱
    1. 5.1. Defining and Instantiating Structs
    2. 5.2. An Example Program Using Structs
    3. 5.3. Method Syntax
  10. 6. Enums and Pattern Matching
    ❱
    1. 6.1. Enums
    2. 6.2. The Match Control Flow Construct
    3. 6.3. Concise Control Flow with if let and while let
  11. 7. Managing Cairo Projects with Packages, Crates and Modules
    ❱
    1. 7.1. Packages and Crates
    2. 7.2. Defining Modules to Control Scope
    3. 7.3. Paths for Referring to an Item in the Module Tree
    4. 7.4. Bringing Paths into Scope with the use Keyword
    5. 7.5. Separating Modules into Different Files
  12. 8. Generic Types and Traits
    ❱
    1. 8.1. Generic Data Types
    2. 8.2. Traits in Cairo
  13. 9. Error Handling
    ❱
    1. 9.1. Unrecoverable Errors with panic
    2. 9.2. Recoverable Errors with Result
  14. 10. Testing Cairo Programs
    ❱
    1. 10.1. How To Write Tests
    2. 10.2. Test Organization
  15. 11. Functional Language Features: Iterators and Closures
    ❱
    1. 11.1. Closures: Anonymous Functions that Capture Their Environment
  16. 12. Advanced Cairo Features
    ❱
    1. 12.1. Custom Data Structures
    2. 12.2. Smart Pointers
    3. 12.3. Deref Coercion
    4. 12.4. Associated Items
    5. 12.5. Operator Overloading
    6. 12.6. Working with Hashes
    7. 12.7. Macros
    8. 12.8. Procedural Macros
    9. 12.9. Inlining in Cairo
    10. 12.10. Printing
    11. 12.11. Arithmetic Circuits
  17. 13. Appendix (Cairo)
    ❱
    1. 13.1. A - Keywords
    2. 13.2. B - Operators and Symbols
    3. 13.3. C - Derivable Traits
    4. 13.4. D - The Cairo Prelude
    5. 13.5. E - Common Error Messages
    6. 13.6. F - Useful Development Tools
  18. Smart Contracts in Cairo
  19. 14. Introduction to Smart Contracts
  20. 15. Building Starknet Smart Contracts
    ❱
    1. 15.1. Contract Storage
      ❱
      1. 15.1.1. Storage Mappings
      2. 15.1.2. Storage Vecs
    2. 15.2. Contract Functions
    3. 15.3. Contract Events
  21. 16. Starknet Contract Interactions
    ❱
    1. 16.1. Contract Class ABI
    2. 16.2. Interacting with Another Contract
    3. 16.3. Executing Code from Another Class
  22. 17. Building Advanced Starknet Smart Contracts
    ❱
    1. 17.1. Optimizing Storage Costs
    2. 17.2. Composability and Components
      ❱
      1. 17.2.1. Under the Hood
      2. 17.2.2. Component Dependencies
      3. 17.2.3. Testing Components
    3. 17.3. Upgradeability
    4. 17.4. L1 <> L2 Messaging
    5. 17.5. Oracle Interactions
      ❱
      1. 17.5.1. Price Feeds
      2. 17.5.2. Randomness
    6. 17.6. Other Examples
      ❱
      1. 17.6.1. Deploying and Interacting with a Voting Contract
  23. 18. Starknet Smart Contracts Security
    ❱
    1. 18.1. General Recommendations
    2. 18.2. Testing Smart Contracts
    3. 18.3. Static Analysis Tools
  24. 19. Appendix (Starknet)
    ❱
    1. 19.1. A - System Calls
  25. Cairo VM
  26. 20. Introduction
  27. 21. Architecture
  28. 22. Memory
    ❱
    1. 22.1. Non-Deterministic Read-only Memory
    2. 22.2. Segments and Relocation
  29. 23. Execution Model
    ❱
    1. 23.1. Registers
    2. 23.2. Instructions
    3. 23.3. Cairo Assembly (CASM)
    4. 23.4. State transition
  30. 24. Builtins
    ❱
    1. 24.1. How Builtins Work
    2. 24.2. Builtins List
      ❱
      1. 24.2.1. Output
      2. 24.2.2. Pedersen
      3. 24.2.3. Range Check
      4. 24.2.4. ECDSA
      5. 24.2.5. Bitwise
      6. 24.2.6. EC OP
      7. 24.2.7. Keccak
      8. 24.2.8. Poseidon
      9. 24.2.9. Mod Builtin
      10. 24.2.10. Segment Arena
  31. 25. Hints
    ❱
    1. 25.1. Structure
    2. 25.2. Hint runner
    3. 25.3. List of hints
  32. 26. Runner
    ❱
    1. 26.1. Program
      ❱
      1. 26.1.1. Program Artifacts
      2. 26.1.2. Program Parsing
    2. 26.2. Runner Mode
      ❱
      1. 26.2.1. Execution Mode
      2. 26.2.2. Proof Mode
    3. 26.3. Output
      ❱
      1. 26.3.1. Cairo PIE
      2. 26.3.2. Memory File
      3. 26.3.3. Trace file
      4. 26.3.4. AIR public input
      5. 26.3.5. AIR private input
  33. 27. Tracer
  34. 28. Implementations
  35. 29. Resources

The Cairo Programming Language

Cairo Logo Cairo Home

Starknet Smart Contracts Security