Search code examples
hardhat

Tools for costs estimation


Testing a smart contract for implementing very basic functionality
Everything works as expected, enjoyed it so far and would like to build on functionality

Is there any way to see upfront the gas amount required for the deployment of my contract?


Solution

  • Yes, you can compile your contracts and create the transaction that would deploy your contracts without actually deploying your contracts.

    You can use the hardhat gas reporter which also gives you an estimate of the gas estimation, this time it will be within hardhat. https://github.com/cgewecke/hardhat-gas-reporter

    If you have a simple contract, you can add it to https://remix.ethereum.org/ and compile it. When you hit the deploy button, there should be this pop-up that lets you view the gas estimation, gas limit, and the current max fee, which gives you a good estimate of your transaction fee. enter image description here