Setting up your Starknet development environment
If you encounter an issue while following this tutorial, check out "Hello, Starknet!" quickstart tutorial troubleshooting. |
Introduction
Welcome to the first installment of the "Hello, Starknet!" quickstart series, the official tutorial for starting your journey as a Starknet developer! 🚀
As a popular phrase (often attributed to Abraham Lincoln) says, "Give me six hours to chop down a tree, and I will spend the first four sharpening the axe". The first installment of the series will therefore guide you through setting up your development environment, which will include the four most recommended tools to begin developing on Starknet:
-
Scarb, a build toolchain and package manager for Cairo and Starknet ecosystems
-
Starknet Foundry, the go-to framework for building and testing Starknet Smart Contracts
-
Starknet Devnet, a Rust implementation of a local Starknet node
To review these tools in more detail, as well as all other Starknet developer tools, check out the Tooling section. |
Setting up your environment on MacOS and Linux
Installing Scarb and Starknet Foundry
On MacOS and Linux, Scarb and Starknet Foundry can be easily installed using the Starkup installer by running:
curl --proto '=https' --tlsv1.2 -sSf https://sh.starkup.sh | sh
and following the onscreen instructions. You can verify that Scarb and Starknet Foundry are installed correctly by running:
scarb --version
snforge --version && sncast --version
Starkup installs Scarb and Starknet Foundry Devnet on MacOS and Linux via the If you encounter any issues while using it or have any requests, please help by submitting an issue. |
Installing Starknet Devnet
Similar to Scarb and Starknet Foundry, it is highly recommended to install Starknet Devnet on MacOS and Linux via the asdf
version manager. Luckily, if you installed Scarb and Starknet Foundry using the Starkup installer, you should already have asdf
installed. To install Starknet Devnet using asdf
:
-
Verify that
asdf
is installed:asdf --version
or install it by following the instructions in the
asdf
documentation. -
Install the
asdf
Starknet Devnet plugin:asdf plugin add starknet-devnet
-
Install the latest version of Starknet Devnet:
asdf install starknet-devnet latest
-
Set global version for Starknet Devnet:
asdf set -u starknet-devnet latest
-
Restart the terminal and verify that Starknet Devnet is installed correctly:
starknet-devnet --version
Setting up your environment on Windows
Setting up Scarb and Starknet Foundry on Windows requires configuring the Windows Subsystem for Linux (WSL) and installing the tools inside a Linux distribution such as Ubuntu.
Installing WSL and Ubuntu
-
Open PowerShell as administrator and run:
wsl --install
This command installs WSL along with the default Ubuntu distribution. If WSL or virtualization is not yet enabled, reboot and re-run the command as needed.
-
Restart your computer when prompted.
-
After reboot, launch Ubuntu from the Start menu. On the first launch, create a UNIX username and password when prompted.
If
and installing Ubuntu from the Microsoft Store. |
Installing prerequisites in Ubuntu
-
Open the Ubuntu terminal and run:
sudo apt update sudo apt install -y curl git build-essential
Installing Homebrew
-
Run the Homebrew install script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Add Homebrew to your shell environment:
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile source ~/.profile
-
Verify that Homebrew was installed correctly:
brew --version
Installing asdf
Using |
-
Install
asdf
using Homebrew:brew install asdf
-
Add
asdf
to your shell:echo '. "$(brew --prefix asdf)/libexec/asdf.sh"' >> ~/.bashrc source ~/.bashrc
-
Verify that
asdf
is installed correctly:asdf --version
Installing Scarb, Starknet Foundry, and Starknet Devnet
-
Add the Scarb plugin and install the latest Scarb version:
asdf plugin add scarb asdf install scarb latest asdf set -u scarb latest
-
Add the Starknet Foundry plugin and install the latest Starknet Foundry version:
asdf plugin add starknet-foundry asdf install starknet-foundry latest asdf set -u starknet-foundry latest
-
Add the Starknet Devnet plugin and install the latest Starknet Devnet version:
asdf plugin add starknet-devnet asdf install starknet-devnet latest asdf set -u starknet-devnet latest
-
Restart your terminal and verify that Scarb, Starknet Foundry, and Starknet Devnet were installed correctly:
scarb --version snforge --version && sncast --version starknet-devnet --version
If
scarb
,snforge
, orstarknet-devnet
are not recognized, try runningsource ~/.bashrc
or restarting your terminal.