Install Prerequisites
In this section, we will set up our machine and install the prerequisites for developing, deploying and interacting with smart contracts on STRAI Chain.
Go
You can set up Go following the official documentation. The latest versions of Sreai require go version v1.18+.
Rust
Assuming you have never worked with Rust, you will first need to install some tooling.
The standard approach is to use rustup to maintain dependencies and handle updating multiple versions of cargo and rustc, which you will be using.
Installing Rust in Linux and Mac
First, install rustup. Once installed, make sure you have the wasm32 target:
wasm32-unknown-unknown states the target specification, and is called "target triple" consisting of three strings separated by hyphens.
Strings represent architecture, vendor, and operating system respectively. unknown means there is no specifications for the target and the application is more flexible.
Installing Rust in Windows 10
Continue running rustup-init.exe, and proceed with the installation.
Optionally:
Install the wasm32 target:
Docker
Install cargo-generate package
Cargo-generate is a command-line tool used in Rust programming for generating new Rust projects from predefined templates. It allows developers to quickly set up a new project with a specific structure, dependencies, and configuration.
straichaind
straichaind is the backbone of the CosmWasm platform for Strai DuKong Chain. The binary is pre-built for both Linux and MacOS clients.
You can find all the pre-built binaries on the Strai GitHub Repo.
On Linux:
On MacOS:
You should see the following output, or similar, after executing the straichaind
command.
if you receive the following error: straichaind: error while loading shared libraries: libwasmvm.x86_64.so: cannot open shared object file: No such file or directory you will need to install the CosmWasm library libwasmvm.x86_64.so (see below).
Install CosmWasm library
If you are on a x86_64 system:
On arm64 (i.e. Apple silicon chips):
Setting up jq
jq
is a lightweight and flexible command-line JSON processor. It helps us to slice and filter and map and transform structured JSON data.
Installation will vary depending on your operating system (i.e. Linux, MacOS or Windows).
Linux (Ubuntu / Debian):
MacOS:
Windows:
Git
Git is a free and open-source version control system that allows you to track changes made to code, collaborate with others, and maintain different versions of your project. It's primarily used for source code management, but it can be used to track changes in any set of files.
Linux (Ubuntu / Debian):
MacOS:
Windows:
Setting up your IDE
We will need a good IDE for developing smart contracts with Rust. The following development environments are highly recommended and coupling them with the corresponding Rust plugins will help you learn the syntax, especially if you have no prior experience.
There are other editors out there with varying degrees of Rust support. However, unless you have a strong preference for another editor (e.g., Sublime, Emacs, Vim) , trying one of the two above is recommended, especially if you are new to Rust. Once you are confident in the language, you can always use another editor and customize it to your liking.
Last updated