1. The Cairo Programming Language
  2. Foreword
  3. Introduction
  4. 1. Getting Started
    1. 1.1. Installation
    2. 1.2. Hello, World!
  5. 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
  6. 3. Common Collections
    1. 3.1. Arrays
    2. 3.2. Dictionaries
  7. 4. Understanding Ownership
    1. 4.1. What is Ownership?
    2. 4.2. References and Snapshots
  8. 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
  9. 6. Enums and Pattern Matching
    1. 6.1. Enums
    2. 6.2. The Match Control Flow Construct
  10. 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
  11. 8. Generic Types
    1. 8.1. Generic Functions
    2. 8.2. Traits in Cairo
  12. 9. Testing Cairo Programs
    1. 9.1. How To Write Tests
    2. 9.2. Testing Organization
  13. 10. Error Handling
    1. 10.1. Unrecoverable Errors with panic
    2. 10.2. Recoverable Errors with Result
  14. 11. Advanced Features
    1. 11.1. Operator Overloading
    2. 11.2. Macros
  15. 12. Starknet Smart Contracts
    1. 12.1. Introduction to smart-contracts
    2. 12.2. A simple contract
    3. 12.3. A deeper dive into contracts
      1. 12.3.1. Storage Variables
      2. 12.3.2. Contract Functions
      3. 12.3.3. Contract Events
      4. 12.3.4. Reducing boilerplate
      5. 12.3.5. Optimizing storage costs
    4. 12.4. ABIs and Cross-contract Interactions
      1. 12.4.1. ABIs and Interfaces
      2. 12.4.2. Contract Dispatchers, Library Dispachers and system calls
    5. 12.5. Other examples
      1. 12.5.1. Deploying and Interacting with a Voting contract
    6. 12.6. L1 <> L2 Messaging
    7. 12.7. Security Considerations
  16. 13. Appendix
    1. 13.1. A - Keywords
    2. 13.2. B - Operators and Symbols
    3. 13.3. C - Derivable Traits
    4. 13.4. D - Useful Development Tools
    5. 13.5. E - Cairo Most Common Types and Traits
    6. 13.6. F - Installing Cairo binaries

The Cairo Programming Language

Getting Started