How to install Solidity on Windows

Introduction

Solidity is the Ethereum native language for writing and deploying smart contracts. To write or use this language, we have to properly install the package as the first step.

There are special processes for installing Solidity on the different available platforms. This shot explains how to install Solidity on a Windows platform.

Installing Solidity on Windows

The steps listed below will guide you to successfully install Solidity on your Windows machine.

The system requirement for this installation is:

  • A 64-bit Windows 10 machine

Step 1

Enable the Developer Mode in your computer settings, if it is not already enabled. To do this, go to “Settings,” which is denoted by the gear icon in the “Start” menu. Now, search for “Developer settings” in the search box on the “Settings” window.

widget

Now, toggle on the “Developer Mode,” as shown below.

widget

Step 2

Turn on the Windows Linux Subsystem feature. To do this, search once more for Windows features on the “Start” menu search box, as shown below.

widget

Click on the top result of the search. A window will pop up. Scroll until you find “Window Subsystem for Linux” in the options list. Check the box next to it and click on “OK.”

widget

After this step, remember to reboot your system to initiate the changes.

After your system restarts, search for Bash on the “Start” menu search box and open the Bash shell. When opened, the Bash shell will prompt you to install Ubuntu for Windows. Follow the prompts and complete the download and installation of Ubuntu for Windows. Close and reopen the Bash shell for its new fresh look.

At this point, you can run about any Linux command on the shell and install any Linux package. Move on to the next step.

Step 3

Create a directory that will hold everything you are going to do with Solidity.

Note: The Windows file system is located at /mnt/c in the Bash shell environment.

To create this, you can call it solidityProject directory on the desktop. You can change the directory to the desktop as follows:

cd/mnt/c/users/mypc/desktop/

Then, create the directory with the following command:

mkdir solidityProject

Once more, change the directory to the new directory, as shown below:

cd/mnt/c/users/mypc/desktop/solidityProject

Step 4

Install all necessary dependencies. Multiple methods exist to run Solidity on your local computer. We will use NodeJs.

Install cURL on your Bash environment using the command below.

sudo apt install curl

You will install the following dependencies.

NVM

Node Version Manager will help you to manage the node and all its packages. Install it using the command below.

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

Check the version to be sure the installation was successful. For this, use the command below:

nvm --version

Node.js

Now that NVM is up and running, you can use it to install Nodejs. For this, use the command below:

nvm install node

Set NVM up for Bash with node use and check the version with node -v commands. The minimum version of node that can be used with Solidity is version 6.3.0.

Solc

The solc package will provide the Solidity compiler and JS binding. It can be installed using the command below:

npm install -g solc

After successfully installing Solidity, install the following to start writing and testing with Solidity.

  • Truffle: This is a directory manager for your project. Install it using the command below:
npm install -g truffle
  • Ganache: This is a virtual Ethereum blockchain for testing, developing, and debugging the program before the actual launch to the live Ethereum blockchain.
npm install -g ganache-cli