Hello, Cairo¶

“Hello, Cairo” describes Cairo for the programmer who wishes to understand what Cairo can do hands-on, and start writing programs in Cairo. If you’d like a deeper dive into the building blocks of Cairo, visit How Cairo Works.

Get started with writing Cairo programs

  • Programming in Cairo
    • Your first function
    • The assert statement
    • Writing a main() function
    • The primitive type - field element (felt)
    • Using array_sum()
  • The 15-puzzle
    • What we need to check
    • The Location struct
    • Verifying the validity of a single location
    • Verifying two consecutive locations
    • Verifying the list of locations
    • Adding a dummy main function
  • The 15-puzzle - cont.
    • Dictionaries/maps in Cairo
    • Preparing the list of DictAccess entries
    • Final state
    • Initial state
    • Putting it all together
  • Program input and hints
    • Hints
    • Program input
    • Running the program
    • Taking advantage of nondeterminism
  • Voting system
    • Generating dummy data
    • Processing the program input
    • Verifying that the votes are signed
    • Merkle tree
    • Processing the votes
    • The main() function
    • Another batch
  • A simple Automated Market Maker (AMM)
    • Accounts
    • Modifying an account
    • Swapping Tokens
    • The transaction loop
    • Computing the Merkle roots
    • Preparing the program input
    • The main() function
 
  • ← A simple Automated Market Maker (AMM)
  • Programming in Cairo →

Cairo

Navigation

  • StarkNet and Cairo Documentation
  • Setting up the environment
  • Hello, StarkNet
  • Hello, Cairo
    • Programming in Cairo
    • The 15-puzzle
    • The 15-puzzle - cont.
    • Program input and hints
    • Voting system
    • A simple Automated Market Maker (AMM)
  • How Cairo Works
  • Reference
  • Using SHARP (Shared Prover)

Related Topics

  • Documentation overview
    • Previous: A simple Automated Market Maker (AMM)
    • Next: Programming in Cairo

Quick search

©2021, StarkWare Industries Ltd.. | Powered by Sphinx 4.5.0 & Alabaster 0.7.12