Environment Setup
Install and Configure the Rust Toolchain
Install Rust by running the following shell commands:
# Install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Configure
source ~/.cargo/env
Configure to the latest stable and add nightly + Wasm target
rustup default stable
rustup update
rustup update nightly
rustup component add rust-src
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
ink! contracts use nightly
version of Rust, so you can also set up default to nightly (optional)
rustup default nightly
Install WebAssembly Compiler & Toolchain
Binaryen is a compiler and toolchain infrastructure library for WebAssembly. WebAssembly contracts development tools require Binaryen to be installed as a pre-requisite. It is available for various package managers, for example, Debian/Ubuntu, Arch Linux, Homebrew.
- Debian/Ubuntu
- MacOS
- Using
apt-get
apt-get update
apt-get -y install binaryen
- Using
apt
apt update
apt -y install binaryen
brew install binaryen
cargo-contract
CLI
To build contracts, you will need to install cargo-contract
. You can find the installation instructions here.