is a full-featured development environment for contract compilation, deployment and verification. The Hardhat Etherscan plugin supports contract verification on Hika Network.

Get Started

1) Install Hardhat

If you are starting from scratch, create an npm project by going to an empty folder, running npm init, and following the instructions. Recommend npm 7 or higher.

Once your project is ready:

create folder

mkdir hardhat
cd hardhat

npm instructions

npm install --save-dev hardhat

yarn instructions

yarn add --dev hardhat

create the sample project

We will explore the basics of creating a Hardhat project with a sample contract, tests of that contract, and a script to deploy it.

To create the sample project, run npx hardhat in your project folder:

2) Install plugin

install openzeppelin

npm install -save @openzeppelin/contracts

Run npx hardhat in your project folder and follow the instructions to create

npm install --save-dev @nomiclabs/hardhat-etherscan

And add the following statement to your hardhat.config.js:


Or, if you are using TypeScript, add this to your hardhat.config.ts:

import "@nomiclabs/hardhat-etherscan";

Install nomicfoundation/hardhat-toolbox

yarn add @nomicfoundation/hardhat-toolbox 
npm install @nomicfoundation/hardhat-toolbox

Config File

Here we add an RPC url without an API key, however some value is still required. You can use any arbitrary string

For example, if Sokol were not in the default list, this is how it would be added to the config file. Note the network name in customChains must match the network name in the apiKey object. and create file name hardhat.config.js


/** @type import('hardhat/config').HardhatUserConfig */
const PRIVATE_KEY = "XXX";

module.exports = {
  solidity: {
    version: "0.8.9",
    settings: {
      optimizer: {
        enabled: true
  networks: {
    hika: {
      url: 'https://rpc-testnet.hika.network',
      accounts: [PRIVATE_KEY]
etherscan: {
    apiKey: {
      hika: 'XXX'
  customChains: [
      network: "hika",
      chainId: 5729,
      urls: {
        apiURL: "https://scan-testnet.hika.network/api",
        browserURL: "https://scan-testnet.hika.network"

3) Deploy and Verify

Create platten .sol

 npm install @openzeppelin/contracts
 npx hardhat flatten contracts/Lock.sol > contracts/Lock_Token.sol


Code scripts/deploy.js

// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");

async function main() {
  const currentTimestampInSeconds = Math.round(Date.now() / 1000);
  const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60;
  const unlockTime = currentTimestampInSeconds + ONE_YEAR_IN_SECS;

  const lockedAmount = hre.ethers.utils.parseEther("1");

  const Lock = await hre.ethers.getContractFactory("Lock");
  const lock = await Lock.deploy(unlockTime, { value: lockedAmount });

  await lock.deployed();

    `Lock with 1 ETH and unlock timestamp ${unlockTime} deployed to ${lock.address}`

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
  process.exitCode = 1;

Run Script

npx hardhat run scripts/deploy.js --network hika


You can include constructor arguments with the verify task.

npx hardhat verify --network hika <DEPLOYED_CONTRACT_ADDRESS> <"Constructor Argument>


Nothing to compile Successfully submitted source code for contract contracts/Lock.sol:Lock at 0x755893F5B9De81CeA3dee69b8880e184cA2cDcEe for verification on the block explorer. Waiting for verification result...

Successfully verified contract Lock on Hika Scan URL. https://scan-testnet.hika.network/address/0x755893F5B9De81CeA3dee69b8880e184cA2cDcEe#code

Good to know: Note the verify task will not be listed in the available tasks lists at npx hardhat --config but should work as expected.

If not, check you have the minimum required version of the nomiclabs-hardhat-etherscan plugin (v3.0.0+) installed

Confirm Verification on Hika Network

Go to your Microtron Scan instance and paste the contract address into the search bar. If verified, the code tab will display a green checkmark.

Last updated