Where can I find the source code file where the EVM extracts the gas cost of all OPCODES? What I need is the file where the EVM calculates the gas cost of SLOAD, ADD, etc. For example, hardhat-gas-reporter plugin is able to calculate the gas cost of a smart contract's functions. From where do they get this information?

1 Answer 1


You can find gas prices that Hardhat uses from ethereumjs-monorepo.

For instance, DELEGATECALL opcode was introduced with HomeStead hardfork, and the base fee is found here.

I'm assuming that these gas fees are referenced from the yellowpaper and additional EIPs are drawn from the Ethereum Github repository. e.g. EIP-7(homestead hardfork).

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.