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.
The steps listed below will guide you to successfully install Solidity on your Windows machine.
The system requirement for this installation is:
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.
Now, toggle on the “Developer Mode,” as shown below.
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.
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.”
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.
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
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.
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
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.
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.
npm install -g truffle
npm install -g ganache-cli