Gas - Reading Assignment

  1. How do we calculate the total gas cost for a transaction?
    The cumulative sum of all operations that deploy the transaction and smart contract.

  2. What is gas limit?
    It is the maximum amount of gas allotted to the transaction.

  3. What happens if we specify a gas limit that is too low?
    Results in a failed transaction and the fee paid will be lost. But the ether transferred never leaves the wallet since the blockchain was never updated.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Your transaction will not be processed if it’s going to exceed the maximum amount of gas all transactions of a block can consume.

  5. What is a gwei?
    Gwei is 1 billionth ether, or 1 billion Wei

1 Like
  1. The total gas cost of a transaction depends on the amount of computation required to complete the transaction
  2. Gas limit is the maximum amount of gas willing to spend on a transaction.
  3. The transaction fails and the fee paid will be lost. But ether transferred in the wallet is unchanged on the blockchain.
  4. Unspent gas will be refunded.
  5. wei is the smallest unit of ether, and gwei is 1000000000 wei.
1 Like
  1. How do we calculate the total gas cost for a transaction?
    All transactions require a certain amount of operations to perform. Each of these operations requires a certain set amount of gas cost for that operation. The cumulative sum of the gas cost for all of the operations is the total gas cost for the transaction.

  2. What is gas limit?
    The gas limit is the maximum amount of gas that you are willing to spend on the transaction

  3. What happens if we specify a gas limit that is too low?
    In this case the transaction will start to be executed but at some point will run out of gas and be terminated. if this occurs then the transaction will be cancelled as though it never occurred on the blockchain, but the ether spent on the gas for the transaction will be consumed and not refunded.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    There is a specified maximum limit that all the transactions in the block can consume. Any gas limit specified above this will not be received by the miners (and therefore incentivize them), and will instead be refunded automatically

  5. What is a gwei?
    gwei is a unit of measuring gas price. Numerically it is 1 Billion wei,with wei being the smallest indivisible unit of measure

1 Like

1. How do we calculate the total gas cost for a transaction?
The sum of the gas costs for each operation performed. Gas costs per operation can be found online.
2. What is gas limit?
The amount of gas you are willing to use to execute said operations. If you do not specify a high enough gas limit, your transaction could fail.
3. What happens if we specify a gas limit that is too low?
The transaction will fail and you will lose ether equal to the gas cost * gas price for the operations performed up to that point.
4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
The remaining gas not consumed will be refunded.
5. What is a gwei?
A smaller unit of ether.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    It’s the cumulative sum of all operations (That all have their own allocated cost).

  2. What is gas limit?
    It’s the maximum amount of gas you are willing to spend on a transaction.

  3. What happens if we specify a gas limit that is too low?
    The transaction could fail.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    The extra gas gets refunded automatically.

  5. What is a gwei?
    Wei is the smallest unit when talking about Ether Gas price, Gwei is 10000000000 Wei.

1 Like
  1. Total Gas cost = total gas limit x total gas price. This will give a result in gwei, which is a unit of ether. 1 ETH = 1,000,000,000 gwei. For instance, 21,000 gas limit x 80 gas price = 0.00168 ETH - this is how much a user has to pay in order to execute a TX or smart contract.

  2. The total amount of gas that I am willing to spend for a TX.

  3. If I set a gas limit that is too low, the TX may not be completed as it’d run out of gas. In this case, that user won’t get the ether spent on that gas.

  4. In the case of setting the gas limit too high and when it doesn’t get consumed fully, the user gets back the unspent gas automatically.

  5. gwei is called ‘giga-wei’, and it is a unit of Ether.

1 Like

The sum of the cost(s) for each operation

Maximum amount of gas allowed by the user for a transaction.

Transaction will fail and not be added to a block

The transaction will probably stay in the mempool.

Gwei is a fractional denomination of etherium

1 Like

Hey guys!! Loving finally understanding gas!

  1. How do we calculate the total gas cost for a transaction?
    By calculating the sum of all the operations.
  2. What is gas limit?
    The maximum amount of gas a person is willing to spend on a transaction.
  3. What happens if we specify a gas limit that is too low?
    Your transaction will begin execution but eventually stop when your gas runs out; and more annoyingly, for the you as the user, since your transaction was not complete, the gas will have been used up while your transaction remains incomplete.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Miners get paid for the actual gas consumed by a transaction, and putting a high value for the gas limit fills up the block, making it less interesting for miners as they are trying to maximize the quantity of transactions in a block to keep the blockchain clean and less messy. If it is too high it will not be accepted.
  5. What is a gwei?
    It is 1000000000 wei which is the smallest unit of ether. (Similar to the concept of satoshis)
1 Like
  1. Calculate total cost for the different parts of the transaction.

  2. The maximum amount of gas you are willing to spend for a transaction.

  3. Transaction may start but not finish. The spent gas is not returned, however, as the network did not have the transaction propagated it is (aside from the gas lost) as if it never happened.

  4. Since the blocks have a maximum gas limit size, the transaction may stay in the mempool as the transaction is not does not fit if the limit is too great. Otherwise the leftover will simply be returned.

  5. A billion wei, which is in turn the smallest fraction of ether denominated.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    A. By calculating the total sum of all the operations.

  2. What is gas limit?
    B. The maximum amount you are willing to spend for a transaction.

  3. What happens if we specify a gas limit that is too low?
    C. your gas is used up, the transaction is not done. No refunds!

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    D. All excess is returned to the originator (Not used). Like getting a full glass of water, drinking half and returning the portion not used.

  5. What is a gwei?
    E. one million wei. the base unit used to pay for transactions on the EVM.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    The total gas cost is calculated by adding up all the pre-determined costs per operation but the transaction cost is subject to a minimum of 21000 gas plus the cost of any fall back functions if its send to a contract
  2. What is gas limit?
    gas limit is the maximum amount of gas that you are willing to pay.
  3. What happens if we specify a gas limit that is too low?
    the transaction will start but then fail and any ether spent on used gas will not be returned, although no transfer of Ether will take place because the transaction failed and was not added to the block.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Miners are only played for consumed gas. You set a maximum you are willing to pay n total and the gas that not are consumed will be refunded back to you.
  5. What is a gwei?
    Gwei are a sub-currency of Ether. There are several calculators you can use.
