How do we calculate the total gas cost for a transaction?
The cumulative sum of all the operations is the total gas cost for the transaction.
What is gas limit?
The MAXIMUM amount of gas you are willing to spend on the transaction.
What happens if we specify a gas limit that is too low?
Your transaction will start to be executed, but will eventually run out of gas and be stopped. When this happens, you will not get back ether spend on the gas used, but since the transaction did not complete, the blockchain does not reflect a transfer, so the main funds essentially never left the wallet.
What happens if we specify a gas limit that is too high and therefore not consumed fully?
The blocks have a gas limit that specifies the maximum amount of gas all transactions in the block can consume. You cannot exceed this amount if you wish for your transaction to be processed. Miners only get paid for the actual gas consumed by a transaction, you are returned the remainder.
What is a gwei?
- gwei is a fractional part of Ether
- It represents 1000000000 wei. Wei represents 1 and is the smallest unit of Ether