# KlaytnGreeter

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

## Writing KlaytnGreeter <a href="#writing-klaytngreeter" id="writing-klaytngreeter"></a>

```
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 <a href="#deploying-klaytngreeter-using-klaytn-ide" id="deploying-klaytngreeter-using-klaytn-ide"></a>

* Please visit [Klaytn Plugin for Remix](https://ide.klaytn.foundation) and create a `KlaytnGreeter` contract. The complete source code was given in the above.
* Prepare your account which will be used to deploy the contract.
  * If you do not have an account yet, create one at <https://baobab.wallet.klaytn.foundation/create> or <https://toolkit.klaytn.foundation/account/accountKeyLegacy>.
  * Get some test KLAY from the faucet - <https://baobab.wallet.klaytn.foundation/faucet>
* Deploy the contract with initial parameter, a greeting message.
* After deploying, you can invoke `greet` from the IDE.

## References <a href="#references" id="references"></a>

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

* [Remix Online IDE](/content/smart-contract/ide-and-tools.md#klaytn-ide)
* [Truffle](/content/smart-contract/ide-and-tools.md#truffle)
* [Deploy Guide](/content/smart-contract/deploy-guide.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://archive-docs.klaytn.foundation/content/smart-contract/sample-contracts/klaytngreeter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
