Creating a New Project

Requirements

Before starting, ensure that you have a working version of Node.js installed on your computer that is equal to or greater than version 16.0. If you don't have Node.js installed, using nvm to set up your Node.js development environment is recommended.

This tutorial uses npm as the package manager, but feel free to use other package managers like yarn or pnpm according to your preference.

Initiating a NPM Project

Open a new terminal and run the following commands to create project’s root directory and a new NPM project. You can use a different directory name if you prefer.

mkdir relic-tutorial
cd relic-tutorial
npm init -y

Creating a New Hardhat Project

To create a Hardhat project, you need to install some dependencies using the following commands. Note that this tutorial will be using TypeScript.

npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox ts-node typescript

Next, add a configuration file to the project's root directory. Create a file named hardhat.config.ts and write the configuration:

// File: hardhat.config.ts
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
const config: HardhatUserConfig = {
solidity: '0.8.18',
}
export default config

After saving the configuration file, the Hardhat version and available commands can be viewed using the following command:

npx hardhat
Hardhat version 2.13.0 Usage: hardhat [GLOBAL OPTIONS] <TASK> [TASK OPTIONS] ...