Hello World in Solidity

Published on 01 November 2018 (Updated: 09 November 2018)

Hello World in Solidity

In this article, we’ll be tackling Hello World in Solidity, a smart contract language.

How to Implement the Solution

Without further ado, here’s an implementation of Hello World in Solidity:

pragma solidity ^0.4.22;
contract helloWorld {   
    function renderHelloWorld () public pure returns (string) {       
        return 'Hello, World!';             
    }
}

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

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.1


References

  1. M. Naza, “Hello World in Solidity,” The Renegade Coder, 22-Jun-2018. [Online]. Available: https://therenegadecoder.com/code/hello-world-in-solidity/. [Accessed: 31-Oct-2018].  2