Gas - Reading Assignment

  1. Gas is priced by individual parts contained within the contract. Total is the sum of the parts.
  2. Gas limit is the maximum the user is willing to pay.
  3. If the gas limit is too low, the transaction will fail and spent gas will be lost.
  4. If the gas limit is too high, any unused gas will not be spent. However if it exceeds the upper limit specified in the contract, the transaction will fail.
  5. Gwei is 10^9 wei.
1 Like

1.How do we calculate the total gas cost for a transaction? A: adding all instructions to be executed by the EVM by the request to process a transfer-tx or a tx to execute a call to a smart-contract

2.What is gas limit? A: is the maximum the user is willing to pay the miners to process the tx.

3.What happens if we specify a gas limit that is too low? A: All gas up to gas-limit will be used/spend but the tx will not proceed and will not be added to a mined block.

4.What happens if we specify a gas limit that is too high and therefore not consumed fully? A: only the amount of gas that was consumed will be paid by the wallet available ether.

5.What is a gwei? A: a little amount of ether, 1 gwei = 1 giga wei = 1 nanoether.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    Sum of all gas costs per each operation within a transaction.

  2. What is gas limit?
    A top limit of GAS that you can/want to spend to execute a transaction. Each operation has different limit. Whatever does not execute or is left over is auto-refunded.

  3. What happens if we specify a gas limit that is too low?
    Too little GAS provided makes transaction likely to fail, execute but not in entirety. Main funds of the failed transaction do not move. Fees will be kept by miners.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Unspent GAS from the Limit is refunded automatically after transaction completes. You can discourage the miner from adding to block since it is not what it seems. Blocks also have a GAS limit, if yours is too high, adding such the transaction could make the block not computationally dense enough.

  5. What is a gwei?
    Is 10,000,000,000 wei, which in turn is the smallest unit of Ethereum. It is used as currency symbol for GAS when observing price of operations.

1 Like

How do we calculate the total gas cost for a transaction?

  • Is the cumulative sum of all the operations involved in a transaction.

What is gas limit?

  • The maximum amount of gas you are willing to spend on a transaction.

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

  • A low gas limit will result in a failed transaction and the fees are kept by the miner. Since, it will start executing line by line the different operations on the transaction, and when you run out of money the transaction will stop.

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

  • Extra, unspent gas is refunded automatically.

What is a gwei?

  • Is one of the units of ether used, usually, to specify the gas price for a transaction.
1 Like
  1. How do we calculate the total gas cost for a transaction?

It depends on the function and complexity of the task/code you want to run.

  1. What is gas limit?

A gas limit is the maximum amount of GAS you’re willing to pay for a transaction.

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

Your transaction will get started but will then stop when it runs out of GAS.

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

It will fill up the block even though the miners don’t get the extra gas. This is not recommmended since it will make your transaction less appealing to miners and fill up the blocks prematurely.

  1. What is a gwei?

Gwei is a unit of Ether. It is generally used to calculate the gas price which fluctuates based on market conditions.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    Adding all the operation inside the smart contract multiply the gas price.
  2. What is gas limit?
    The maximum limit of gas you willing to pay for a transaction.
  3. What happens if we specify a gas limit that is too low?
    As gas is the fees paid to the miner to execute the contract, it would not be fully executed and rejected.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Unspend gas will be refunded.
  5. What is a gwei?
    gwei is the 1,000,000,000 wei. wei is the smallest unit in ether.
1 Like
  1. The cumulative sum of all the operations.
  2. The maximum amount of gas you are willing to spend on a transaction.
  3. The transaction will be stopped, you will keep the gas, but, the ether has been spent for that gas.
  4. Your transaction may still be ignored by the miners.
  5. A gwei is a gas price of, 1000000000
1 Like
  1. How do we calculate the total gas cost for a transaction?
    summing all the operations in the transaction

  2. What is gas limit?
    it is the MAXIMUM amount of gas we are willing to spend on the transaction

  3. What happens if we specify a gas limit that is too low?
    the transaction is declined and gas is lost

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

  5. What is a gwei?
    it is 1.000.000.000 weu, and it is usually used as the price of GAS

1 Like
  1. How do we calculate the total gas cost for a transaction?

Different type of transactions have different cost in gas. We need to determine cost in gas defined for specific transaction and multiply this cost with price of gas we defined when we triggered the transaction.

  1. What is gas limit?

Gas limit is the maximal amount of gas we are willing to spend on the transaction.

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

Transaction will start to execute and will fail when it run out of gas.
All already charged fees in gas for transaction will be kept by the miner.

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

In this case unspent gas is refunded automatically.

  1. What is a gwei?

It is smaller unit of ether, used for specifying price for gas we are willing to pay for transaction.

1 Like
  1. How do we calculate the total gas cost for a transaction?

