Hardhat

Easily deploy your contracts, run tests and debug Solidity code without dealing with live environments. Hardhat Network is a local Ethereum network designed for development.

1. Create Project Directory and Install Hardhat

$ mkdir meverse-test
$ cd meverse-test

To install Hardhat, go to empty folder and initialize npm (npm init)

$ npm install --save-dev hardhat

In Hardhat, you can create projects with Javascript and Typescript, and proceed smart contract compile, test and deployment. (This guideline used Javascript)

$ npx hardhat
888    888                      888 888               888
888    888                      888 888               888
888    888                      888 888               888
8888888888  8888b.  888d888 .d88888 88888b.   8888b.  888888
888    888     "88b 888P"  d88" 888 888 "88b     "88b 888
888    888 .d888888 888    888  888 888  888 .d888888 888
888    888 888  888 888    Y88b 888 888  888 888  888 Y88b.
888    888 "Y888888 888     "Y88888 888  888 "Y888888  "Y888

👷 Welcome to Hardhat v2.12.2 👷‍

? What do you want to do? …
❯ Create a JavaScript project
  Create a TypeScript project
  Create an empty hardhat.config.js
  Quit

2. Write Simple Smart Contract in Solidity

Create MEVerseGreeter.sol in meverse-test/contracts directory.

Write the following code in MEVerseGreeter.sol

Compile and test with following commands. (To proceed test, you need to write separate test script in test directory)

3. To Connect MEVerse Testnet, Edit hardhat.config.js

Edit MEVerse Testnet network in hardhat.config.js

4. Write deploy.js to deploy

5. Deploy Smart Contract and Check

Deploy smart contract with following command.

To check the deployment, check contract Address in Console, and view in MEVerse Testnet Scan with tx hash.

Last updated