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.
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.
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
Install the development dependency with the command below.
npm install --save-dev hardhat-gas-reporterAdd
import "hardhat-gas-reporter"tohardhat.config.ts.Run the command below to generate a gas report.
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.
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

