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 solidity
targets the compiler version of Solidity, in this case, it is version 0.8.17contract
defines the contract, in this case,HelloWorld
.string
defines a string.public
means we have read access to the variable after the smart contract is deployed.myString
is 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 existingnpm
package)
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.