Cairo by example
- First setup using Nile which makes managing files and command line calls to StarkNet simple.
- Second have a look at how pytest works
- After you have set everything up, to run the examples:
- Open two terminals in the project folder and run
source env/bin/activate
- In one run
nile node
to start a local devnet. - In the other run the commands in the examples.
- Open two terminals in the project folder and run
Examples of different elements in Cairo and StarkNet.
- Hello, World!
- First application
- Array
- Data types
- Variables
- Read and write values
- Read and write tuples
- Currency
- Constructor
- Custom imports
- Contract calls
- Array argument
- Array returns
- Struct returns
YMMV Examples
These examples have core principles, but have not been tested with
cairo-lang version >0.5.0
and may not compile. I will move them to the
section above after checking them and adding nile-based notes.