hardhat

Configure, test, deploy, and verify Solidity smart contracts with the Hardhat framework.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill hardhat-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hardhat
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/hardhat
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill hardhat-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? LLMs frequently generate outdated Hardhat code mixing ethers v5 syntax, deprecated @nomiclabs plugins, and the unofficial hardhat-deploy tool, leading to broken builds, failed verifications, and wasted debugging time. This Skill provides current, verified patterns for Hardhat v2 with ethers v6, the toolbox meta-plugin, and Hardhat Ignition deployments. ## Core Features & Use Cases - Project Setup & Configuration: Multi-network hardhat.config.ts with compiler settings, optimizer options, forking, gas reporting, and multi-chain Etherscan verification keys. - Testing with Fixtures: Mocha/Chai test patterns using loadFixture, custom error assertions, event matching, time manipulation, and account impersonation on Hardhat Network. - Deployment & Verification: Declarative Hardhat Ignition modules with dependency resolution, parameter files, deployment state tracking, and one-command Etherscan verification. - Use Case: You need to deploy an upgradeable UUPS vault to Sepolia and verify it. The Skill provides the OpenZeppelin upgrades pattern, Ignition module, and the exact verify command that reads constructor args from deployment state. ## Quick Start Ask the agent to scaffold a TypeScript Hardhat project with the toolbox plugin, write a fixture-based test for your contract, and deploy it to Sepolia using Hardhat Ignition.

Frequently Asked Questions about hardhat

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Solidity contract with Hardhat Ignition?

Define a module with buildModule() that calls m.contract() with constructor args, then run npx hardhat ignition deploy with the module path and --network flag. Ignition resolves dependencies, tracks state in ignition/deployments/, and supports verification via npx hardhat ignition verify.

Hardhat vs Foundry: which should I use for smart contract development?

Use Hardhat when TypeScript integration, complex deployment orchestration, or the plugin ecosystem matters. Use Foundry when compilation speed, fuzz testing, or Solidity-native tooling is the priority. Both can coexist via the hardhat-foundry plugin.

How do I test against mainnet state using Hardhat forking?

Set forking.url and a pinned blockNumber in the hardhat network config, using an archive-tier RPC like Alchemy Growth. Use impersonateAccount and setBalance from network-helpers to act as whale accounts, and loadFixture to cache fork snapshots.

Why does Hardhat verification fail with bytecode does not match?

Verification fails when constructor arguments, compiler version, or optimizer settings differ from the original deployment. Pass exact args via a --constructor-args file and confirm the solidity settings in hardhat.config.ts match the deployed build.

Can I still use ethers v5 syntax with the Hardhat toolbox?

No. The current hardhat-toolbox bundles ethers v6, where parseEther is a standalone import, BigNumber is replaced by native bigint, and ethers.utils is removed. Code using BigNumber.from() or ethers.utils.* must be migrated.

Why do my Hardhat tests pass locally but fail in CI?

Common causes are missing RPC environment variables for fork tests, short Mocha timeouts on slower CI machines, and state leakage between tests. Guard fork tests behind an env check, raise mocha.timeout, and use loadFixture for isolation.