Smart Contract Development
The following tools are the recommended tools for developing Starknet smart contracts. These cover compilation, package management, testing and deployment.
Scarb: The Cairo package manager
Scarb is a package manager for Cairo, but it is much more than that. It is the easiest and recommended way to build and maintain Cairo code. Think Cargo for Rust. Scarb is developed by Software Mansion.
Scarb includes the following features:
-
Initiating a new Cairo project.
-
Compiling Cairo projects.
-
Adding and removing Cairo dependencies.
-
Generating Cairo documentation.
-
Fetching and uploading packages Scarbs.xyz, the Cairo Registry.
-
Integration with the Cairo Language Server
-
It integrates with other tools in the Cairo ecosystem, such as Starknet Foundry and the Dojo gaming engine.
Relevant links
-
GitHub: Scarb on GitHub
-
Documentation: Scarb Docs
-
Support: Scarb on Telegram
-
Cairo Registry: scarbs.xyz
Starknet Foundry
Starknet Foundry is the go-to toolchain for developing Starknet smart contracts. Similarly to its EVM counterpart, Starknet Foundry supports a plethora of features focused on testing Cairo smart contracts for Starknet.
Starknet Forge, and snforge_std
allow the use of "cheatcodes" to test various aspects of the contracts.
For example:
-
Setting caller address
-
Manipulating the timestamp and block number
-
Forking the chain at a specific block and testing with that state
-
Fuzz testing
-
Getting accurate gas and resource reports
-
Profiling
Starknet Cast is a command line tool for interacting with the Starknet network, with deep integration with Starknet Foundry projects.
With sncast
it is possible to:
-
Declare and deploy contracts
-
Read from Starknet contracts
-
Deploy accounts
-
Interact with contracts
Relevant links
-
GitHub: starknet-foundry on GitHub
-
Documentation: starknet-foundry Docs
-
Support: Starknet Foundry Support on Telegram
The Starknet Remix plugin
Remix is a browser-based integrated development environment (IDE) for Ethereum that you can use for learning, experimenting and finding vulnerabilities in smart contracts, without installing anything. The Starknet Remix plugin lets you use Remix for testing Starknet smart contracts, so you can focus on learning Cairo and Starknet in the comfort of your browser.
Remix and the Starknet Remix plugin include the following features:
-
Integrated compiling.
-
You can deploy contracts to testnet, mainnet and the pluginโs own integrated devnet.
-
You can call functions of contracts that you have already deployed, to facilitate testing and interaction.
-
The Starknet Remix Plugin is integrated with Starknet By Example, a rich repository of practical learning content.
Relevant links
Remix Project: Remix Project site.