Deploy Smart Contracts with Hardhat

Prerequisites

Before you begin, ensure you have:

  • VS Code: code-editor

  • Node.js :

    This is like the secret language that lets you talk to the blockchain world.

    Open your terminal/CLI and type:

node -v

If it answers you with a version number, you’re good. If it gives you the silent treatment, go to https://nodejs.org/ and download it.

  • Metamask wallet

    Think of this like your wallet, but to store your crypto instead of real cash. Get it here: https://metamask.io/

    Set it up. Save your seed phrase. Hide it like treasure.

    (Seriously. Don't lose it. Don't share it. Ever.)

  • HeLa Testnet faucet

    You’ll need some fake money (test tokens) to pay for gas while we play.

Create your project folder:

Developing Your First Token on HeLa Chain

If you have developed dApps on Ethereum or any EVM compatible chain before, you will feel at home. It is exactly the same. But if you are new, don’t worry, this document will help you embark on your first token development on HeLa chain. There many platforms and utilities that you can use to develop token. For example: REMIX, Truffle, HardHat, Foundry, etc. We will use Hardhat for our first token. Visit

Our first program is to develop our first Token on HeLa Chain

Step:1 Install Hardhat:

Choose "Create a basic sample project"

It will give you options like:

Select: “Create a JavaScript project” (use arrow keys and hit enter)

It will create some files for you.

Once done, you should see a folder structure like:

Pause. Take a breath. You’ve done a LOT already, and and

Congrats. You just built yourself a smart contract workspace without writing a single line of code.

Install OpenZeppelin Contracts

OpenZeppelin is a library of pre-built, secure smart contracts. We’ll use it to create your token. Since we’re building a token, use OpenZeppelin’s ERC20 standard:

  • OpenZeppelin gives us pre-built secure templates.

  • Because honestly, you don’t want to write token code from scratch.

  • 99% of crypto projects use these same templates.

Go to your project folder. Inside, you will see a contracts/ folder.

Inside contracts/, create a new file called:

Write your TOKEN Contract

Inside contracts/, create a new file MyToken.sol:

Currently, they only support 0.8.9 solidity version. For Ref: **https://docs.helalabs.com/build-on-us/build-on-testnet**

Explanation:

  • ERC20("MyFirstHeLaToken", "HLT") — this is your token name and symbol.

  • initialSupply — how many tokens you want to create at the start.

  • msg.sender — the wallet address that deploys the contract will receive all tokens.

You can change the token name and symbol to whatever you want.

For example:

Write deployment script

Let’s write instructions for Hardhat to deploy this contract.

  • We import { ethers } from "ethers" (not from hardhat directly)

  • In Ethers v6+, parseEther is now used like: ethers.parseEther("1000000") (no utils)

Inside scripts/, edit deploy.js (or create it if not present):

Explanation:

  • initialSupply — we're creating 1 million tokens (you can change this amount).

  • hre.ethers.utils.parseEther("1000000") — converts "1 million tokens" into the smallest units ("wei").

  • getContractFactory("MyToken") — tells Hardhat to deploy the MyToken.solcontract you wrote.

Configure Hardhat to connect to HeLa Chain

Now we need to tell Hardhat where HeLa Testnet lives.

Edit hardhat.config.js and add the network config for HeLa.

1. Install dotenv package

It’s safer to store your private key in a .env file, even for testnet practice:

2. Create a file called .env in your project root folder.

Inside .env, paste:

Where do you get this private key?

Open Metamask → Account Details → Export Private Key.

(Never share your private key with anyone except your trusted computer.)

3. Edit your hardhat.config.js

Open hardhat.config.js and replace the contents with this:

Explanation:

  • We loaded your private key securely from .env

  • We added HeLa Testnet RPC URL & Chain ID

  • Now Hardhat knows exactly how to deploy to HeLa Testnet.

4. Deploy Your Token on HeLa Testnet

Make sure:

  • You’re inside the project folder

  • Your .env file exists

  • You have some testnet $HELA (for gas)

From here you can get some $HELA token for your gas : https://testnet-faucet.helachain.com

what you need to do is just simple paste your wallet address, make sure you have setup the custom network in your wallet ( in our case we used metamask wallet ) Ref : https://docs.helalabs.com/build-on-us/metamask

  1. Run the deployment command:

What you should see in your terminal:

  1. Go check it on HeLa Testnet Explorer : https://testnet-blockexplorer.helachain.com/

Support :

If you encounter any issues during setup or require assistance, please join the HeLa Developer Community for direct support and guidance.

Last updated