Is there a drawback of setting a too high gas limit for a transaction?

by hefeleal   Last Updated May 15, 2019 16:28 PM

Say, I want to send a transaction that consumes around ~40,000 gas. Could I just set the gas limit of the transaction to 1 million or is there some disadvantage and I should set a more realistic gas limit? In the end I only pay for what was actually consumed, so a too high limit shouldn't matter, right?



Answers 1


If the transaction executes your on-chain function, which you obviously have 100% confidence of for not spending an excessive amount of gas, then the only drawback is that the gas limit that you set may exceed the block gas limit, in which case your transaction will not be executed.

If the transaction executes someone else's on-chain function, whose gas consumption you are possibly unaware of, then another drawback is that it might cost you a lot more then you anticipate.

In short, the gas-limit parameter is designated in order for you to protect yourself when executing someone else's code.

goodvibration
goodvibration
May 15, 2019 16:13 PM

Related Questions


Updated May 16, 2018 12:28 PM

Updated December 08, 2017 17:28 PM

Updated February 12, 2018 18:28 PM

Updated October 28, 2018 20:28 PM

Updated October 18, 2017 07:28 AM