Skip to main content

Setup

In case you are looking for a guided tutorial directed towards beginners please check out our Guided Tutorial.

Rust & Cargo#

A pre-requisite for compiling smart contracts is to have Rust and Cargo installed. Here's an installation guide.

ink! CLI#

The first tool we will be installing is cargo-contract, a CLI tool for helping setting up and managing WebAssembly smart contracts written with ink!.

As a pre-requisite for the tool you need to install the binaryen package, which is used to optimize the WebAssembly bytecode of the contract.

Many package managers have it available nowadays โ€’ e.g. there is a package for Debian/Ubuntu, Homebrew and Arch Linux.

If there's only an old version in your distributions package manager you can also download a binary release directly.

After you've installed the package execute:

cargo install cargo-contract --vers ^0.14 --force --locked

Use the --force to ensure you are updated to the most recent cargo-contract version.

You can then use cargo contract --help to start exploring the commands made available to you.

Substrate Framework Pre-requisites#

With ink! you can write smart contracts for blockchains built on Substrate.

Follow the official installation steps from the Substrate Developer Hub Knowledge Base to set up all Substrate pre-requisites. Once you have done this you will also need to run:

rustup component add rust-src --toolchain nightlyrustup target add wasm32-unknown-unknown --toolchain nightly

Installing The Substrate Smart Contracts Node#

The substrate-contracts-node is a simple Substrate blockchain which is configured to include the Substrate module for smart contract functionality โ€’ the contracts pallet (see How it Works for more).

It's a comfortable option if you want to get a quickstart.

cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git --tag v0.1.0 --force --locked