Can I develop Ethereum Dapps on Windows?

I have heard that Windows can be problematic for developing Ethereum Dapps and smart contracts… Unfortunately that’s the only computer I have and I am not planning on buying other soon…Hope that can work with Ethereum

Yes absolutely can! A lot of the development dependencies rely on NodeJS (Javascript on the server). NodeJS is cross-platform and works equally well on Windows, Linux and Mac. You just need to go to the website of NodeJS and install it for Windows. (Tip: Install the LTS version). After you install NodeJS, npm (Node Package Manager) will also be installed. With this, you will be able to install NodeJS packages very easily, from the command line.

Let’s understand in details why you only need NodeJS. There are 3 parts to consider when you develop a Dapp:

  • Smart contract
  • Backend
  • Frontend

Smart contract

You need 2 elements:

  • a local development blockchain - like Ganache
  • a solidity compiler - like Solidity

Truffle is a popular framework for smart contract. It combine Ganache, Solc (a Solidity compiler) and provide a convenient CLI to make them work together easily. It is written in NodeJS and can be installed with npm: npm install -g truffle. (The -g flag stands for global install and means that you can use the CLI of Truffle from any directory).

Backend

The backend usually just serve the frontend, so you could use any server for static file. You could use a server that is already compiled, like Apache, Nginx, or a server that is written in a language like Php, Python or NodeJS. You probably want to use a server that is written in these dynamic languages, because it’s easier to have some features if you need something more that just serving the frontend. And out of all these languages I would pick NodeJS, since it’s what you will need to for Truffle

Frontend

For the frontend, you will write your code in Javascript. Javascript will run in web browsers, which are perfectly cross-platform. So no issues here.

You will probably also need modern frontend tooling like Webpack, so that you can use modern Javascript features, that will be transpiled to “old-school” Javascript that all browsers can understand. Webpack is written in NodeJS, so that’s one more reason to get it!

Web3

Finally, you will need to use some Javascript dependencies on the frontend. Most likely, you will need Web3 to communicate with your smart contract.

Web3 is an isomorphic Javascript package. (scary name I know!) That means that it works both on the backend and on the frontend. When you install Web3 with npm, the source code is compiled to 2 bundles: a backend bundle and a frontend bundle.

The reason for this is that on the backend we can use some optimizations that are not possible on the frontend. Using the NodeJS api (not available in browsers), for example, we can use some more efficient code. Another optimization is to use some C/C++ code for some part of the code. C/C++ are low-level languages that are much faster than NodeJS, but takes more time to code and are more difficult to use safely (open the door to memory errors).

When you install web3, npm produce both the backend and frontend bundle, without letting you the option of only installing the frontend bundle. In most cases you will only use the frontend bundle, but npm will still force you to ALSO create the backend bundle. When it create the backend bundle, it will have to compile some C/C++ code, and that can pause problems in some old versions of Windows.

Old version of Windows

If you use Windows 8 or 10, you should be fine. But with earlier versions, you might have some problems.