Hello World in Solidity

Published on 28 April 2022 (Updated: 16 December 2023)

Welcome to the Hello World in Solidity page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

// SPDX-License-Identifier: MIT
pragma solidity ^0.8;

contract HelloWorld {
    function main (string memory) public pure returns (string memory) {
        return 'Hello, World!\n';
    }
}

Hello World in Solidity was written by:

This article was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

While the format of Solidity looks a bit different from the more popular programming languages today, what's happening behind is fairly straightforward.

First we import the version of Solidity we'd like to use. Then we create a function and specify we'd only like to return a string. And, voila!

How to Run the Solution

If you want to run the solution, remix provides an IDE you can visit to write and execute the smart contract. Every piece of code written in Solidity, or any blockchain programming language, is considered a smart contract.