What Is the Purpose of the ‘Gas Limit’ Parameter When Submitting a Smart Contract Transaction?
The gas limit is the maximum amount of computational effort (measured in gas units) that the user is willing to pay for a transaction. Its purpose is to protect the user from unbounded execution costs.
If the contract execution requires more gas than the limit, the transaction will fail, preventing the user from spending an unexpectedly large amount of money due to a bug or complex logic.