karol-bisztyga / cairo-rs

cairo-rs is a Rust implementation of the Cairo VM. Cairo is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly. Cairo and similar proof systems can be used to provide scalability to blockchains.

Home Page:https://lambdaclass.github.io/cairo-rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cairo-rs

rust benchmark codecov

cairo-rs is a Rust implementation of the Cairo VM. The project used to be called cleopatra-cairo but after being feature complete we decided it was clearer to call the vm cairo-rs.

The code of the original Cairo VM can be found here.

Dependencies

  • Rust
  • Cargo
  • PyEnv for running the original VM and compiling cairo programs

Running cairo-rs

Compile with cargo build --release, once the binary is built, it can be found in target/release/ under the name cairo-rs-run. To run a compiled json program through the VM, call the executable giving it the path and name to the file to be executed.

Full compilation and execution example:

git clone https://github.com/lambdaclass/cairo-rs.git
cd cairo-rs

cargo build --release
./target/release/cairo-rs-run tests/support/fibonacci_compiled.json

WebAssembly

A demo on how to use cairo-rs with WebAssembly can be found here.

Testing

Run the test suite:

make test

Code Coverage

Track of the project's code coverage: Codecov.

cairo-rs benchmarks:

Running a Cairo program that gets the 1000th Fibonacci number we got the following benchmarks:

Run the benchmark suite with cargo:

cargo bench

Cairo

Original Cairo VM Internals

We wrote a document explaining how the Cairo VM works. It can be found here.

Compilers and interpreters

These is a list of recommended books to learn how to implement a compiler or an interpreter.

Computational integrity and Zero Knowledge Proofs

Basics

ZK SNARKs

STARKs

Introduction:

Vitalik Buterin's blog series on zk-STARKs:

Alan Szepieniec's STARK tutorial:

StarkWare's STARK Math blog series:

Possible changes for the future

  • Make the alloc functionality an internal feature of the VM rather than a hint.

About

cairo-rs is a Rust implementation of the Cairo VM. Cairo is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly. Cairo and similar proof systems can be used to provide scalability to blockchains.

https://lambdaclass.github.io/cairo-rs

License:MIT License


Languages

Language:Rust 89.7%Language:Cairo 9.7%Language:Makefile 0.3%Language:Python 0.2%Language:Shell 0.1%