Hardhat

96.2kstarscached

Ethereum development environment

Testing & Deployment

Official links

About Hardhat

Hardhat is a development environment for Ethereum that gives you a local network, a flexible task runner, and first-class TypeScript support. Its plugin ecosystem covers everything from verification (hardhat-verify) to gas reporting, coverage, and deploy pipelines. Hardhat's console.log in Solidity and stack traces for failed transactions remain some of the most loved features in the ecosystem.

Quickstarts

A fast path from zero to running code.

Create a new projectbash
mkdir my-project && cd my-project
npm init -y
npm install --save-dev hardhat
npx hardhat init
A minimal testts
import { expect } from "chai";
import { ethers } from "hardhat";

describe("Counter", () => {
  it("increments", async () => {
    const counter = await ethers.deployContract("Counter");
    await counter.increment();
    expect(await counter.count()).to.equal(1n);
  });
});
Run tests and deploybash
npx hardhat test
npx hardhat run scripts/deploy.ts --network sepolia

Documentation

The Hardhat docs are organised around Getting Started, Guides (testing, deployment, forking), the Config reference, and a Plugins directory. The Hardhat for Viem guide is the fastest way to a modern TS + viem workflow.

Read full docs

Community Notes

Tips, gotchas, and updated examples from the community.

No community notes yet.

Be the first to share a tip, gotcha, or updated example.

Share a note

Related Tools

Browse all →