Installing Prerequisites
Install Go
If you do not have Go installed in your system, you can set it up by following the three easy steps listed here. The latest versions of routerd
require Go version v1.18+
.
Set up Rust
To work with CosmWasm, you'll need to make sure you have rustup installed along with a recent rustc
and cargo
version installed. Currently, we are testing on 1.58.1+
. We use rustup
to install rust since it makes maintaining dependencies and handling updates much more efficient.
Installing Rust on Mac/Linux
Step 1) Install rustup.
Step 2) Once installed, check that you have the correct version installed:
rustup default stable
cargo version
# If this is lower than 1.58.1+, update
rustup update stable
Step 3) Once rust is installed, make sure you have the wasm32
target:
rustup target list --installed
# if wasm32 is not listed after running the aforementioned command, run the following:
rustup target add wasm32-unknown-unknown
Installing Rust on Windows 10
Step 1) Download and execute rustup-init.exe
from rustup.rs.
If prompted, download and install Visual C++ Build Tools 2019, from https://visualstudio.microsoft.com/visual-cpp-build-tools/. Make sure "Windows 10 SDK" and "English language pack" are selected.
Step 2) Once installed, check that you have the correct version installed:
rustup default stable
cargo version
# If this is lower than 1.58.1+, update
rustup update stable
Step 3) Once rust is installed, make sure you have the wasm32
target:
rustup target list --installed
# if wasm32 is not listed after running the aforementioned command, run the following:
rustup target add wasm32-unknown-unknown
IDE
To develop and test smart contracts using Rust, a good IDE is a must. Currently, VSCode is the best-supported environment for RLS (Rust Language Server). Coupled with the rust-analyzer for the VSCode plugin, it makes use of the rust compiler to type-check all your code on each save.
Docker
To optimize production code and make the binary size of compiled CosmWasm contracts as small as possible, we use rust-optimizer, which uses Docker to work. Download and install Docker Desktop for your system using this link.