Installing Prerequisites

In this section, we will set up our machine and install the prerequisites for developing, deploying and interacting with smart contracts on MANTRA Chain


You can set up Go following the official documentation. The latest versions of mantrachaind require go version v1.18+.


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:

rustup default stable
cargo version
# If this is lower than 1.55.0+, update
rustup update stable

rustup target list --installed
rustup target add wasm32-unknown-unknown

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.

Read the rust docs for a more detailed explanation.

Installing Rust in Windows 10

First, download and execute rustup-init.exe from or

If requested, manually download and install Visual C++ Build Tools 2019, from . Make sure "Windows 10 SDK" and "English language pack" are selected.

Continue running rustup-init.exe, and proceed with the installation.


Install the wasm32 target:

rustup default stable
cargo version
# If this is lower than 1.55.0, update
rustup update stable

rustup target list --installed
rustup target add wasm32-unknown-unknown


mantrachaind is the backbone of the CosmWasm platform for MANTRA Hongbai Chain. During Testnet Phase 2 the binary is pre-built for Linux based clients.

Download the pre-built binary from MANTRA GitHub Repo

# Download the CLI
curl -LO

# Unzip the CLI

You should see the following output, or similar, after executing the mantrachaind command.

  mantrachaind [command]

Available Commands:
  add-genesis-account Add a genesis account to genesis.json
  collect-gentxs      Collect genesis txs and output a genesis.json file
  config              Create or query an application CLI configuration file
  debug               Tool for helping with debugging your application
  export              Export state to JSON
  gentx               Generate a genesis tx carrying a self delegation
  help                Help about any command
  init                Initialize private validator, p2p, genesis, and application configuration files
  keys                Manage your application's keys
  migrate             Migrate genesis to a specified target version
  query               Querying subcommands
  rollback            rollback cosmos-sdk and tendermint state by one height
  start               Run the full node
  status              Query remote node for status
  tendermint          Tendermint subcommands
  tx                  Transactions subcommands
  validate-genesis    validates the genesis file at the default location or at the location passed as an arg
  version             Print the application binary version information

  -h, --help                help for mantrachaind
      --home string         directory for config and data (default "/Users/<your-user-name>/.mantrachain")
      --log_format string   The logging format (json|plain) (default "plain")
      --log_level string    The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
      --trace               print out full stack trace on errors

if you receive the following error: mantrachaind: error while loading shared libraries: cannot open shared object file: No such file or directory you will need to install the CosmWasm library (see below).

Install cosmwasm library

More information can be found in here:

sudo wget -P /usr/lib

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 your operation system (i.e. Linux, MacOS or Windows).

Linux (Ubuntu / Debian):

sudo apt-get install jq


brew install jq


winget install jqlang.jq

Alternatively, see the 'Download jq' site for other options.

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.

  • VSCode offers great support for Rust, especially when coupled with the rust-analyzer extension. This extension makes use of the rust compiler to type-check all your code as you save. This gives the same error messages as the actual compiler would and highlights the errors, but it can be a bit slow to respond (as it runs the compiler). It is a solid option, particularly if you are used to VSCode.

  • The other option is IntelliJ IDEA Community Edition along with the IntelliJ Rust plugin, which has fast support for inline language features. In particular, it shows the inferred types of variables, which can be very helpful, especially when working with (nested) generics. It catches most syntax errors very quickly, but not all of them. This means sometimes you have to look at compile failures to find the errors. It is highly recommended, more so, if you are coming from another IntelliJ product (eg. Goland).

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.

CosmWasm IDE

CosmWasm IDE is a tool that simplifies CosmWasm smart contract development & deployment processes. It integrates with Gitpod & Keplr to create a simple yet powerful environment to build, deploy, and interact with CosmWasm smart contracts through default and custom networks using CosmWasm. With Gitpod, CosmWasm developers can develop smart contracts on the browser, and it is well maintained. The tool is currently maintained by Oraichain & CosmWasm.


The CosmWasm IDE consists of three sub-repositories:

  • CosmWasm Gitpod serves as a Gitpod builder which automatically builds a complete development environment including Rust installation, VS Code browser, crucial VS Code extensions, and is fully compatible with the Keplr wallet. With this repository, CosmWasm developers will not have to worry about spending hours installing tools & libraries, and they also feel secure when deploying contracts using Keplr.

  • CosmWasm IDE extension is a VS Code extension which integrates all the important functionalities related to building & deploying CosmWasm smart contracts through simple button clicks.

  • CosmWasm IDE extension webview is a React application that lies on top of the CosmWasm IDE Extension. It is responsible for connecting with the Keplr wallet and displaying inputs to deploy & interact with smart contracts. It also allows adding custom networks.

For more information, please visit the repositories on GitHub. You can also find a tutorial for CosmWasm IDE here or through the official Oraichain documentation site.

Last updated