Skip to content

Instantly share code, notes, and snippets.

@cryptoleek-eth
Last active December 5, 2022 07:13
Show Gist options
  • Save cryptoleek-eth/0171e92f01d68454b5619f4ca10d42bf to your computer and use it in GitHub Desktop.
Save cryptoleek-eth/0171e92f01d68454b5619f4ca10d42bf to your computer and use it in GitHub Desktop.
Starknet DEV ENV Cheat Sheet

install build tools

xcode-select --install

install brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

install python3.9

brew install python@3.9 git gmp

install cairo

python3.9 -m venv ~/cairo_venv
source ~/cairo_venv/bin/activate
pip3 install ecdsa fastecdsa sympy cairo-lang

install cairo-nile

pip3 install cairo-nile

start your local dev env

nile node [--host HOST] [--port PORT] [--seed SEED] [--lite_mode]

optional arguments:
--host HOST         Specify the address to listen at; defaults to
                    127.0.0.1 (use the address the program outputs on
                    start)
--port PORT         Specify the port to listen at; defaults to 5050
--seed SEED         Specify the seed for randomness of accounts to be
                    deployed
--lite-mode         Applies all lite-mode optimizations by disabling
                    features such as block hash and deploy hash
                    calculation

install protostar

curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash

init your protostar project

protostar init $your-project-name

protostar build

protostar build

protostar declare

protostar -p devnet declare ./build/main.json

protostar deployment

protostar -p devnet deploy ./build/main.json

protostar call smartcontract

protostar -p devnet call --contract-address 0x002e7346573649bb46a072fb096de32d285e32117fb2eb7f216d14c2225fc47b --function "get_balance"

protostar invoke smartcontract

protostar -p devnet invoke --contract-address 0x002e7346573649bb46a072fb096de32d285e32117fb2eb7f216d14c2225fc47b --function "increase_balance" --account-address 0x01Cd5BB99c2C9A21A1659DF945d5711D874627a98E849A1a435b879ebAE68115 --max-fee auto --inputs 3 --private-key-path ./.pkey

protostar.toml

[project]
protostar-version = "0.7.0"
lib-path = "lib"

[contracts]
main = ["src/main.cairo"]

[format]
target = ["src", "tests"]
ignore-broken = true

[profile.devnet.project]
gateway-url = "http://127.0.0.1:5050/"
chain-id = 1536727068981429685321

# https://github.com/Shard-Labs/starknet-devnet
["profile.devnet.protostar.deploy"]
gateway-url="http://127.0.0.1:5050/"

["profile.testnet.protostar.deploy"]
network="testnet"

["profile.mainnet.protostar.deploy"]
network="mainnet"
@itachi-eth
Copy link

If the installation of fastecdsa have some issues, please use the command 'CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib pip install fastecdsa' to install it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment