Open In App
Related Articles

“Hello World” Smart Contract in Remix-IDE

Improve Article
Save Article
Like Article

What do you mean by Smart Contract?

Smart contracts are self-executing contracts. The term was coined by Nick in 1994. Smart contracts are very different from traditional software programs. They are immutable once deployed on the blockchain. It was because of Ethereum the term smart contract became so popular and used in the Ethereum blockchain. Solidity is the main programming language for writing smart contracts for the Ethereum blockchain. It is a contract-oriented language, which means that smart contracts are responsible for storing all of the programming logic that transacts with the blockchain. The term smart in smart contracts is as the contract gets executed depending upon some logical condition and all nodes in blockchain have the same copy of that smart contract. What is Remix-IDE? The Remix is an Integrated Development Environment(IDE) for developing smart contracts in Solidity programming language. The IDE can be used to write, compile, and debug the Solidity code. It was written in JavaScript and supports testing, debugging and deploying smart contracts, and much more. Remix-IDE can be accessed in many different ways:

  1. You can use it online in any browser of your choice, by entering the URL: in the browser.
  2. Or you can install it in your own system using this link.
  3. The third way is to use Mist (the Ethereum Dapp browser).

Getting Started

This article is all about writing your first smart contract in solidity using remix-ide which is a browser-based IDE. So let’s get started with our first simple “Hello World” program.

  1. Open the remix-ide in your browser by typing:
  2. You will be presented with following screen:
  3. Click on the “file explorer” icon onto the left side bar (indicated by blue arrow in the above picture).
  4. Select Solidity in the Environment and click + symbol right to the browser.
  5. Type the file name “HelloWorld.sol” and enter the following code into it
// My First Smart Contract 
pragma solidity >=0.5.0 <0.7.0;
contract HelloWorld {
    function get()public pure returns (string memory){
        return 'Hello Contracts';
  1. Once done click the icon just below the “file explorer” icon as shown below:
  2. You will be presented with following screen:
  3. Click “Compile HelloWorld.sol”. Leave rest setting as it is.
  4. Once compiled successfully click the icon below “Solidity Compiler” that is “Deploy and run transactions”. You will be welcomed by next screen:
  5. Without changing any of the values as shown above just click “Deploy” button to deploy your smart contract. Once deployed you will find your smart contract just below in “Deployed Contracts” heading:
  6. Click “>” before your contract you will see a button “get” below as our contract has get function that returns a string. Click get button and you will get :

Print Hello World using getters and setters.

In this approach we will see how we can use get() and set() methods to get the string from the user and print it.


pragma solidity >= 0.8.2 <0.9.0;
contract HelloWorld{
    string userInput;
    function set(string memory finalValue) public
        userInput = finalValue;
    function get() public view returns(string memory){
        return userInput;

To run it, follow the steps till step 11 of last approach. Then follow the below steps.

  1. After clicking the ‘>’ in the Deployed Contracts section a drop down menu will be opened which will consist of two methods. Set and Get.


    2. Now beside the set method we can see a blank box appears which asks for a string value. Here we will type whatever we will like to print / show. Then click on set. In the terminal user can see another transaction happened. Then click on get, and the string we passed will be visible below.


Last Updated : 16 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials