Skip to main content

Environment Setup

In order to start building a smart contract you need to first properly setup your computer.

Aura uses CosmWasm, a WebAssembly smart contract platform (or module) that integrate natively with Cosmos SDK. Smart contracts are written in RUST, compiled into Wasm then uploaded to the Aura chain.

You can learn more about CosmWasm in the official Cosmwasm document.


Prerequisitesโ€‹

To develop any smart contract you will need to you will to install Node.js. If you further want to use Rust as your main language, then you need to install rustup as well.

Node.jsโ€‹

Download and install Node.js. We further recommend to install yarn:

npm install -g yarn

Goโ€‹

Download Goโ€‹

curl -o go1.19.1.linux-amd64.tar.gz https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz

Installโ€‹

Remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extract the archive you just downloaded into /usr/local, creating a fresh Go tree in /usr/local/go:

sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz && rm -r go1.19.1.linux-amd64.tar.gz

Config environment variableโ€‹

Add to the end of ~/.bashrc the following line:

export PATH=$PATH:/usr/local/go/bin

Check version of Go using:

go version

Rustโ€‹

Install rustโ€‹

Download and install Rust using following line:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Config environment variableโ€‹

Add to the end of ~/.bashrc the following line:

export PATH="$HOME/.cargo/bin:$PATH"

Then check cargo version and update rustup:

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

You also must install cargo-generate and cargo-run-script by following commands:

cargo install cargo-generate --features vendored-openssl
cargo install cargo-run-script

wasmโ€‹

wasmd is the backbone of the CosmWasm platform. It is the implementation of a Cosmos zone with wasm smart contracts enabled.

Install the wasm32 targetโ€‹

# Check the target toolchains of rustup
rustup target list --installed
# Add the wasm toolchain
rustup target add wasm32-unknown-unknown

Run the following commands to install wasmd:

git clone https://github.com/CosmWasm/wasmd.git
cd wasmd
# If you are updating wasmd, first update your local repository by fetching the remote tags available
git fetch --tags
# replace the v0.27.0 with the most stable version on https://github.com/CosmWasm/wasmd/releases
git checkout v0.27.0
make install

Before checking version of wasmd, you must config environment variable for wasm by adding following line into the end of ./bashrc file:

export WASMD_PATH="$HOME/go/bin"
export PATH="$WASMD_PATH:$PATH"

Then, check the version of wasmd:

# verify the installation
wasmd version

Command-line toolsโ€‹

We will be using a few command-line tools extensively:

apt install jq curl

Install Aura deamonโ€‹

Aurad binary is the official client for Aura Network. To install it, you need to clone this repo:

git clone [email protected]:aura-nw/aura.git

And using makefile:

cd aura
make

The aurad bin file will be located on ${source_directory}/build/ or GO_PATH (default ~/go/bin/)

Using Aura testnet with a public nodeโ€‹

  1. Get a public node's RPC address. These can be found pinned in Discord.
  2. In ~/.aura/config/client.toml set node="https://rpc.euphoria.aura.network:443" and chain-id="euphoria-1".
  3. Create a key to use by running aurad keys add <key-name>.
  4. Get that key's public address by running aurad keys show <key-name> -a.
  5. Get some test Aura by sending $I love Aura <key-address> in the #faucet Discord channel.

You can then verify that you have funds by running aurad query bank balances <key-address>. Happy hacking!