Solidity Smart Contract development on Windows

There are two main options to setup our environment for Solidity Smart Contract development on Windows.

The Microsoft recommendation is to use Windows Subsystem for Linux.

https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows#use-windows-subsystem-for-linux-for-production
Many Node.js packages and frameworks are created with a *nix environment in mind and most Node.js apps are deployed on Linux, so developing on WSL ensures consistency between your development and production environments.

Set up on Windows Subsystem for Linux (Windows 10)

I use Windows Subsystem for Linux (WSL2) on Windows 10.

See @Jshanks21 walkthrough for installing WSL:

Set up on native Windows

Install nvm (Node Version Manager)
(Note: There are alternate ways to install node such as nodejs installer: https://nodejs.org/en/download/ )

Then install Git:

Install Windows Build Tools:
https://github.com/felixrieseberg/windows-build-tools#readme

If you are unpacking Starter Kits then you can use Git Bash terminal (thanks @pantsme).


For an editor, I recommend VS Code:

Along with @juanfranblanco's Solidity Extension:

The settings for use with OpenZeppelin are documented in the repository: https://github.com/juanfranblanco/vscode-solidity#openzeppelin


Note: This is a wiki post, please update/edit.

2 Likes
Installing OpenZeppelin SDK on Windows - Use git bash
File import callback not supported
Npm i @openzeppelin/cli fails on Windows with error ENOENT undefined ls-remote -h -t ssh://git@github.com/web3-js/WebSocket-Node.git
Flattening on Windows and get error ENOENT: no such file or directory
Truffle Upgrades on Windows: Error: Artifacts are from different compiler runs
Cannot deploy Simple777Token contract with Truffle migrate on Windows
Learn guides: Import not working on Windows
Create an NFT and deploy to a public testnet, using Truffle
Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.16;"
OpenGSN BaseRelayRecipient: ParserError: Expected pragma, import directive or contract/interface/library definition
Compilation error in OpenZeppelin Contracts on Windows
Compiling on Windows produces compilation errors for the installed @openzeppelin/contracts-ethereum-package/contracts
Truffle migrate importing OpenZeppelin Contracts results in Cannot read property "0" of null
The create command is deprecated: Building an OpenZeppelin dapp with Solidity Hot Loader
How to verify a contract deployed by a factory contract
Truffle Upgrades on Windows: Error: Artifacts are from different compiler runs
Unused function parameter
File import callback not supported
Error: Cannot find module 'truffle-hdwallet-provider` when deploying to a public network
Compile error: File import callback not supported
Deploying to Quorum with OpenZeppelin CLI
Not able to install @openzeppelin/network
OpenZeppelin Test Environment: Timeout exceeding 2000ms
GSN Starter Kit - Attempted import error: ā€˜PublicAddress’ is not exported from ā€˜rimble-ui’
Setting up an Ethereum Development Environment
Help with deprecated errors when installing OpenZeppelin on Windows 10 and node v14.4
Deployment failed on Rinkeby: ā€œERC721PresetMinterPauserAutoIdā€ hit an invalid opcode

Hey there! That's great! As you mentioned, one of the main options recommended by Microsoft is to use Windows Subsystem for Linux (WSL). Using WSL allows you to work within a Linux environment directly within your Windows operating system. This is particularly useful for Node.js development, since many Node.js packages and frameworks are created with a *nix environment in mind. When setting up WSL on Windows 10, it's important to keep in mind that you'll need a valid Windows activation key to properly activate your operating system. Once you have that taken care of, you can follow the instructions provided by Microsoft to set up WSL on your machine.