How Is the Actual ‘Gas Used’ Calculated for a Smart Contract Execution?
The 'Gas Used' is calculated by summing the pre-defined gas cost for every operation (opcode) executed by the Ethereum Virtual Machine (EVM) during the transaction. Different opcodes, such as storage writes, reads, or simple arithmetic, have different fixed gas costs.
The total sum reflects the computational effort required.