Comment on page
Installing required tools
Before running your first smart contract on Aleph Zero, you will first need to prepare your computer for development in Rust and ink!. Here's a handy guide to get you started.
The first thing you need to do before you can deploy your first smart contract on the Aleph Zero Testnet is to prepare your computer for development in Rust and ink!.
This guide uses https://rustup.rs installer and the
rustuptool to manage the Rust toolchain. It's the default way of installing Rust and we highly recommend doing it that way. However, if you prefer a different method, please check the "Other installation methods" section on the official Rust website.
To install and configure
rustupenter the following commands in your shell:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Now you have the latest stable version of Rust installed on your computer. For the development of smart contracts you will need a slightly more recent
nightlyversion, together with some additional components:
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
Rust comes with its native package manager
cargowhich is also used for compiling Rust code. Make sure
cargois installed correctly and visible in your shell environment:
ink! is an Embedded Domain Specific Language (EDSL) that can be used to write WASM smart contracts in Rust. In other words, ink! is a collection of "add-ons" on top of Rust that modify the behavior of the language to produce, instead of regular binary code that can be executed by your computer, special WASM code compatible with Substrate-based smart contracts execution environment. Ultimately, every ink! smart contract is just a normal Rust program with a tiny bit of additional ink!-specific headers called "macros".
To start using ink! you first need to install the
binaryenpackage, which is used to optimize the WebAssembly bytecode of the contract. Most likely
binaryenis available from your default package manager:
# For Ubuntu or Debian users:
sudo apt install binaryen
# For MacOS users:
brew install binaryen
# For Arch or Manjaro users:
pacman -S binaryen
binaryenpresent you can install
cargo install --force --locked cargo-contract
cargo contractis an add-on to
cargothat extends it with commands helpful in the development of smart contracts. You can check what can be done with it by invoking
cargo contract --help. We will very soon use it to create our very first ink! smart contract.