Setting up a Hardhat project
Before you start, make sure you have Node.js 22+ and a package manager (such as npm or pnpm) installed:
node --versionnpx --versionnode --versionpnpm --versionnode --versionyarn --versionIf you don’t have Node.js installed, or you have an older version, you can learn how to install or update it using nvm or volta in this guide.
Creating your project
Section titled “Creating your project”You’ll create an empty directory and initialize a Hardhat project inside it:
mkdir hardhat-tutorialcd hardhat-tutorialnpx hardhat --initmkdir hardhat-tutorialcd hardhat-tutorialpnpm dlx hardhat --initmkdir hardhat-tutorialcd hardhat-tutorialyarn dlx hardhat --initYou’ll be prompted to select a few options. Accept the defaults for everything except the project type (we’ll use a minimal project):
- Version: “Hardhat 3 Beta”
- Directory: current directory (
".") - Project type: “A minimal Hardhat project” not default
- Install dependencies: yes
Once the setup is complete, let’s verify that everything is working:
npx hardhat --helppnpm hardhat --helpyarn hardhat --helpIf you see Hardhat’s help output in your terminal, you’re all set!
Now that your project is set up, you’re ready to start building!