Local environment setup
This guide walks through setting up a Starknet development environment, creating a project, and compiling your first smart contract.
Install toolchain with starkup
Run this one-time setup command to install essential Starknet tools:
curl --proto '=https' --tlsv1.2 -sSf https://sh.starkup.dev | sh
This installs:
- Scarb - Cairo package manager
- Starknet Foundry - Testing framework
- Cairo Language Server - for IDE support
- Additional compiler, profiling and coverage tools
Create new project with scarb
Create a new Starknet project with Scarb:
scarb new my_starknet_project
When prompted, select Starknet Foundry as the test runner.
Scarb version should matches Cairo version:
cd my_starknet_project
scarb --version
Take a look at the generated Scarb.toml
file. It manages:
- Project metadata
- Dependencies and workspace configuration
- Build profiles, compiler settings
- Project and tool configurations
Compile smart contract with scarb build
The template includes a starter HelloStarknet
contract in src/lib.cairo
. Compile it with:
scarb build
Compilation artifacts can be found in target/dev/
, where dev
is the default build profile:
my_starknet_project_HelloStarknet.contract_class.json
- The contract class
Next steps
You're now ready to modify the sample contract in lib.cairo
.
We will cover the rest of the tools in the next sections.
As a bonus step, we recommend you to explore the Scarb documentation