hardhat

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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 on EVM smart contract projects. ## Core Features & Use Cases - Project Setup & Configuration: Production-ready hardhat.config.ts patterns with multi-network support, compiler overrides, forking, gas reporting, and TypeScript/TypeChain integration. - Testing with Fixtures: Mocha/Chai test patterns using loadFixture, custom error assertions, event matching, time manipulation, and account impersonation on Hardhat Network. - Deployment & Verification: Hardhat Ignition modules for declarative deployments with state tracking, plus Etherscan verification including multi-chain and custom explorer setups. - Use Case: Fork Ethereum mainnet at a pinned block, impersonate a USDC whale, and execute a Uniswap V3 swap in a test to validate your contract against real protocol state. ## Quick Start Set up a new TypeScript Hardhat project with the toolbox plugin and write a test that deploys my contract using loadFixture.

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() using m.contract() for each contract and m.getParameter() for constructor args, then run npx hardhat ignition deploy with the module path and target network. Ignition resolves dependencies, tracks state in ignition/deployments/, and supports verification via npx hardhat ignition verify.

Hardhat vs Foundry: which should I use for Solidity development?

Hardhat suits teams needing TypeScript integration, complex deployment orchestration via Ignition, and a large npm plugin ecosystem. Foundry is better for fast compilation, fuzz testing, and Solidity-native tests. Both can coexist using the @nomicfoundation/hardhat-foundry plugin.

How do I test smart contracts with loadFixture in Hardhat?

Import loadFixture from @nomicfoundation/hardhat-toolbox/network-helpers and pass it an async function that deploys your contracts. It snapshots EVM state on first call and reverts to that snapshot on subsequent calls, giving each test clean state without redeploying.

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 constructor args via a --constructor-args file, match the solidity settings in hardhat.config.ts, and wait a few minutes after deployment for Etherscan indexing.

Does Hardhat forking require an archive node?

Yes, forking with a pinned blockNumber requires archive data since standard RPC endpoints only serve recent state. Use an archive-tier provider such as Alchemy Growth, Infura archive, or a local archive node like Erigon or Reth.

Should I use hardhat-deploy or Hardhat Ignition for deployments?

Use Hardhat Ignition, the official deployment system from the Hardhat team. hardhat-deploy is a community plugin not maintained by Nomic Foundation. Ignition provides declarative modules, dependency resolution, deployment state tracking, and built-in verification.