Ans : All transactions require some amount of operations to perform. Each of these operations has an associated cost in gas. For example, a simple operation like if(var > 1) may cost 1 gas, but a more complex operation to store a variable could cost 100 gas. The cumulative sum of all the operations is the total gas cost for the transaction.

  1. What is gas limit?

Ans : Gas Limit is the maximum amount of gas allotted to the transaction, 21000 being sufficient for simple transfers and much higher amounts for transfers to smart contracts like those in ICOs.

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

Ans : 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.

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

Ans : Unspent gas is refunded automatically.

  1. What is a gwei?

Ans : gwei is simply a unit which is equal to 1000000000 wei and wei is the smallest unit of ether.

1 Like
  1. How do we calculate the total gas cost for a transaction? Multiply the gas limit by the gas price
  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? It will result 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 (smallest unit of ether).
1 Like
  1. How do we calculate the total gas cost for a transaction?
    certain actions cost a certain gas value. A smart contract or a transaction consists of an action or more actions. Adding all those gas costs together determines tot total gas cost for the transaction or execution of the smart contract

  2. What is gas limit?
    This is the maximum cost in wei you want to pay for a transaction to be executed

  3. What happens if we specify a gas limit that is too low?
    if the gas limit is too low, the action will execute until the gas runs out and then the action will be cancelled (gas that was used, is kept by the miners). In the end the transaction will not be added to the blockchain.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    If the gas limit is set too high, the block size will increase too much so that a miner does not want to take that block since they only get payed for the real gas cost the transaction is worth. The block will be filled by only that transaction (if the gas limit is set really high) so no miner wants to pick up that block.

  5. What is a gwei?
    a gwei is 1000000000 wei

1 Like

One. Price of each gas unit is measured in fractional amount of Ether, typically GWEI.

Two. is the maximum amount of gas alloted to the transaction. Small for simple transactions and much higher for transfers to smart contracts like those in a ICOs .

Three. transactions will fail, fees paid will be lost but eher stays in the wallet because the transaction was never made.

Four. They give it back. It wasn’t used.

Five. Gas price is measured in GWEI.

1 Like

1. How do we calculate the total gas cost for a transaction?
You add up the gas for each operation in the transaction.

2. What is gas limit?
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?
The transaction is failed and your gas is not refunded.

4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
You get the unspent gas refunded to you.

5. What is a gwei?
1 Billion wei.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    Gas spent on processing all code x the gas price (ether) set per unit of gas.

  2. What is gas limit?
    The total amount of gas you are willing to spend in the entirety of the transaction.

  3. What happens if we specify a gas limit that is too low?
    The transaction will fail. This will result in a loss of gas spent up to that point. The ethereum blockchain will not be updated to reflect that transaction.

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

  5. What is a gwei?
    Unit of measurement (fractional amount of ether), used to pay for gas in transactions

1 Like
  1. Gas cost is calculated by the cumulative sum of all the operations for the transaction.
  2. Gas limit is the Maximum amount of gas one is willing to spend on the transaction.
  3. If too little gas is provided the transaction will fail and gas used is lost.
  4. Unspent gas is refunded automatically.
  5. A ‘gwei’ is a unit measurement of ether. The smallest unit of either is called Wei and gwei is 1000000000 wei.
1 Like

1.Gas cost = gas limit * gas price
2. The amount of gas you are willing to spend on a transaction
3. the transaction will not go through, and the gas used in for the transaction is not refunded
4. it is not going to be used, the only amount use dis the amount required by the block
5. unit of measure for the gas *10^9

1 Like

1. How do we calculate the total gas cost for a transaction?
The minimum gas limit for transaction is 21000 + the amount to execute any fallback functions if it’s sent to a contract, but the actual blocks also have a gas limit that specifies the maximum amount of gas all transactions in the block can consume.

2. What is gas limit?
Gas Limit is the maximum amount of gas allotted to the transaction, 21000 being sufficient for simple transfers and much higher amounts for transfers to smart contracts like those in ICOs.

3. What happens if we specify a gas limit that is too low?
Providing too little gas will result in a failed transaction, the fees are kept by the miner.

4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
Extra, unspent gas is 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?
    By multiplying gas price and gas limit.
  2. What is gas limit?
    It is 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 will fail. The gas spent until the failure will be lost while the funds will never leave the wallet.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    It just is not used in other words the transaction costs less than the maximum specified by the gas limit. By definition it happens to every singe transaction. It it is toooo high the miners would prefer other more ‘dense’ transaction over yours.
  5. What is a gwei?
    The smallest unit of a transaction fee / eth is wei. Gwei is 1000000000 wei while eth is 1000000000000000000 wei.
1 Like
  1. How do we calculate the total gas cost for a transaction?

You specific gas limit and gas price - multiply these two variables.

  1. What is gas limit?

The maximum amount of ether that you are willing to spend to execute a transaction.

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

The transaction may not be executed or it may be partially executed.

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

The balance is refunded.

  1. What is a gwei?

The smallest unit of measure of ether - 1,000,000,000 wei

1 Like