Solidity Remix IDE Quickstart

4.7/5 - (3 votes)

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! 👇 

Solidity Remix IDE Quickstart

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; 

  1. left navigation/menu 
  2. the middle pane (dependent on menu selection) 
  3. 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.17
  • contract 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 string myString.

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 existing npm 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.