Home

Awesome

cairo-by-example • tests & lints GitHub GitHub package.json version Vercel Deployment

Verbosely Documented, Minimal Starknet Contract Examples.

Cairo By Example deployed to https://cairo-by-example.xyz

Developing

Clone the repository

git clone git@github.com:a5f9t4/cairo-by-example.git
cd cairo-by-example

Install Dependencies

yarn

Run locally

yarn dev

Contracts

Contracts are defined and available for extensible use in the contracts subdirectory.

Usage

First time?

Further installation instructions provided in the cairo-lang docs

Before installing Cairo on your machine, you need to install gmp:

sudo apt install -y libgmp3-dev # linux
brew install gmp # mac

If you have any troubles installing gmp on your Apple M1 computer, here’s a list of potential solutions.

For VSCode support:

Download cairo-0.6.2.vsix from https://github.com/starkware-libs/cairo-lang/releases/tag/v0.6.2

And run:

code --install-extension cairo-0.6.2.vsix

Set up the environment

cd into it and create a Python virtual environment:

python3 -m venv env
source env/bin/activate

Nile

Install the Nile dev environment and then run install to get the Cairo language, a local network, and a testing framework.

pip3 install cairo-nile
nile install

Compile the contracts

nile compile

Run tests

pytest

Acknowledgements

Security

This project is still in a very early and experimental phase. It has never been audited nor thoroughly reviewed for security vulnerabilities. Not recommended for production use.

Please report any security issues you find by opening up an issue in this reposisitory.

License

Cairo-by-example Contracts are released under the AGPL-3.0-only.