OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Hardhat Gas Reporter

Hardhat Gas Reporter is a TypeScript Hardhat plugin that collects smart-contract method-call and deployment gas metrics when a test suite runs. It can report estimated costs in national currencies and emit results in text, Markdown, reStructuredText or JSON.

Independent OpenViST project profile, based on linked sources.

Hardhat Gas Reporter — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you want gas reporting as part of an existing Hardhat test run, rather than gathering call and deployment metrics in a separate workflow.

Who it is for

  • Solidity developers who run contract tests with Hardhat
  • Teams comparing gas use across contract methods or deployments
  • Developers who need gas reports in formats suitable for review or further analysis

Documented uses

  • Collect gas metrics during Hardhat test runs.
  • Compare gas consumption for method calls and deployments.
  • Estimate national-currency costs for deploying and using a contract system.
  • Export analytics in text, Markdown, reStructuredText or JSON.
Before you choose

Requirements & limits

  • Basic reporting is enabled by default when the plugin overrides Hardhat's test task.
  • Currency-cost estimates use CoinMarketCap exchange-rate data; live gas-price and fee data for Ethereum mainnet or an L2 network can use an Etherscan API key.
  • Pure and view method readings are lower bounds, and some L1 network readings are approximate.
  • The repository lists the MIT license.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Add gas reporting to a Hardhat test workflow

Install the plugin, load it from Hardhat configuration, and generate a report by running the test task.

Before you start

  • A Hardhat project with a test suite
  • npm

Steps

  1. Install the development dependency with the command below.

    Documented command
    npm install --save-dev hardhat-gas-reporter
  2. Add import "hardhat-gas-reporter" to hardhat.config.ts.

  3. Run the command below to generate a gas report.

    Documented command
    npx hardhat test

Expected outcome

The Hardhat test run produces gas metrics for contract method calls and deployments.

Guide limitations

  • Gas readings for pure and view methods are lower bounds, since actual cost depends on call conditions and EVM storage or memory state.
  • L1 readings for Arbitrum and OP Stack networks are approximate; other EVM-based networks may require their own development clients for accurate measurements.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
9 October 2026
Original website title
cgewecke/hardhat-gas-reporter · Official homepage title · retained in its source language