# HelloWorld.sol

{% hint style="info" %}

#### 📜 **TL;DR:**

* In this tutorial, we will utilize [Remix IDE](https://remix.ethereum.org/), a versatile, open-source web-based platform, to develop and deploy our smart contract onto Hemi testnet.
* This guide is tested to work with Solidity version **0.8.26.** If you experience any issues, try setting this version explicitly in the Solidity Compiler tab on Remix.
* Earn and track Hemi [points](https://points.absinthe.network/hemi/start) for completing this tutorial!
  {% endhint %}

***

## 🏁 Prerequisites

1. [MetaMask Wallet Setup](https://docs.hemi.xyz/how-to-tutorials/using-hemi/wallet-setup/metamask-wallet-setup)
2. [Tunnel ETH to Hemi](https://docs.hemi.xyz/how-to-tutorials/using-hemi/tunnel-from-ethereum/tunnel-eth-to-hemi)

***

## 📚 Tutorial

### 1. Go to [Remix IDE](https://remix.ethereum.org/)

Remix IDE is a powerful, open-source web application for developing, compiling, and deploying Ethereum smart contracts with ease.

***

### 2. **Add the Smart Contract**

In Remix IDE, start by creating a new file named `HelloWorld.sol`.

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2F6obzJvFi0ctxe6cZWUxy%2F1c.png?alt=media\&token=daa3cbb7-ba29-4102-9f4f-b6ef14ee3897)

* The following contract is a basic example designed for interaction. Copy the code below and paste it into the file `HelloWorld.sol`.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract HelloWorld {
    string public greeting = "Hello, World!";

    function getGreeting() public view returns (string memory) {
        return greeting;
    }

    function setGreeting(string memory _greeting) public {
        greeting = _greeting;
    }
}
```

***

### **3. Compile the Contract**

Select `Compile HelloWorld.sol` button to use the Remix IDE's Solidity compiler. Check for any compilation errors and fix them.

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FatKV6rX5cahQs1HpKgdl%2F2c.png?alt=media\&token=a63fc20e-bd3d-4fcf-8750-2cdfb2794c57)

***

### 4. Connect Remix To MetaMask

{% hint style="warning" %}
The address you choose to connect **MUST** have some ETH (recommended at least 0.01 ETH) to pay for contract deployment fees. Refer back to earlier documentation to [fund your Hemi address](https://docs.hemi.xyz/how-to-tutorials/using-hemi/tunnel-from-ethereum/tunnel-eth-to-hemi) with ETH.
{% endhint %}

Choose `Injected Provider - MetaMask` under "Environment".

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FB1k0F4sgSrWtROGUZlLi%2F3c.png?alt=media\&token=06a3f599-d4f8-4e9c-b350-6551e14127c6)

***

### 5. Confirm the Connection

* A pop-up from MetaMask will appear to confirm the connection. Select `Next`.

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FlyVRVIJS8gcKBRYUgVod%2F4c.png?alt=media\&token=b55876ad-68ce-4566-b7f0-93905266d101)

* Select `Connect`

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2F9ofW5rL8Z8cQUVhJhbKm%2F5c.png?alt=media\&token=628d1c06-0169-4703-b112-03278cdda1b0)

***

### 6. Link to Hemi Account

* Link to the relevant Hemi account in the "Account" drop-down.

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2Fotb7GJUYvjmfkY3HFLaG%2F6c.png?alt=media\&token=de838aef-aeba-4208-9528-8522c95a04cf)

***

### 7. Deploy

Execute the deployment of your smart contract to the Hemi network directly from Remix IDE.

{% hint style="warning" %}
Uncheck `Publish to IPFS.`Note: if you get a warning about Gas Limit, you may ignore it and proceed.
{% endhint %}

* Select `Deploy`

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FZe8AnO66mmQgTtLle1Bj%2F7c.png?alt=media\&token=084ef860-0d9e-4622-9948-0486cb14608e)

* Your MetaMask will pop-up to confirm the deployment of your smart contract. Select `Confirm`

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2Fa6yWS1TQ7KQSd1DcPpMd%2F8c.png?alt=media\&token=f564ebca-db9a-44f0-a2f9-0db9131d816d)

🥳 Wohoooo! If successful you should see a ✅ in the console.

⚠️ If it fails, double check that the Solidity version in the compiler is the correct version.

![](https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FyEmvarNHNUYLdUdejhpD%2F9c.png?alt=media\&token=e0a31165-45e5-4007-8765-5f843c2fd316)
