What is the “gas limit” in Ethereum?
Gas is a unit of computation for the Ethereum network. Some Ethereum transactions are more complex than others, so they will require more computational power.
When you send an Ethereum transaction, you specify a “gas price” and a “gas limit”. The “gas price” determines how much you are willing to pay for each unit of gas, whereas the “gas limit” determines the maximum units of gas you’re willing to pay for.
Simple ETH transfers require exactly 21,000 units of gas. More advanced transactions involving smart contracts can require much more than that, depending on the complexity of the transaction. The exact amount of gas units required is usually not possible to calculate in advance, because of the way Ethereum works.
The network cost for an Ethereum transaction is equal to your “gas price” multiplied by the units of gas used (which is not necessarily the same as your “gas limit”).
Any excess gas of your Ethereum transaction will be returned to your address. For example, if you set a gas limit of 100,000 and your transaction only uses 90,000 units of gas, you will only pay for the cost of 90,000 units of gas (i.e. 90,000 multiplied by your “gas price”).
If you send an Ethereum transaction with an insufficient “gas limit”, you will be charged the network fee for those units of gas even though the transaction will fail. This is because miners still need to spend computation power to process your transaction whether it is completed or not.
Increasing your “gas limit” will generally have no effect on the speed of your transaction; miners are normally only interested in your “gas price”.