How to setup your Windows PC for Substrate Development
--
I have found many new Substrate developers having trouble with setting up Substrate development environment on their Windows Machine. Personally when I had started developing on Substrate I was using the ‘Command Prompt’ or ‘Powershell’ to interact with my development node, but I quickly ran into issues. First, when using the ‘curl’ command to send some json to the node using RPC, it gives all sorts of errors. Also both of them are inconsistent when executing commands, as some commands worked one day, but next day they didn’t.
So the answer is to use ‘Windows Subsystem for Linux’ and accessing it through Visual Studio Code. Here are the following steps.
Step 1: Install Visual Studio Code
https://code.visualstudio.com/docs/setup/windows
Step 2: Install or Enable WSL
https://docs.microsoft.com/en-us/windows/wsl/install-win10
Step 3: Install Ubuntu 20.04 from Microsoft Store
https://www.microsoft.com/en-in/p/ubuntu-2004-lts/9n6svws3rx71#activetab=pivot:overviewtab
Step 4: Access WSL from VSCode
a) Click on Terminal in the VSCode Toolbar
b) Select Ubuntu 20.04 WSL from the Terminal Box Opened
Step 5: Install Rust and other dependencies
In the WSL terminal opened in VSCode, execute the following commands
# Dependenciessudo apt updatesudo apt install -y git clang curl libssl-dev llvm libudev-dev#Rust Installation
curl https://sh.rustup.rs -sSf | sh
source ~/.cargo/envsource ~/.cargo/envrustup default stablerustup updaterustup update nightlyrustup target add wasm32-unknown-unknown --toolchain nightly
Step 6: You are now free to experiment with the Substrate Node Templates on your Windows PC using WSL
git clone https://github.com/substrate-developer-hub/substrate-node-template
Bramble is also using Substrate for developing its blockchain. Click on the Discord link to connect with us.