Reader small image

You're reading from  The Essential Guide to Web3

Product typeBook
Published inNov 2023
PublisherPackt
ISBN-139781801813471
Edition1st Edition
Concepts
Right arrow
Author (1)
Vijay Krishnan
Vijay Krishnan
author image
Vijay Krishnan

Vijay Krishnan, an experienced expert in blockchain and Web3, holds the position of head of SysOps for Linea, a Layer 2 blockchain at Consensys. With a rich background in blockchain, he's guided Fortune 100 companies from ideation to product build. With over 50 projects and 300+ use cases to his credit, Vijay has left an indelible mark on the industry. Prior to Consensys, he pioneered the AWS Partner Blockchain ecosystem and led IBM North America's Blockchain Practice. With two decades on Wall Street, he possesses deep financial and tech insights. Vijay, a leader and subject matter expert, empowers clients in DeFi, NFTs, gaming, and the metaverse. Beyond work, he's a mentor, speaker, author, and organic farmer. His knowledge and innovation continue to shape the blockchain and Web3 landscape.
Read more about Vijay Krishnan

Right arrow

Understanding a Hello World smart contract

“Hello World” is quite a simple contract and the best one for beginners to smart contract coding and Solidity. You will find that this example is commonly used by new users to get acquainted with Solidity smart contracts.

Here is an example of a HelloWorld smart contract in Solidity, along with a detailed explanation of each line:

pragma solidity ^0.9.0;contract HelloWorld {
    string greeting;
    constructor() {
        greeting = "Hello, World!";
    }
    function greet() public view returns (string memory) {
        return greeting;
    }
}

Let us go through each line:

  • pragma solidity ^0.9.0;: This is a pragma version that specifies which version of Solidity the contract uses. The caret symbol (^) indicates that the...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
The Essential Guide to Web3
Published in: Nov 2023Publisher: PacktISBN-13: 9781801813471

Author (1)

author image
Vijay Krishnan

Vijay Krishnan, an experienced expert in blockchain and Web3, holds the position of head of SysOps for Linea, a Layer 2 blockchain at Consensys. With a rich background in blockchain, he's guided Fortune 100 companies from ideation to product build. With over 50 projects and 300+ use cases to his credit, Vijay has left an indelible mark on the industry. Prior to Consensys, he pioneered the AWS Partner Blockchain ecosystem and led IBM North America's Blockchain Practice. With two decades on Wall Street, he possesses deep financial and tech insights. Vijay, a leader and subject matter expert, empowers clients in DeFi, NFTs, gaming, and the metaverse. Beyond work, he's a mentor, speaker, author, and organic farmer. His knowledge and innovation continue to shape the blockchain and Web3 landscape.
Read more about Vijay Krishnan