Hemi
DiscordGithub
  • 🏠Main
    • Welcome to the Hemi Docs
    • Getting Started
      • Developer Quickstart
      • Enthusiast Quickstart
      • Miner Quickstart
    • Network Details
  • ⛰️Foundational Topics
    • The Architecture
      • Consensus and Security Protocols
      • Ethereum Rollups
        • Pros & Cons
        • Decentralized Rollups
      • Sequencer Consensus
        • Proof-of-Stake (PoS)
        • PoS-Only Pitfalls
        • PoS Solutions
      • Proof-of-Proof (PoP)
        • Proof-of-Proof Consensus & Bitcoin Finality
        • Proof-of-Proof vs. Merged Mining
        • Running a PoP Mining
      • Tunnels
        • Ethereum Tunnel
        • Bitcoin Tunnel
      • Ethereum Virtual Machine (EVM)
      • Blocks
      • Transactions
      • Gas
    • Nodes & Clients
      • Node Guides
    • Wallet Support
  • 📖How-To Tutorials
    • Using Hemi
      • Wallet Setup
        • EVM Wallet Setup
        • BTC Wallet Setup
          • Switch Bitcoin Networks
      • Tunnel from Ethereum
        • Tunnel ERC20s via Native Tunnel
        • Tunnel ERC20s via 3rd Party
          • Tunnel via Stargate
      • Tunnel from Bitcoin
        • Tunnel BTC via Native Tunnel
        • Tunnel BTC via 3rd Party
      • Stake
      • Developer Tooling
        • Set Up a Safe Wallet
        • Create a Capsule
      • PoP Mining
        • CLI PoP Miner
          • (Testnet) Add tHEMI to MetaMask
          • (Mainnet) Add PoPPoints to Metamask
        • Web PoP Miner (deprecated)
    • Developing on Hemi
      • General
        • HelloWorld.sol
        • Deploy an ERC-20 Token
      • hVM & hBK
        • Using the hBK Demo App
        • Get Bitcoin Balance with Remix
  • ⚙️Building Bitcoin Apps
    • Introduction
    • Hemi Virtual Machine (hVM)
      • Motivation
      • Feature Summary
      • Deploy on hVM
    • Hemi Bitcoin Kit (hBK)
      • Overview
      • hBK Smart Contract
  • ⚙️Tooling
    • viem
    • Contract Addresses
    • Contract Verification
    • Data Indexing
    • Oracles
  • 📝Incentives
    • Points
    • Grants
    • Retroactive Funding
    • One-Off Spends
  • ⚡Additional Resources
    • Partners
    • FAQ
    • Official Links
    • Brand Kit
  • 📨Send Feedback
    • Bug Report
    • Contact Us
Powered by GitBook
On this page
  • 🏁 Prerequisites
  • 📚 Tutorial
  • Video
  • 1. Go to Remix IDE
  • 2. Add the Smart Contract
  • 3. Compile the Contract
  • 4. Connect Remix To MetaMask
  • 5. Confirm the Connection
  • 6. Link to Hemi Account
  • 7. Deploy

Was this helpful?

Edit on GitHub
Export as PDF
  1. How-To Tutorials
  2. Developing on Hemi
  3. General

HelloWorld.sol

🟩 This is a beginner track.

PreviousGeneralNextDeploy an ERC-20 Token

Last updated 3 months ago

Was this helpful?

📜 TL;DR:

  • In this tutorial, we will utilize , 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 for completing this tutorial!


🏁 Prerequisites


📚 Tutorial

Video

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.

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

// 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.


4. Connect Remix To MetaMask

Choose Injected Provider - MetaMask under "Environment".


5. Confirm the Connection

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

  • Select Connect


6. Link to Hemi Account

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


7. Deploy

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

Uncheck Publish to IPFS.Note: if you get a warning about Gas Limit, you may ignore it and proceed.

  • Select Deploy

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

🥳 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.

1. Go to

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 with ETH.

📖
Remix IDE
fund your Hemi address
Remix IDE
points
MetaMask Wallet Setup
Tunnel ETH to Hemi