Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pmuens/cairoground

Cairo and StarkNet Playground
https://github.com/pmuens/cairoground

cairo dapp smart-contract smart-contracts starknet starkware zk-rollup

Last synced: 30 days ago
JSON representation

Cairo and StarkNet Playground

Awesome Lists containing this project

README

        

# Cairo Playground

## Setup

1. [Build Protostar](#building-protostar)
2. `git clone `
3. `mkdir bin`
4. [Setup Binary](#binary-setup)
5. `nix-shell`
6. `starknet-devnet`

_Optional_: Update the `cairo.cairoFormatPath` property in the `.vscode/settings.json` file. Run `which cairo-format` within a Poetry shell to get the project-specific `cairo-format` path.

_Optional_: Update the `python.formatting.blackPath` property in the `.vscode/settings.json` file. Run `which black` within a Poetry shell to get the project-specific `black` path.

## Useful Commands

```sh
# Nix
nix-shell

# StarkNet DevNet
starknet-devnet

# Protostar
./protostar init [--existing]
./protostar test ./tests [--safe-collecting]
./protostar build
./protostar install
./protostar install
./protostar update
./protostar update
./protostar remove
./protostar deploy ./build/.json --network [--inputs ...]

# With `protostar.toml` Updates
./protostar -p testnet deploy ./build/.json

# Symlinks
ln -sf ./bin/dist/protostar/protostar protostar
```

## Useful Resources

### StarkNet

- https://starknet.io
- https://starknet.io/what-is-starknet
- https://starknet.io/building-on-starknet
- https://starknet.io/building-on-starknet/developer-tools
- https://starknet.io/playground
- https://docs.starknet.io/docs/Intro
- https://starknet-ecosystem.com
- https://github.com/gakonst/awesome-starknet

### Cairo

- https://docs.starknet.io
- https://cairo-lang.org
- https://cairo-lang.org/docs
- https://cairo-lang.org/playground
- https://cairo-by-example.org

### Protostar

- https://docs.swmansion.com/protostar
- https://github.com/onlydustxyz/protostar-vs-nile
- https://github.com/software-mansion/protostar/tree/master/website/docs

## Building Protostar

1. `git clone [email protected]:software-mansion/protostar.git`
2. `cd protostar`
3. `touch shell.nix`
4. Update `shell.nix` file (see below)
5. `nix-shell`
6. `python -m venv .venv`
7. `source .venv/bin/activate`
8. `pip install --upgrade pip`
9. `pip install poetry`
10. `poetry install`
11. `poe test`
12. `poe build`

Binaries can be found in the `dist` directory.

### `shell.nix` file

```nix
# shell.nix file
{ pkgs ? import { } }:

with pkgs;

mkShell {
buildInputs = [
python37Full
darwin.apple_sdk.frameworks.Accelerate
gmp
];
}
```

## Binary Setup

**Note:** Requires the binary to be built (see above).

1. `cd `
2. `cp -r dist/ ~/Desktop/`
3. `cd ~/Desktop`
4. `mv ./dist /bin`
5. `ln -sf ./bin/dist/protostar/protostar protostar`
6. `./protostar test`