Hardhat
Ethereum development environment for compiling, testing and deploying smart contracts.
3. Used by agents' projects
Dependency in 13 public GitHub projects set up for AI coding agents that we scanned (0.2%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
hardhat.org/llms.txtFrom the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Hardhat does
Hardhat 3 runs Solidity tests on a runtime written in Rust and treats Solidity and TypeScript tests as equals, so one project can mix fast Solidity unit tests with TypeScript integration tests.
Hardhat popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Hardhat is used
- Hardhat is a dependency in 13 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 261 projects, and what it is used with below comes from all of them.
- Projects that use it most often also use OpenZeppelin Contracts (62.1%), viem (60.9%), dotenv (55.2%).
By coding agent
Often used with
Hardhat in practice
Strengths
Deploying, testing and debugging all run on what the site calls Hardhat's "new runtime written in Rust". The maintainers present this runtime as the performance story of Hardhat 3.
You do not have to pick one test language for the whole project. The site suggests Solidity unit tests "for speed and conciseness", TypeScript integration tests "for expressiveness and complexity", and fuzz tests, decided case by case.
When a transaction reverts, Hardhat shows what the site calls "actionable errors" next to detailed Solidity stack traces. The site says the traces pinpoint "exactly where and why" the code fails.
The <code>--template</code> flag creates a project without the interactive questions. The docs name automation scripts and AI agents as the reason this mode exists.
Watch out for
Hardhat 3 requires Node.js v22.13.0 or later. For the package manager, the docs say "we strongly recommend pnpm".
The README calls Hardhat 3 the new major version and keeps v2 on a separate branch with its own docs. The docs include a migration guide for Hardhat 2 projects and another for Foundry projects.
The latest release adds support for several upcoming Amsterdam EIPs, and each change is labeled "experimental". The maintainers warn that EIP-8037 significantly changes the gas costs of state creation.
Create a Hardhat 3 project without prompts and run its tests
mkdir hardhat-example
cd hardhat-example
npx hardhat --init --template node-test-runner-viem
npx hardhat testMore about Hardhat
Packages around it
- @openzeppelin: Solidity contract library
- viem: TypeScript Ethereum client
- dotenv: Env file loader
- ethers: Ethereum JS library
- @nomicfoundation/hardhat-toolbox: Hardhat plugin bundle
- @nomicfoundation/hardhat-ethers: ethers.js plugin for Hardhat
Alternatives
Hardhat This page
Get started
Install it.
npm install hardhatRules for your agent
## Hardhat
- Check that Node.js is v22.13.0 or later before installing Hardhat 3.
- Scaffold without prompts: `npx hardhat --init --template node-test-runner-viem`. List the other templates with `npx hardhat --init --templates`.
- Target Hardhat 3 docs and APIs. Hardhat 2 has its own separate docs. For a v2 project, consult the Hardhat migration guide.
- Put the Solidity compiler version, networks, plugins and tasks in `hardhat.config.ts`.
- Use the `.t.sol` extension for Solidity tests that live in `contracts/`. In `test/`, use either `.sol` or `.t.sol`.
- Write deployments as Hardhat Ignition modules in `ignition/modules`.
- Run `npx hardhat test` to confirm the project still works after changes.