Solidity is one of the most popular languages for writing smart contracts on the Ethereum network. You can code Solidity online using the Remix IDE. This article will show you how! π
Quick Intro to Remix
Remix is a free web-based integrated development environment (IDE) for developing Ethereum smart contracts. Remix allows developers to use Solidity as well as other programming languages to develop on the Ethereum network.
π Recommended: Simply visit remix.ethereum.org to begin writing Solidity code.
There are three panes or sections on the page;
- left navigation/menu
- the middle pane (dependent on menu selection)
- code editor.
To get started, begin by selecting Solidity under the heading βFeatured Pluginsβ. This will open the Solidity Compiler.


Deploy First Smart Contract
To create a new file, select the βFile Explorerβ icon from the menu, then click the βCreate New Fileβ icon.


Name the file

Type in the name of the file. It is our first program so letβs go with βhelloworldβ once the file is named we can begin writing Solidity code in the code editor. Paste or type the code below into Remix.

To compile the program click the Solidity compiler icon on the left navigation and then click the compile button.

To deploy the smart contract click the deploy icon on the left navigation. Then click the deploy button.

After the contract has been deployed, it will appear, and the variable myString can be called by clicking the button to reveal the string value "hello world".

Using Microsoft VS Code to write a Solidity Smart Contract
Download and install the appropriate version of VS Code for your computer here: ββhttps://code.visualstudio.com/download
After installation, you will need to install a Remix plugin in your VS Code editor.
Click the extensions icon on the left navigation and search for Remix.
The top result will be βEthereum Remixβ which is the most popular Remix plugin with the most star ratings.
Click install.
Create a new file and type in the code for our HelloWorld program as below.
Code Snippet:
pragma solidity ^0.8.17;
contract HelloWorld {
string public myString = "Hello World!";
}
pragma soliditytargets the compiler version of Solidity, in this case, it is version 0.8.17contractdefines the contract, in this case,HelloWorld.stringdefines a string.publicmeans we have read access to the variable after the smart contract is deployed.myStringis the name of the string."Hello World!"is the value of the stringmyString.

Next click the remix icon in the left navigation, click βCompileβ and then select the βhelloworldβ file.

To deploy the smart contract click βRun& Deployβ and then connect to βRemixβ

Next, visit remix.ethereum.org in your web browser and click βconnect to localhostβ.
You will be presented with an alert asking you to connect to localhost, click the βconnectβ button.

After you are connected, Remix.ethereum.org will indicate in the file explorer localhost in the middle pane.

VS Code will indicate that you are now connected to remix.ethereum.org and you can proceed to click the βCompileβ button, followed by the βDeployβ button (you might have to scroll a little downward).

Getting Started with Hardhat Ethereum Development
Hardhat is a smart contract development framework for Ethereum.
To begin, go to the terminal and create a directory, in the example the directory created is βhello-hardhatβ
mkdir hello-hardhat(mkdir= make directory)cd hello-hardhat(cd= change directory)ls(ls= list directory)
Next, install npm package
npm init(init= initializer, can be used to set up a new or existingnpmpackage)
Accept the default settings

Next install hardhat
Type βnpm install hardhatβ

When the installation is done, type βnpx hardhatβ. That will launch hardhat (see below)

Hit enter, and a configuration file will be created. Accept the prompts about directory and others
Type βlsβ to see the files created.

Next we can open up the project with Visual Studio Code Editor and see the files

From here, you can create a new smart contract with the contracts folder.
π Recommended Tutorials: For a complete Syllabus on Solidity, check out our overview guide here. If you only need a quick crash course on Solidity, start here.
