Installation Guide for Cosmos SDK Chain Development on Windows using WSL

While it is recommended to use Mac or Linux for Cosmos SDK chain development, Windows users can set up their environment using the Windows Subsystem for Linux (WSL). This guide will walk you through installing and configuring Ubuntu on WSL, along with necessary dependencies.
Step 1: Install Ubuntu for Windows
-
Open the Microsoft Store and search for "Ubuntu".
-
Choose any Long-Term Support (LTS) version of Ubuntu and install it.
-
Once installed, launch Ubuntu. You will be prompted to set up a new user.
- Username: Choose a username, such as
ubuntu
. - Password: Choose a secure password and store it in a safe place; it's difficult to reset if forgotten.
- Username: Choose a username, such as
-
After installation, you should see a terminal prompt with your username and host computer.
Step 2: Update and Install Dependencies
Let's update your Ubuntu installation and install essential development tools. These dependencies are commonly required for Cosmos SDK development, so it's recommended to install them all at once.
sudo apt update -y
sudo apt install build-essential -y
sudo apt install gcc -y
sudo apt install wget -y
sudo apt install curl -y
Step 3: Install Golang
-
Download and install Golang:
sudo wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
-
Unpack the downloaded file to
/usr/local
:sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
Step 4: Update Environment Variables
To ensure Go is available system-wide, you need to update your environment variables.
-
Open your
.bashrc
file:nano ~/.bashrc
-
Add the following lines to the end of the file:
export GOROOT=/usr/local/go export PATH=$PATH:$GOROOT/bin export PATH=$PATH:~/go/bin
-
Save the file and exit the editor (Ctrl + X, then Y, then Enter).
-
Apply the changes:
source ~/.bashrc
-
Verify the Go installation:
go version
Step 6: Install Ignite
curl https://get.ignite.com/cli | bash
sudo mv ignite /usr/local/bin
ignite version
ignite --help
Step 7: Create (Scaffold) a basic blockchain
ignite scaffold chain yourchainname
cd yourchainname
You can now view the contents of your blockchain and begin building. Please see other tutorials to learn more.