• Stars
    star
    1,586
  • Rank 29,491 (Top 0.6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated 9 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cairo is the first Turing-complete language for creating provable programs for general computation.

Cairo 🐺

⚡ Blazing ⚡ fast ⚡ compiler for Cairo, written in 🦀 Rust 🦀


Report a Bug - Request a Feature - Ask a Question

GitHub Workflow Status Project license Pull Requests welcome

Table of Contents

About

Cairo is the first Turing-complete language for creating provable programs for general computation.

Getting Started

Prerequisites

  • Install Rust
  • Setup Rust:
rustup override set stable && rustup update

Ensure rust was installed correctly by running the following from the root project directory:

cargo test

Compiling and running Cairo files

Compile Cairo to Sierra:

cargo run --bin cairo-compile -- --single-file /path/to/input.cairo /path/to/output.sierra --replace-ids

Compile Sierra to casm (Cairo assembly):

cargo run --bin sierra-compile -- /path/to/input.sierra /path/to/output.casm

Run Cairo code directly:

cargo run --bin cairo-run -- --single-file /path/to/file.cairo

See more information here. You can also find Cairo examples in the examples directory.

For running tests specifically, see here: cairo-test

Compiling Starknet Contracts

Compile a Starknet Contract to a Sierra ContractClass:

cargo run --bin starknet-compile -- --single-file /path/to/input.cairo /path/to/output.json

Or specify the contract path if multiple contracts are defined in the same project:

cargo run --bin starknet-compile -- /path/to/input/crate /path/to/output.json --contract-path path::to::contract

Compile the ContractClass of a CompiledClass:

cargo run --bin starknet-sierra-compile -- /path/to/input.json /path/to/output.casm

Development

Install the language server

Follow the instructions in vscode-cairo.

Roadmap

The next milestone is to reach feature parity with the old Cairo version. You can track the exact progress here.

Support

Project assistance

If you want to say thank you or/and support active development of Cairo:

  • Add a GitHub Star to the project.
  • Tweet about your Cairo work.
  • Write interesting articles about the project on Dev.to, Medium or your personal blog.

Together, we can make Cairo better!

Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

Authors & contributors

For a full list of all authors and contributors, see the contributors page.

Security

Cairo follows good practices of security, but 100% security cannot be assured. Cairo is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

License

This project is licensed under the Apache 2.0.

See LICENSE for more information.

More Repositories

1

cairo-lang

Python
1,342
star
2

papyrus

Papyrus is a StarkNet full node written in Rust.
Rust
309
star
3

starkex-contracts

Solidity
276
star
4

stone-prover

C++
255
star
5

stwo

Rust
237
star
6

ethSTARK

C++
223
star
7

blockifier

Blockifier is a Rust implementation for the transaction-executing component in the StarkNet sequencer, in charge of creating state diffs and blocks.
Rust
170
star
8

starknet-specs

JavaScript
92
star
9

starkex-resources

Python
82
star
10

veedo

Solidity
77
star
11

starknet-staking

starknet-staking
Cairo
72
star
12

starkgate-frontend

Bridge interface allows users to transfer ERC20 tokens from Ethereum to StarkNet and vice versa.
JavaScript
63
star
13

starknet-api

Rust
59
star
14

starkware-crypto-utils

Signatures, keys and Pedersen hash on STARK friendly elliptic curve
TypeScript
54
star
15

formal-proofs

Lean
52
star
16

stark-perpetual

Cairo
49
star
17

starkgate-contracts

Python
35
star
18

crypto-cpp

C++
32
star
19

starkex-js

JavaScript SDK for StarkEx
TypeScript
28
star
20

starkex-for-spot-trading

Cairo
24
star
21

cairo-examples

Shell
24
star
22

stwo-cairo

Cairo
23
star
23

sequencer

Rust
23
star
24

starkex-core

21
star
25

mempool

Rust
14
star
26

starkex-data-availability-committee

Python
9
star
27

tree-sitter-cairo

JavaScript
7
star
28

starknet-snap

HTML
7
star
29

StarkNet-AllCoreDevs-Meetings

6
star
30

starkex-apps-api

6
star
31

starkex-playground

Python
6
star
32

okx-config

6
star
33

cairo-playground

Playground environment for those who want to learn and get to know Cairo language better.
JavaScript
5
star
34

davion-config

DavionLabs Perpetual StarkEx Configuration
4
star
35

starkex-resources-wip

Python
4
star
36

starknet-tutorials-erc20

3
star
37

starknet-addresses

3
star
38

starknet-tutorials-global

2
star
39

committer

Rust
2
star
40

stwo-air-schema

Shell
2
star
41

starknet-tutorials-erc721

2
star
42

dydx-config

2
star
43

starknet-tutorials-cairo-syntax

2
star
44

gammax-config

GammaX Perpetual StarkEx Configuration
2
star
45

starknet-tutorials-utils

1
star
46

x10-config

1
star
47

karpenter

1
star