Gas limit can be defined as being the maximum amount of gas that someone will pay for a operation to be performed on the Ethereum network. This gas is paid in Ether (ETH), the cryptocurrency of the network. This could be used for a transaction, or the execution of a smart contract on a decentralized application (dApp).
Gas is the ‘fuel’ of the Ethereum network and is a measurement of how much computational power is needed for an operation. Gas prices are set in Gwei, a demonination of Ether. The gas price indicates how much someone is willing to pay for the gas, per unit. The gas limit on the other hand is exactly that – the budgeted amount, the limit they will pay. It is by multiplying these two together that you get how much Ether the sender is willing to spend for the transaction to be executed.
Setting gas limits are important because different operations will require different amounts of gas. While a straightforward ETH transaction will normally be set at 21,000 units (which is the minimum it can be), smart contract operations can reach even 200,000 units.
Generally, the higher the gas limit, the more complex the operation will be and the quicker they will be executed by the miners. Therefore, if the gas limit is set too low, then the transaction may be ignored by Ethereum miners and take a long time to be confirmed. Worse still, it could get stuck, essentially meaning the transaction has failed and the sender will have to attempt again.
Generally, the gas limit and gas price will be automatically determined by the wallet. It is put in place to prevent unnaturally high fees as a result of a bug in a smart contract. Also, senders pay gas to miners to estimate the cost of the transaction. If the transaction is rejected for having a too low gas limit, then the gas which is sent to the miners to estimate will not be returned. Therefore, it isn’t normally wise to adjust the gas limit manually.