Is there any reliable way to determine how much gas your smart contract will consume based on the current gas price? That's the one piece that still confuses me.
You are viewing a single comment's thread from:
Is there any reliable way to determine how much gas your smart contract will consume based on the current gas price? That's the one piece that still confuses me.
It depends. Gas price is set for each instruction in the EVM, and you can see exactly which instructions will be run in a smart contract. In this sense, you can absolutely know how much gas a function in a contract will cost. The tricky part is that there can be loops/jumps that will change how many times a function runs, and that can't be known sometimes.