Back to blog

Introducing Cairo Playground

August 27, 2024

Today, we are excited to announce a new web-based playground for Cairo!
Cairo is quickly becoming the go-to language for writing provable programs. That’s why we are thrilled to introduce a brand new playground app, purpose-built for trying and learning Cairo.
 
Cairo Playground is the best place to see Cairo in action. The default interface consists of two columns: the left side for inputting arbitrary Cairo programs and the right side for exploring (or debugging) the Cairo VM execution.
 

Quick Primer on How to Use the Cairo Playground

To get started, open Cairo Playground, which will launch with a preloaded Cairo example. Click the red “Run” button, which will compile the code and start the execution on the first Cairo VM trace item. Use the “Next/Prev” buttons to continue the execution.

How to Use the Cairo Playground

Advanced Scenario: Exploring Sierra

Sierra stands for Safe Intermediate Representation. Cairo Playground allows you to easily see Sierra for any Cairo code. Moreover, you can use the playground to explore Sierra step-by-step! To do this, click the “III” button. Then, in the new (middle) column, make sure “Sierra” is selected. Hit “Run” and use the same “Next/Prev” buttons. You will see Sierra lines highlighted to a corresponding VM trace. Note that some trace lines highlight multiple Sierra statements. That’s normal. If you want to go one-by-one in Sierra, simply change the “Name” dropdown in the rightmost column to “Name” and start over.

Exploring Sierra

The playground tool was developed by the Walnut team. If you have any feedback or suggestions for improvements, you can contact them on Telegram or submit an issue on GitHub.