If you encounter an issue while following this tutorial, see Troubleshooting.
Introduction
Welcome to the first installment of the Deploy your first contract guide! 🥇 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 three 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 all Starknet developer tools, see Developer tools.
Setting up your environment on MacOS and Linux
On MacOS and Linux, Scarb, Starknet Foundry and Starknet Devnet can be easily installed using the Starkup installer by running:If you prefer to install the tools manually or encounter issues with Starkup, see Setting up your environment manually on MacOS and Linux.
Starkup installs Scarb, Starknet Foundry, and Starknet Devnet on MacOS and Linux via the
asdf
version manager, which allows to easily switch between their different versions, both globally and per project (see full details in the asdf
documentation or by running asdf --help
). Alongside Scarb and Starknet Foundry, Starkup uses asdf
to install additional useful tools, including the Universal Sierra Compiler, Cairo Profiler, Cairo Coverage, and CairoLS.If you encounter any issues while using it or have any requests, please help by submitting an issue.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:
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.
wsl --install
does not work, enable WSL manually by running:Installing prerequisites in Ubuntu
-
Open the Ubuntu terminal and run:
Installing Homebrew
-
Run the Homebrew install script:
-
Add Homebrew to your shell environment:
-
Verify that Homebrew was installed correctly:
Installing asdf
Using
asdf
allows you to easily switch between versions of Scarb, Starknet Foundry, and Starknet Devnet globally or per project.-
Install
asdf
using Homebrew: -
Add
asdf
to your shell: -
Verify that
asdf
is installed correctly:
Installing Scarb, Starknet Foundry, and Starknet Devnet
-
Add the Scarb plugin and install the latest Scarb version:
-
Add the Starknet Foundry plugin and install the latest Starknet Foundry version:
-
Add the Starknet Devnet plugin and install the latest Starknet Devnet version:
-
Restart your terminal and verify that Scarb, Starknet Foundry, and Starknet Devnet were installed correctly:
If
scarb
,snforge
, orstarknet-devnet
are not recognized, try runningsource ~/.bashrc
or restarting your terminal.