⚠️ This project is undergoing heavy development and is still on its early stages. There will be constant breaking changes.
This project aims to implement a Cairo Virtual Machine using Go. This is one of many other implementations that are being developed and its main goals are:
- making the Starknet ecosystem secure by reducing the risk of a single critical vulnerability,
- decentralizing development and maintenance of the different VMs,
- cross-checking and validation with other implementations and
- to foster innovation through competition.
The Cairo Virtual Machine is a crucial component of the Starknet ecosystem. It serves as the runtime environment for all smart contracts on the platform. When users write contracts in high-level Cairo, it gets compiled to Sierra, and then to CASM bytecode. The VM receives this bytecode, executes it and generates a proof of execution. This proof is then sent from a sequencer to the verifier to include the transaction in a new block.
This Virtual Machine is still in development and there is no public release available yet. Currently, it is only possible to use it by building it from source by following these instructions:
- Clone the repo to your machine:
git clone https://github.com/NethermindEth/cairo-vm-go
. - Install
Go
on your PC, instructions here. - Execute on the root folder of the repo:
make build
. - Make sure everything is running smoothly by executing:
make test
.
After completing these steps, you can find the compiled VM in bin/cairo-vm
. It is worth noting that this binary, in the current state of the project, is still non-functional.
For convenience, we have created a makefile
that includes the most used commands such as make build
. To see all of them please run:
make help
We are planning on writing our documentation soon detailing how we adapt the theory of a non-deterministic machine to a deterministic one. Meanwhile, the next is a list of resources we are currently using to develop the VM.
- Cairo Zero Docs: How Cairo Works
- Whitepaper: Cairo a Turing-complete STARK-friendly CPU architecture
- A formalization of the whitepaper: A Verified Algebraic Representation of Cairo Program Execution
The previous list includes the most helpful documentation for the current state of the project but it does not represent all that is available. If you are interested in going beyond, there is this list made by LambdaClass which has a much broader scope.
- Cairo VM in Python by Starkware.
- VM in Rust, Go and C by LambdaClass.
- oriac a toy VM by xJonathanLEI
If you wish to contribute please visit our CONTRIBUTING.md for general guidelines.