hardhat

Installation
SKILL.md

Hardhat

Hardhat is the dominant Solidity development framework. It provides compilation, testing, deployment, and debugging for EVM smart contracts. The core value is Hardhat Network — a local EVM that supports console.log, stack traces, and mainnet forking. All configuration lives in hardhat.config.ts.

What You Probably Got Wrong

LLMs frequently generate Hardhat code mixing v1 patterns, ethers v5 syntax, and deprecated plugins. These corrections are non-negotiable.

  • ethers v6, not v5 — the API changed fundamentally — Hardhat toolbox now bundles ethers v6. ethers.getContractFactory() returns a different type. parseEther() is a standalone import, not ethers.utils.parseEther(). BigNumber is gone — ethers v6 uses native bigint. If you see BigNumber.from() or ethers.utils.*, you are writing v5 code. Stop.
  • hardhat-deploy is NOT the official deployment tool — The official deployment system is Hardhat Ignition (@nomicfoundation/hardhat-ignition). hardhat-deploy by wighawag is a community plugin that is not maintained by the Hardhat team. Use Ignition for new projects.
  • @nomicfoundation/hardhat-toolbox replaces individual plugins — Do not install @nomiclabs/hardhat-ethers, @nomiclabs/hardhat-waffle, or hardhat-gas-reporter individually. The hardhat-toolbox meta-plugin includes ethers, chai matchers, coverage, gas reporter, and typechain. The old @nomiclabs/ scoped packages are deprecated.
  • npx hardhat compile does NOT generate TypeScript types by default — You must have @nomicfoundation/hardhat-toolbox (or @typechain/hardhat) installed AND run npx hardhat compile to generate types in typechain-types/. The types are not checked into source control.
  • hardhat.config.ts is NOT optional for TypeScript — If you use .ts config, you must have ts-node and typescript installed. Hardhat uses ts-node to transpile the config at runtime. Without it, Hardhat silently falls back to looking for .js.
  • ethers.getSigners() returns HardhatEthersSigner, not raw ethers Signer — The signer type is HardhatEthersSigner which extends ethers AbstractSigner. It has additional properties like .address as a direct property (not a method). Type your test variables accordingly.
  • Hardhat Network resets between test files, not between it() blocks — State persists across it() blocks within the same describe(). Use loadFixture() from @nomicfoundation/hardhat-toolbox/network-helpers to get clean state per test. Do not rely on beforeEach deploying fresh contracts — it is slower and error-prone.
  • Forking requires an archive node RPChardhat_reset and forking.blockNumber require archive data. Standard RPC endpoints only serve recent state. Use Alchemy or Infura archive tier, or a local archive node.
  • console.log in Solidity only works on Hardhat Networkimport "hardhat/console.sol" is a Hardhat-specific feature. It does nothing on mainnet, testnets, or other local nodes. Do not leave console.log in production contracts — it wastes gas on the import.
  • Constructor arguments for verification must match exactlynpx hardhat verify fails silently when constructor args do not match the deployed bytecode. Use the --constructor-args flag pointing to a JS file that exports the exact arguments used during deployment.
Installs
1
First Seen
Aug 4, 2026
hardhat — justaname-id/cryptoskills