How to setup Windows (10/11) for Smart Contract development and Brownie

Vasiliy Gualoto
6 min readOct 27, 2021

--

Blockchain technologies are the new big revolution in software development and are building the foundations of web 3.0 which definitely is going to change our world as same as Internet did back on late 90’s and early 2000's.

However, the state of the art is still new and difficult for newcomers to navigate, unlike other technologies were you can find hundreds of tutorials and resources in multiple languages and for all Operating Systems. Nowadays blockchain technologies depends a lot on reading documentation, and experiment by yourself (Discord communities are very helpful though) and based on my experience, most of the developers out there creating smart contracts or any DApps are more likely using MAC or Linux.

So, what about Windows users?

Well, if you want to start developing smart contracts the first place to go would be REMIX which is an excellent web based IDE to create smart contracts using solidity, as you can run it on any popular web browser, the operating system you are using is not that important. But when you want to develop huge projects and especially if you want to use frameworks, your best option is to setup a local environment on your computer and here, things could get tricky.

As it is 100% feasible to setup a working environment on windows and work using all the native tools for this OS, it’s also true that you’ll probably are going to struggle a lot when managing libraries, dependencies or packages. So as we want to save time, avoid headaches and focus our attention on the development process, today I brought you a guide to setup and configure your windows machine for smart contract development, this guide is specially focused for newcomers.

Spoiler alert: we are going to use Linux.

WSL2

Wait, what? Weren’t you going to explain how to setup the environment for windows?

Yes I know, I’m with you on this one, however as I said we want to avoid future problems and headaches. The Linux integration for Windows is every day better and Microsoft is doing just an incredible job with this tool, this will allow you to manage all your packages and dependencies, way better than doing it natively on windows, not mentioning that you won’t mess up any of your pc configurations at all, and installing it is pretty easy.

Just open your windows powershell as admin and type the following:

wsl --install

This will install all you need and after a restart you’ll be ready to go, but if your windows version is not updated you also will have to install Ubuntu from the Microsoft store.

Also as shams kitz suggested, in case you’ve playing with docker, which install it’s own version of Linux, it might prevents WSL to auto install Ubuntu, so you can do it by console using:

wsl --install -d Ubuntu

Once installed it will ask you for an username and a password, after you configure them we can start to setup our environment.

Updating

First of all it’s important to update ubuntu in order to have all our packages in their latest version

sudo apt update

Then

sudo apt upgrade

Install Node

NodeJS will be very useful to get packages from Openzeppelin or Chainlink and also to get some of the frameworks for smart contract development, this is how you could get it installed on your WSL2:

  1. Install curl
sudo apt-get install curl

2. install evm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

3. install node

nvm install node

4. verify if node was successfully installed

node --version

Important note: Web3 libraries are reported to have problems with the latest node versions, so is preferably to use a LTS node version like 16.13.2.

Configure Python

Python is a powerful language which could be used on a lot of blockchain development contexts, and of course is integrated with one of the most popular frameworks for smart contract development called brownie.

  1. Install python and pip:
sudo apt install python3 python3-pip ipython3

Note: Pip is an useful tool to install python packages

2. Install virutalenv

Virtualenv is a tool to manage python instances, by creating a virtual python environment you could use different version of packages and libraries without collapsing with each other and a lot more of advantages you can read here if you want to.

python3 -m pip install --upgrade pip
pip3 install virtualenv

Windows terminal

Let’s be honest, command line interfaces on windows are ugly and uncomfortable to use. Microsoft knows it and that’s why they created windows terminal, as you are going to spend a lot of time using the WSL terminal, let’s at least use something nice.

You can get it from Windows Store:

Windows terminal it’s pretty customizable, you can work with tabs and also you can setup blur effects and themes

VSCode

Vscode is the best text editor out there, I have nothing else to say about it, just make yourself a favor and install it. You can get it here.

Useful extensions for vscode

  1. Solidity extension by Juan Blanco

2. Python extension by Microsoft

3. WSL extension by Microsoft

Ganache

This is an incredible powerful tool which allows you to run your own local blockchain with accounts and fake ETH, is just perfect for testing purposes.

The windows binary for ganache could be found here.

It has a pretty nice interface and is so easy to use, look some picks

However, we are developers and user interfaces are overrated, we need our command line at all cost!… Jokes apart, you will also need to install ganache on its command line form (Remember to do this on WSL).

Install it using npm

npm install -g ganache

Brownie

As I said before, brownie is an incredible framework for Smart Contract development based on python, its installation is pretty easy, I recommend install it using its own virtual environment though.

pip install eth-brownie

Conclusion

Congratulations, if you reach this part it means you have now pretty much everything you would need to develop smart contracts on your windows machine, I really hope this guide might help you, any recommendations are welcomed

Final Tip

If you are new on this world and you don’t know where to start I cannot stop recommending the 16h course in FreeCodeCamp channel on Youtube, it’s taught by Patrick Collins and it is all you need to go, from zero to expert.

Thanks and best regards for everyone ;)

--

--

Vasiliy Gualoto

Blockchain Developer — Web3 Consultancy Services, Cat lover.