Koselig with Cairo

Introduction to Cairo

Cairo: Deep Dive

1. Why learn Cairo?

2. How does Cairo work?

  • Step 1: The prover takes Cairo’s execution trace, proves that it’s valid, and sends this proof to the verifier.
  • Step 2: The on-chain verifier then verifies the Proof.
  • Step 3: Next, the verifier writes a fact that attests to the proof’s validity in the fact registry contract.
  • Step 4: Finally, the dApp’s smart contract checks if this fact exists in order to rely on the computation that was executed off-chain.
Source: Cairo for Blockchain Developers
  1. At first, the Cairo program will check the word.
  2. Next, it will activate the SHARP to generate proof and verify it on-chain.
  3. After that, it’ll write a fact which is an approval stamp that this word was the right one.
  4. Lastly, Wordle’s smart contracts will check that this fact exists and pay the tokens to the winner.

3. Advantages of Cairo

  • Efficient: The Cairo instruction set was chosen so that the corresponding AIR will be as efficient as possible.
  • Practical: Cairo supports conditional branches, memory, function calls, and recursion.
  • Production-grade: Cairo is the backbone of multiple cryptocurrency systems that run over the Ethereum blockchain.
  • Builtins: The Cairo architecture supports the implementation of predefined operations directly, as a set of equations, instead of implementing them with Cairo code.
  • Efficient public memory: In Cairo’s memory implementation, each memory cell that should be shared with the verifier adds a verification cost of only 4 arithmetic operations.

Cairo in action!

BIG wins by Cairo

Source: Introduction to Cairo YT Video

Cairo 1.0

  • Sierra (Safe Intermediate Representation), a new intermediate representation layer between Cairo 1.0 and Cairo byte code.
  • A brand new compiler that will allow the developers to do more in a simpler way.
  • Overall improvement to the programming language (e.g. improved syntaxes, more intuitive libraries, better compiler integration, etc.).

Cairo across the globe

  • 🎪 Cairo 101 Workshop
  • 🗓 March 14th-15th, 2022
  • 💼 StarkWare Co-founder & President Eli Ben Sasson explaining Cairo technicalities
Source: Cairo 101 Workshop
  • 🎪 StarknetCC
  • 🗓 July 22, 2022
  • 💼 Cairo’s co-creator @PapiniShahar talks about the next evolutions of Cairo


Cairo repo

  1. StarkWare’s official Cairo documentation
  2. Learn Cairo by playing games
  3. Cairo’s GitHub Repo
  4. StarkNet Edu Newsletter
  5. CairoLang Twitter Page
  6. HackerNoon Cairo Repo
  7. Perama’s Notes
  8. StarkNet tutorials
  9. Cairo by example
  10. StarkWare’e Dev Advocate Henri’s Twitter
  11. Cairo Goldmine GitHub
  12. https://github.com/gakonst/awesome-starknet
  13. https://github.com/lightshiftdev/starknet-bootcamp

About ZKX



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



The first perpetual futures exchange built on StarkNet that offers complex financial instruments as swaps.