var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=1&rec=1&url=https://docs.terra.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Terrain initial setup

This tutorial uses a Terra-specific development tool called Terrain.

Terrain will help you:

  • Scaffold your dApp project.
  • Develop and deploy smart contracts.
  • Create custom tasks for blockchain and contract interaction.
  • Access a console (or REPL) for interacting with the Terra blockchain.
  • Create predefined functions used in tasks and in the console.

Prerequisites

Set up Rust

Rust is the main programming language used for CosmWasm smart contracts. While WASM smart contracts can theoretically be written in any programming language, CosmWasm libraries and tooling work best with Rust.

  1. Install the latest version of Rust.
install-rust
Copy

_3
Rust installation instructions:
_3
_3
https://www.rust-lang.org/tools/install

  1. Set 'stable' as the default release channel.
install-rust
rust-set-up
Copy

_3
rustup default stable
_3
rustup target add wasm32-unknown-unknown
_3
cargo install cargo-run-script

  1. Add WASM as the compilation target.
install-rust
rust-set-up
Copy

_3
rustup default stable
_3
rustup target add wasm32-unknown-unknown
_3
cargo install cargo-run-script

  1. Install a package to run custom cargo scripts.
install-rust
rust-set-up
Copy

_3
rustup default stable
_3
rustup target add wasm32-unknown-unknown
_3
cargo install cargo-run-script

  1. Install the latest version of Rust.
  1. Set 'stable' as the default release channel.
  1. Add WASM as the compilation target.
  1. Install a package to run custom cargo scripts.
install-rust
CopyExpandClose

_3
Rust installation instructions:
_3
_3
https://www.rust-lang.org/tools/install

Install Terrain

  1. Use npm to install the terrain command-line tool globally.
install-terrain
Copy

_1
npm install -g @terra-money/terrain

  1. Make sure you are using the latest version of Terrain. Previous versions may cause errors.
install-terrain
Copy

_2
npm install -g @terra-money/terrain
_2
terrain --version

  1. Use npm to install the terrain command-line tool globally.
  1. Make sure you are using the latest version of Terrain. Previous versions may cause errors.
install-terrain
CopyExpandClose

_1
npm install -g @terra-money/terrain

ℹ️Terrain versions

If you installed a previous version of Terrain, make sure to update it:


_2
npm uninstall -g @iboss/terrain
_2
npm install -g @terra-money/terrain

Next steps: LocalTerra or Testnet

Depending on your setup, you can either install LocalTerra or use the Pisco testnet to power Terrain.

LocalTerra is a development environment designed to make it easy for smart contract developers to test their contracts locally. Terrain can also interact with the Terra blockchain's live testing environment, the Pisco testnet.

☢️caution

Localterra may not perform optimally on machines with less than 16 GB of RAM. Please use the Pisco testnet if your device does not meet this requirement.