Kurulum
The first step is to install Cairo. We'll download Cairo through starkup, a command line tool for managing Cairo versions and associated tools. You'll need an internet connection for the download.
The following steps install the latest stable version of the Cairo compiler through a binary called Scarb. Scarb bundles the Cairo compiler and the Cairo language server together in an easy-to-install package so that you can start writing Cairo code right away.
Scarb is also Cairo's package manager and is heavily inspired by Cargo, Rust's build system and package manager.
Scarb, kodunuzu derleme (ister saf Cairo ister Starknet sözleşmeleri), kodunuzun bağlı olduğu kütüphaneleri indirme, bu kütüphaneleri derleme ve VSCode Cairo 1 uzantısı için LSP desteği sağlama gibi birçok görevi sizin için üstlenir.
Daha karmaşık Cairo programları yazdıkça, bağımlılıklar ekleyebilir ve eğer bir projeye Scarb kullanarak başlarsanız, dış kodu ve bağımlılıkları yönetmek çok daha kolay hale gelir.
Starknet Foundry is a toolchain for Cairo programs and Starknet smart contract development. It supports many features, including writing and running tests with advanced features, deploying contracts, interacting with the Starknet network, and more.
Let's start by installing starkup, which will help us manage Cairo, Scarb, and Starknet Foundry.
Installing starkup
on Linux or MacOs
If you're using Linux or macOS, open a terminal and enter the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.starkup.dev | sh
The command downloads a script and starts the installation of the starkup tool, which installs the latest stable version of Cairo and related toolings. You might be prompted for your password. If the install is successful, the following line will appear:
starkup: Installation complete.
After installation, starkup will automatically install the latest stable versions of Cairo, Scarb, and Starknet Foundry. You can verify the installations by running the following commands in a new terminal session:
scarb 2.10.1 (f190630a5 2025-02-17)
cairo: 2.10.1 (https://crates.io/crates/cairo-lang-compiler/2.10.1)
sierra: 1.7.0
$ snforge --version
snforge 0.38.0
We'll describe Starknet Foundry in more detail in Chapter 10 for Cairo programs testing and in Chapter 18 when discussing Starknet smart contract testing and security in the second part of the book.
Installing the VSCode Extension
Cairo'nun, sözdizimi vurgulama, kod tamamlama ve diğer yararlı özellikleri sağlayan bir VSCode uzantısı bulunmaktadır. Bunu VSCode Marketplace'ten kurabilirsiniz. Kurduktan sonra, uzantı ayarlarına gidin ve Dil Sunucusunu Etkinleştir
ve Scarb'ı Etkinleştir
seçeneklerini işaretlemeyi unutmayın.