Setting up your environment

In order to interact with Starknet and compile Cairo code, you need to install several tools.

The following tools are recommended to begin developing on Starknet:

Tool name Description Documentation Code Repository

Starkli

A command-line interface that allows you to interact with Starknet.

book.starkli.rs

github.com/xJonathanLEI/starkli

Scarb

A build toolchain and package manager for Cairo and Starknet ecosystems.

docs.swmansion.com/scarb

github.com/software-mansion/scarb

Installing Starkli

The steps for installing Starkli and upgrading Starkli are identical.

Procedure
  1. Install Starkliup, the installer for the Starkli environment:

    curl https://get.starkli.sh | sh

    Starkliup should now be installed.

  2. Restart the terminal.

  3. Install Starkli:

    starkliup

    Starkli should now be installed.

  4. Restart the terminal and run the following command to verify the installation:

    starkli --version

    Starkli prints the current version.

Setting environment variables for Starkli

For the majority of flags available on Starkli you can set environment variables to make the commands shorter and easier to manage.

Setting environment variables for Starkli significantly simplifies command execution and management, thereby enhancing efficiency, readability, and control when using Starkli.

The two primary environment variables that are vital for effective usage of Starkli’s CLI are:

STARKNET_ACCOUNT

The location of the Account Descriptor file.

STARKNET_KEYSTORE

The location of the keystore file for the Signer.

Set these environment variables as follows:

export STARKNET_ACCOUNT=~/.starkli-wallets/deployer/account.json
export STARKNET_KEYSTORE=~/.starkli-wallets/deployer/keystore.json

Installing Scarb

Scarb is compatible with macOS, Linux, and Windows operating systems.

MacOS and Linux installation

The steps for installing Scarb and upgrading Scarb are identical.

Procedure
  1. Open a terminal and execute the following command:

    curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
  2. Restart the terminal and run the following command to verify the installation:

    scarb --version

Scarb should now be installed.

Windows installation

Scarb’s installation on Windows requires manual setup.

Procedure
  1. Follow the steps in the Scarb documentation.

  2. Restart the terminal and run the following command to verify the installation:

    scarb --version

Scarb should now be installed.