How to setup Solidity Developer Environment on Windows
What you need to know about developing on Windows
Using Windows for development, especially for Solidity development, can be a pain sometimes, but it does not have to be. Once you have configured your environment properly, it can actually be extremely efficient and Windows is a very, very stable OS, so your overall experience can be amazing. The biggest frustration comes from the initial setup, but with this help, I hope you will manage to do so with ease. Let us get started!
Installing Truffle and Web3 on Windows
First you want to make sure to install Truffle along with its Web3 dependency. This will be an extremely helpful tool to get you started.
- Install Git Bash
- Install Node
- Install Python 2.7.17
- Install Microsoft Visual Studio 2015 Community
- Open the command prompt as Administrator:
setx PYTHON C:\Python27\python.exe /m
- Open a new command prompt:
npm install -g node-gyp
npm install -g windows-build-tools
npm install -g truffle
In case the first or last command fails, you can try npm rebuild node-gyp
to fix it. This will also install Web3 on your machine. Congratulations if you had success, this was one of the most difficult things for me when switching to Windows.
Installing Netcat for test scripts
This tip will be helpful later on, once you are up and actively developing with Truffle. Running unit tests on Truffle's ganache can be an unpleasant experience. Using a test script can simplify things immensely. However, the nc
command will not work on your Windows machine. Luckily, there is a netcat for Windows version available. Download and extract to a local folder and make sure to add that folder to your system PATH.
Install Conemu
You can use Git Bash if you want. However, my personal favorite terminal on Windows is Conemu. It has a ton of extra features, yet is still easy to use. You will have to configure it for Git Bash initially, but this can easily be done. (Tip: I love the Cobalt2 theme you can easily add under settings > general > color scheme)
Install VS code + Solidity extension
Hands down the best IDE for Solidity and web development for me is VS Code, so many features, themes, extensions while having the best overall user experience. You can choose whatever editor you want, but this one works really well for me on Windows. There is an actively maintained Solidity extension available which will make your Solidity developer life much easier as well.
Further useful tools
Not only for Windows, but useful tools in general are
- Ethlint (formely solium) or Solhint as Solidity code linters
- solidity-coverage
- buidler
- eth-gas-reporter
Have a look and play around with them. I definitely recommend to use a linter.
There you have it, Solidity development on Windows can be a surprisingly pleasant experience. You do not have to follow every step in this list, but pick and choose what you want. And happy buidling!
Solidity Developer