hardhat

Installation
SKILL.md

hardhat

Purpose

Hardhat is a development environment for Ethereum that enables compiling, testing, and deploying Solidity smart contracts efficiently. It automates workflows for professional blockchain developers.

When to Use

Use Hardhat for Ethereum smart contract development when you need a local blockchain simulator, automated testing, or deployment to testnets like Goerli. Apply it in projects requiring Solidity code compilation, especially for debugging or integrating with dApps. Avoid it for non-Ethereum blockchains or simple scripting tasks.

Key Capabilities

  • Compile Solidity files with customizable compiler versions (e.g., via hardhat.config.js: solidity: "0.8.17").
  • Run unit tests using Mocha or Hardhat's API, supporting assertions like expect(await contract.balance()).to.equal(100).
  • Deploy contracts to networks using ethers.js, with built-in support for forking mainnet for testing.
  • Extend via plugins (e.g., @nomiclabs/hardhat-ethers) for advanced features like gas reporting.
  • Handle multiple networks in config, e.g., defining Goerli with an RPC URL and accounts array.

Usage Patterns

To set up a Hardhat project, run npx hardhat init in a new directory, then add your Solidity files to the contracts folder and tests to test. For workflows, always configure hardhat.config.js first with networks and Solidity settings. Use scripts for deployment: write a JS file in scripts that imports ethers and deploys contracts. Test iteratively: compile, run tests, then deploy. Always use environment variables for sensitive data, like process.env.PRIVATE_KEY in scripts.

Related skills
Installs
23
GitHub Stars
5
First Seen
Mar 7, 2026