Setting Up Your Environment
Secret Contracts are written using the CosmWasm framework. CosmWasm contracts are written in Rust, which is later compiled to WebAssembly (or WASM for short). To write our first Secret Contract, we need to set up a development environment with all the tools required.
There are 3 main tools we will use -
  • IDE - a development environment (usually VS Code or JetBrains CLion/IDEA with Rust support)
  • SecretCLI - a command-line tool to interact with the blockchain
  • LocalSecret - a local Secret Network chain set up for development purposes
Luckily for us, there are a few ways that can help us hit the ground running without working too hard.
This Gitpod environment contains everything you need to write and interact with your first Secret Network application. To get started, make sure you have a registered GitHub account, and click here, or visit the repo
If you chose this environment, you may skip ahead to Compile and Deploy, as SecretCLI and LocalSecret are already running and set up for you, and the example contract is included as well.

JetBrains Dev Environment (Secret IDE)

The amazing folks at Digiline created a prebuilt containerized environment containing an IDE (IntelliJ IDEA) that contains everything you need to get started. If you're comfortable with JetBrains IDEs, this may be a good choice for you.
To complement Secret IDE, we will set up another docker container with LocalSecret, where we will deploy our contracts to test and play around with.
To get started, visit, or just go for it and run the IDE from docker:
docker run -p 8888:8888 -it
Then after a few seconds you will be able to access your in-browser IDE at https://localhost:8888.
Once the environment loads, clone our repository ("Get from VCS") from
Secret IDE has built-in support for both the Pulsar testnet and mainnet, but for the purposes of this guide we will be using the SecretCLI via terminal. To go the graphical route, during the compile and deploy stages you can refer to the GitHub Repository above for instructions on how to work with the IDE.
Secret-IDE is also available as a plugin for IDEA, so you can just install it from the marketplace.
Lastly, it will be helpful to configure SecretCLI by using the included "Configure secretcli" command which will set up SecretCLI to target the public testnet

Manual Install

Install Requirements

To follow along with the guide, we will be using git and make
sudo apt-get install git make
Install git:
  1. 1.
    Download the latest Git for Mac installer.
  2. 2.
    Follow the prompts to install Git.
  3. 3.
    Open a terminal and verify the installation was successful by typing git --version
Install make:
brew install make
Install git (for Windows):
  1. 1.
    Go to and the download will start automatically. Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to
Note: support for **** make on Windows is pretty shit, so we'll provide separate commands for Windows where necessary

Install Rust

Windows (PowerShell)
Windows (GUI)
curl --proto '=https' --tlsv1.2 -sSf | sh
curl -sSf | sh
Download and run rustup-init.exe.
Download and run the Rust .msi installer

Add WASM build target

rustup target add wasm32-unknown-unknown
Having Trouble? You might need to restart your terminal, or run a command like:
source "$HOME/.cargo/env"
After installing Rust to configure the current shell

Clone the Getting Started Repo

git clone

Install SecretCLI

SecretCLI is a command-line tool that helps us interact with the Secret Network blockchain. It is used to send and query data as well as manage user keys and wallets.
Windows (PowerShell)
MacOS (Intel)
MacOS (M1)
chmod +x secretcli-Linux
sudo mv secretcli-Linux /usr/local/bin/secretcli
wget -O secretcli-Windows.exe
TODO: Add `secretcli-Windows.exe` to the PATH
Download secretcli for your system here
Set the file name to secretcli and set it as executable
mv secretcli-macOS secretcli
chmod 755 secretcli
Download secretcli for your system here
Set the file name to secretcli and set it as executable
mv secretcli-macOS secretcli
chmod 755 secretcli
For a more detailed and in-depth guide on SecretCLI installation and usage, check out the documentation

Install LocalSecret

We recommend using a local chain for development purposes. LocalSecret is a complete Secret Network testnet and ecosystem containerized with Docker. It simplifies the way secret contract developers test their contracts in a sandbox before they deploy them on a testnet or mainnet. If, however, you wish to use a public testnet you can skip this section.
The installation methods differ based on the processor architecture. This is because Secret Network makes use of Intel SGX to protect private data.
x86 (Intel/AMD)
ARM (Mac M1)
docker run -it -p 9091:9091 -p 26657:26657 -p 1317:1317 -p 5000:5000 \
--name localsecret
You'll need to configure SecretCLI to work with LocalSecret
secretcli config node http://localhost:26657
secretcli config chain-id secretdev-1
secretcli config keyring-backend test
secretcli config output json
Unfortunately, even LocalSecret inside a docker cannot be run on an M1 Mac. As a workaround, we recommend using a LocalSecret instance in a Gitpod environment.
This environment is set up in such a way that can be accessed remotely as well.
To get started, simply click here.
To connect, prepend the port number with the Gitpod URL. e.g., if my workspace is at then I would be able to connect to the RPC service at
To set up SecretCLI to connect to this environment, use the following commands
secretcli config node https://26657-<your-gitpod-workspace>
secretcli config chain-id secret-testnet-1
secretcli config keyring-backend test
secretcli config output json
For more information, check the main repo at
Export as PDF
Copy link
Edit on GitHub
On this page
Gitpod Environment (Recommended)
JetBrains Dev Environment (Secret IDE)
Manual Install
Install LocalSecret