The “Hello World” Smart Contract
Learn how to write a “Hello World” smart contract in Solidity.
We'll cover the following
A “Hello World” smart contract serves as the most basic example of a decentralized application on a blockchain. It’s often the first step in understanding smart contract development and is crucial for grasping the foundational elements of deploying and interacting with contracts on a blockchain.
Before going into the practical aspects of creating a “Hello World” smart contract, let’s familiarize ourselves with some basic terminology and features of Solidity, such as comments, contract structure, and file imports.
Comments
A comment in computer programming is a programmer-readable explanation or annotation in a computer program’s source code. Comments are added to make the source code easier to understand for humans and are often ignored by compilers and interpreters. Solidity allows the following types of comments:
Single-line comments: Solidity compiler treats any content that appears between a
//
and the end of a line as a comment and ignores it.Multiple-line comments: Any content between the special characters
/*
and*/
is interpreted as a comment. This can take up many lines.
Let’s look at an example of a comment in the following code snippet:
Get hands-on with 1400+ tech skills courses.