I deploy the contract to the Rinkeby. Can I calculate the contract deployment cost from HardHat?
Asked
Active
Viewed 1,817 times
3
-
Use the hardhat gas report plugin then write and run a unit test , it will show u how much gas the deployment consumed. – Majd TL Jul 09 '22 at 12:10
2 Answers
5
If you npm install hardhat-gas-reporter in your project directory so that it appears in your package.json then whenever you execute a unit test file from your test folder it should log you a chart like this:

tiz.io
- 103
- 4
Hursh Desai
- 51
- 1
0
You can deploy to a standalone hardhat fork of mainnet and monitor the logs. It will give you something like this:
eth_sendRawTransaction
Contract deployment: <UnrecognizedContract>
Contract address: 0x6345e5...
Transaction: 0xee7f0f...
From: 0xf39fd6...
Value: 0 ETH
Gas used: 3439611 of 3439611
Block #18153240: 0x9963cd...
tiz.io
- 103
- 4