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.
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.
Two other dependencies are needed to lint the ink! contract. This is done to warn users about using e.g. API's in a way that could lead to security issues.
cargo install cargo-dylint dylint-link
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 --force --locked
--force to ensure you are updated to the most recent
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 nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
Installing The Substrate Smart Contracts Node
It's a comfortable option if you want to get a quickstart. You can download a binary from our releases page (Linux and Mac). Alternatively you can build the node by yourself:
cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git --tag v0.12.0 --force --locked