Git Product home page Git Product logo

starknet-boilerplate's Introduction

Starknet Boilerplate

A simple environment to start building on Starknet with Cairo. Uses Nile for compilation/deployment and Starknetjs for contract invokes/calls.

Note: Mac and Mac M1 have special instructions at the bottom.

Setup

  1. Install js dependencies npm install

  2. Install the latest Nile (equivalent to hardhat) with custom port availability

python3 -m venv env
source env/bin/activate
git clone https://github.com/OpenZeppelin/nile.git
env/bin/python3 -m pip install --upgrade pip
pip install ./nile

Note: You'll run these commands every time you develop.

  1. Setup project nile init

Optional: Add the following to your ~/.zprofile to quickly spin up your environment each time: alias envsetup="python3 -m venv env; source env/bin/activate; git clone https://github.com/OpenZeppelin/nile.git; env/bin/python3 -m pip install --upgrade pip; pip install ./nile; nile init"

Usage

Ensure you're in a Python environment (see step 2 above) before executing the following commands:

  1. Spin up a node (in a separate terminal window w/ the python environment running) nile node --port localhost:5001

Note: Some systems have a conflict with port 5000 which is why I chose 5001

  1. Compiling and deploy a sample contract (in /contracts directory) npm run compile

  2. Run transactions against your contract npm run build

These commands will test and deploy against your local node. If you want to deploy to the goerli testnet, use --network goerli instead.

Starknet Setup on Mac M1

Why do we need a special install guide?

  1. M1 Macs use a new architecture which is not compatible with some dependencies (e.g. homebrew). More info*

  2. Install Homebrew

/usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Note: From here on out, you need to use arch -x86_64 brew install <package> to install packages w/ homebrew.

  1. Install required dependencies
arch -x86_64 brew install gmp
npm install
  1. Install the latest Nile (equivalent to hardhat) with custom port availability
python3 -m venv env
source env/bin/activate
git clone https://github.com/OpenZeppelin/nile.git
env/bin/python3 -m pip install --upgrade pip
pip install ./nile

Optional: Add the following to your ~/.zprofile to quickly spin up your environment each time: alias envsetup="python3 -m venv env; source env/bin/activate; git clone https://github.com/OpenZeppelin/nile.git; env/bin/python3 -m pip install --upgrade pip; pip install ./nile; nile init"

starknet-boilerplate's People

Contributors

threepwave avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.