cairovm.codes – Run, Debug, and Learn Cairo Programming

Date
Monday, September 16, 2024
cairovm.codes is a web application for running and debugging Cairo programs

Introducing cairovm.codes

cairovm.codes is a powerful web application that serves both educational and debugging purposes, helping users run and explore Cairo programs while gaining a deeper understanding of their inner workings. It is especially useful for those learning Cairo, but it also functions as a capable debugger. The tool presents detailed information about the CairoVM execution and memory, while providing mappings from the execution trace to CASM, Sierra, and Cairo.

đź’ˇ cairovm.codes has now been officially recognized by Starkware. The Cairo team has integrated cairovm.codes into the official Cairo website, which you can visit at cairo-lang.org/cairovm.

How cairovm.codes Works: A Step-by-Step Guide

The app is divided into two main sections, providing a seamless way to debug Cairo programs using cairovm.codes:

  • Code Editor (Left Panel): Here, you can write arbitrary Cairo code. This allows users to quickly test their programs, making cairovm.codes a valuable tool for both learning and debugging Cairo programs.
  • Execution Details (Right Panel): After running the code, this panel displays detailed information about the CairoVM execution, enabling users to explore the program counter (PC), allocation pointer (AP), frame pointer (FP), registers, as well as the memory and function call stack.
cairovm.codes is a web application for running and debugging Cairo programs
cairovm.codes is a web application for running and debugging Cairo programs

The app also offers a three-column mode, for users interested in seeing Sierra alongside Cairo and CASM. By using the “Next” and “Previous” buttons, developers can rerun the program execution, analyzing how registers, memory, or the function call stack change over time. With each step, cairovm.codes highlights the corresponding Cairo, CASM, and Sierra code, visually showing which line of code is being executed.

For those new to Cairo and Sierra, this feature makes cairovm.codes an excellent educational tool for learning Cairo programming.

Learn More: Video by Starkware

If you’re wondering how to debug Cairo programs using cairovm.codes, Starkience has created an awesome 4-minute video that showcases all the essential features and use cases. You can view it here. The video provides a comprehensive step-by-step guide to using cairovm.codes, allowing you to get started with the tool right away.

What’s Next for cairovm.codes?

We have several exciting features in development for cairovm.codes, designed to expand the functionality and flexibility of the platform:

  • Support for Contracts: We’re working on an update to support Cairo Contracts, allowing users to move beyond simple Cairo programs and work on more complex projects.
  • Gas Breakdown: This feature will provide a visual breakdown of gas consumption at each level of execution—CairoVM, CASM, Sierra, and Cairo—helping developers optimize their code.
  • In-browser, Local Mode: We’re considering a mode that allows the app to run fully on the client side, without any dependency on Walnut’s APIs, giving developers more flexibility in how they use the tool.

Let us know which of these features excites you the most, or what additional improvements you’d like to see on cairovm.codes. Whether you’re looking to dive deeper into Cairo programming or just need a reliable way to debug your code, cairovm.codes is here to help!

With đź–¤ by Walnut