3

I deploy the contract to the Rinkeby. Can I calculate the contract deployment cost from HardHat?

1
  • 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
    Commented Jul 9, 2022 at 12:10

2 Answers 2

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: Avg. Deployments is where you find the gas cost for deployment

0
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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.