Cairo: Welcome On Board

This post was originally published on StarkWare’s Medium in December 2020

A few months ago we announced Cairo, our Turing-complete framework for proving general computations. Since then we held the Cairo Genesis Workshop and presented Cairo at ZK Summit 6. Today, we are releasing the first version of the Cairo Toolchain.

Why are We Releasing this Toolchain?

When we announced Cairo, the response was overwhelmingly positive — there seems to be a real need in the ecosystem for the solutions Cairo can offer. We are releasing this toolchain because we’d like to help people learn Cairo, play around with it, and take part in making it better.

What Are We Releasing?

Toolchain

Compiler

The Cairo compiler is responsible for translating Cairo programs into Cairo bytecode (which is essentially a list of field elements).

Virtual Machine

The Cairo Virtual Machine (VM) is a piece of software that knows how to take the bytecode produced by the compiler, and run it on a computer. The output of this run is the trace of the program which can then be sent to a STARK prover in order to prove the validity of the statement expressed in the Cairo code.

Tracer

The tracer is a development tool, essentially a debugger, that shows a visual representation of the trace as the program runs. It allows the developer to look into the execution of the code in more detail and identify issues.

IDE Extensions

Vim and Visual Studio Code extensions provide syntax highlighting for Cairo. We plan to extend and improve them over time.

Supporting Materials

Documentation & Tutorial

We’ve created two paths to learn Cairo. If you’d like to start from a more hands-on experience, and simply code immediately, start with the ‘Hello, Cairo’ tutorial. It will take you from a simple Cairo program to the basics of non-deterministic programming.

Alternatively, you can begin by diving into the building blocks of Cairo and work your way up by reading How Cairo Works.

StarkEx 2.0 Cairo Code

We are releasing the Cairo code for StarkEx 2.0 (live on Mainnet, powering DeversiFi). Among other things, this code offers our best practices for writing Cairo apps.

The DeversiFi smart contract contains the Pedersen hash of the compiled StarkEx 2.0 code. You can compile it, hash it, and verify for yourself that it’s indeed what powers DeversiFi.

What’s Next?

We have big plans for Cairo, and with the developer community’s input we hope to see it grow and mature. Our immediate plans are:

  • Cairo Playground, where you can run Cairo code from your browser — coming very soon.
  • Cairo Proving Service on Testnet : To close the loop and allow developers to prove their programs, we plan to launch a Cairo Proving Service on a public testnet in March 2021. Even without the prover, the toolchain released today allows any developer to start writing and running Cairo programs today.
  • Improved IDE tools
  • Improvements to the language: add syntax, improve the standard library and the documentation.

It’s important to keep in mind that Cairo is in its very early days. As it continues to mature and improve, we will not be able to guarantee backwards compatibility. We hope and believe that taking part in the creation of a brand new programming language is worth this tradeoff.

Let’s Go

To get started, download and install the Cairo toolchain, and take a look at the documentation and tutorial. If you want to understand what a full-blown Cairo app looks like, explore the StarkEx 2.0 code. The toolchain itself and the StarkEx 2.0 code are under source available licenses.

To talk to other Cairo devs, as well as the Cairo creators, join the Cairo Discord channel.

We are excited to see what the community will create with Cairo, and are looking forward to your thoughts and feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *