KlaytnGreeter is a simple contract that returns a greeting message. Greeting message is set when the contract is deployed.

Writing KlaytnGreeter

pragma solidity 0.5.6;
contract Mortal {
    /* Define variable owner of the type address */
    address payable owner;
    /* This function is executed at initialization and sets the owner of the contract */
    constructor () public { owner = msg.sender; }
    /* Function to recover the funds on the contract */
    function kill() public { if (msg.sender == owner) selfdestruct(owner); }

contract KlaytnGreeter is Mortal {
    /* Define variable greeting of the type string */
    string greeting;
    /* This runs once when the contract is created */
    constructor (string memory _greeting) public {
        greeting = _greeting;
    /* Main function */
    function greet() public view returns (string memory) {
        return greeting;

Deploying KlaytnGreeter using Remix Online IDE


For the details of contract deployment and the Remix Online IDE usage guideline, please refer to the following documents.

Last updated