Hardhat Basics - Deploying Contract From Your Local Node.js Environment

Table of contents

What Is Hardhat ? 🤔
Hardhat is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment.
One of the standout features of Hardhat is its built-in Ethereum network, known as Hardhat Network, which enables fast local testing without the need for external blockchain connections.
Additionally, Hardhat's task runner automates repetitive tasks such as compiling, testing, and deploying smart contracts, making the workflow more efficient.
Prerequisites 🪛
Node.js
npm [not
yarn
orbun
]WSL - Windows Subsystem for Linux ( preffered )
Setting Up Hardhat 🛠️
mkdir example
cd example
mkdir web3
cd web3
npm install --save-dev hardhat
npx hardhat init
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.22.18 👷
? What do you want to do? …
❯ Create a JavaScript project
Create a TypeScript project
Create a TypeScript project (with Viem)
Create an empty hardhat.config.js
Quit
? Hardhat project root: » C:\Users\username\example\web3 ↵
? Do you want to add a .gitignore? (Y/n) · y
? Do you want to install this sample project's dependencies with npm (hardhat @nomicfoundation/hardhat-toolbox)? (Y/n) » y
Subscribe to my newsletter
Read articles from Megh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