1 Like

1. 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.”

2. What is gas limit?

The maximum amount of gas you’re welling to spend on a transaction.

3. What happens if we specify a gas limit that is too low?

You’ll keep the funds you were trying send, but the gas will be spent and will not be refunded.

4. What happens if we specify a gas limit that is too high and therefore not consumed fully?

Any unspent gas will be refunded automatically.

5. What is a gwei?

Wei is the smallest unit of ether, and gwei is simply 1000000000 wei.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    The Gas Price is the price of each gas unit measured in a fractional amount of ether, typically gwei.

  2. What is gas limit?
    When on a site like MyEtherWallet, there a field called Gas Limit . This corresponds the the maximum amount of gas you are willing to spend on the transaction.

  3. What happens if we specify a gas limit that is too low?
    Then the gas used for the transaction will be go to the miners and the original funds remain as the transaction never completed.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    The excess gas will be send back to the user’s wallet.

  5. What is a gwei?

1 Gwei is 1B wei, Ethereums gas price unit.

1 Like
  1. 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.

  2. What is gas limit?
    The maximum amount willing to be spent on gas for the transaction

  3. What happens if we specify a gas limit that is too low?
    If there is not enough gas for the transaction the it will run out of steam and stop, so in the case of a transfer then funds would not arrive at the destination as they never essentially left the wallet.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Any unused gas is returned but if the gas is too high there is a possibility that it will be rejected due to exceeding block gas limits.

  5. What is a gwei?
    The smallest measurement denomination of ETH and the unit of measurement for gas on the Ethereum network.

1 Like
  1. It is the sum of all operations (lines of code) involved in that transaction
  2. The maximum amount of gas you want to spend to broadcast that transaction
  3. The transaction might fail or executed only partially… which would result in the gas being taken by the miners and not refund
  4. Unspent gas is refunded but not if it is too big
  5. Gwei is the unit of account of how gas is priced
1 Like
  1. How do we calculate the total gas cost for a transaction?
    The total Gas cost is calculated by adding up all the pre-determined costs per operation but the transaction cost is subject to a minimum of 21000 Gas plus the cost of any fall back functions if its sent to a contract.
  2. What is gas limit?
    Gas Limit is the maximum amount of gas that you are willing to pay for a transaction.
  3. What happens if we specify a gas limit that is too low?
    The transaction will start but then fail and any Ether spent on used gas will not be returned although no transfer of Ether will take place because the transaction failed and was not added to a block.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Because Ethereum blocks have a gas limit size, it is likely that the transaction will stay in the Mempool as Miners will not want to deal with the transaction because it is not computationally dense enough. This is because the miners only get paid for the actual gas consumed to perform a transaction.
  5. What is a gwei?
    A Gwei is a fractional part of Ether in that is represents 1000000000 wei. Wei is the smallest unit of Ether.
1 Like
  1. The total gas cost depends on the difficulty of the transaction. The sum of all operations is what gives the total gas amount.

  2. Gas limit is the maximum amount of gas you are willing to spend for a transaction or operation on the network.

  3. If the limit is too low, no miner will be interested in putting your transaction into the next block and therefor your transaction won’t go through.

  4. If it’s too high, and the transfer is accepted then the extra will be refunded. If it’s too high, to the point where the miners don’t accept it, due to maximum gas per block, the transaction won’t be accepted by miners.

  5. 1000000000 wei, which is the smallest unit of ether.

1 Like
  1. By adding all the gas costs for executing each part of a transaction and use of a smart contract
  2. maximum cost of gas a user is willing to pay for transaction
  3. Transaction will not execute .The Ether transaction fee will be lost
  4. Unspent gas will be refunded
  5. 1 gwei is 1 billion wei. wei is one unit or Ether
1 Like
  1. How do we calculate the total gas cost for a transaction?
    This is the sum of all operations for performing a transaction.
  2. What is gas limit?
    The limit amount of gas we are willing to pay to ensure our transaction is processed / mined.
  3. What happens if we specify a gas limit that is too low?
    Transaction will start to be processed, but because gas limit is too low the gas will be “consumed” or spent on the miner, but the primary balance will remain in the wallet because the transaction is not compelte.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Only the relevant amount used for the transaction will be spent.
  5. What is a gwei?
    Unit of gas, the smallest unit of ether, where 1 ether contains 1 billion gwei. A gwei itself consists of 1 billion wei.
1 Like
  1. How do we calculate the total gas cost for a transaction?
    you add up the amount of each performed aciton and multiply it by the price of each one which leads to the total gas cost.

  2. What is gas limit?
    the maximum amount of gas you are willing to pay for the transaction

  3. What happens if we specify a gas limit that is too low?
    the transaction might not even be picked up by the blockchain, the eth spent on used gas will also not be returned.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    the transaction will stay in the mempool as every block has a gas limit and miners will not want to deal with a transaction as it is computationally not dense enough, this is because miners only get paid for the actual gas consumed to perform a transaction

  5. What is a gwei?
    gwei is a fraction of ETH which represents 1 billion wei. Wei is the smallest unit of ether

1 Like