Gas - Reading Assignment

Gas :oil_drum:

  1. How do we calculate the total gas cost for a transaction?
    Every operation the EVM performs to complete a transaction has a fixed price. The sum of all these operational costs is equal to the total gas cost of the transaction. Gas, in turn, has a variable price itself which is to be paid in ETH, respectively fractions thereof.

  2. What is gas limit?
    It is the upper limit to the cost you are willing to spend on a certain transaction.

  3. What happens if we specify a gas limit that is too low?
    When the accumulated costs for a transaction exceed the gas limit that has been set the execution is stopped and the ledger is not updated. The operational costs up to that point, however, are paid to the miner.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Only the actual costs for the operations the miner performs for a given transaction will be paid out. Any surplus will be kept by the originator of the transaction.

  5. What is a gwei?
    The smallest unit ETH can be divided into is called wei. If we’re using the short scale there is 1 quintillion wei in 1 ETH. The ‘G’ in gwei stands for the prefix giga- which corresponds to a billion. Thus, 1 gwei is equal to 1 billion wei and there are 1 billion gwei in 1 ETH.

1 Like
  1. The cumulative sum of all the operations is the total gas cost for the transaction.
  2. This is the maximum amount of gas you are willing to spend on the transaction.
  3. Transaction will start but when it runs out of gas it will be stopped.
  4. Leftover gas will be refunded.
  5. Gwei is 1.000.000.000 wei, where wei is the smallest unit of ether.
1 Like
  1. How do we calculate the total gas cost for a transaction?
    The sum of all operations processed in a smartcontract
  2. What is gas limit?
    The maximum amount of gas you are willing to expend on a transaction
  3. What happens if we specify a gas limit that is too low?
    The transaction could fail , as the miner can reject it. So the operation could start and stop at any time. So the gas spent during this process is lost
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    This extra amount is automatically refunded
  5. What is a gwei?
    Gwei is 1000000000 Wei , which is the basic unit to calculate the ethereum price to spend per unit of gas in the transaction. So the final price would be Total = Gas * gwei
1 Like
  1. the total gas cost for a transaction is related to the amount of executions required for that transaction.
    ie: a simple transfer will be cheaper than interacting with a complex smart contract

  2. Gas limit is the total amount of gas you are willing to spend in a single transaction.

  3. If a specified gas limit is too low the miner executing the transaction will start to execute the transaction and enevitably will run out of gas, this will lead to the miner dropping the transaction and it failing.

  4. Gas that is not consumed is returned to the wallet

  5. “gwei” is a measurement of “wei” the smallest amount of ether. 1 gwei = 1000000000 wei

  1. How do we calculate the total gas cost for a transaction?
    The cumulative sum of all operations is the total gas cost for the transaction
  2. What is gas limit?
    max amount what i’m willing to spend for smart contract
  3. What happens if we specify a gas limit that is too low?
    transaction is rejected or just not accepted
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    gas refund
  5. What is a gwei?
    Wei is smallest unit of ETH
1 Like

1.The total Gas cost is calculated by adding up all the predetermined costs per operation, but the transaction cost is subject to a minimum of 21000 Gas plus the cost of any fall back functions.
2. The maximum amount of gas you are willing to spend on the transaction.
3. It will result in a failed transcation syphoning the gas spent.
4. Excess automatically refunded
5.Wei is the smallest amount of Ether and gwei is 1000000000 wei

2 Likes

1. How do we calculate the total gas cost for a transaction?
gas cost = gasLimit × gasPrice × (1/10⁹)

2. What is gas limit?
Maximum amount of gas we’re willing to spend on a transaction

3. What happens if we specify a gas limit that is too low?
Transactions with a lower gas limit than the gas used will never execute. In this case, you will not be refunded the Ethers spent on the gas used.

4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
Miners become more reluctant to execute the transaction (too high gas limit may exceed the block gas limit, in which case your transaction will not be executed).
Miner prefer highest gas price and the lowest gas limit. The reason for lowest gas limit is that more transactions can be squeezed into the same block.

5. What is a gwei?
Wei is the smallest (base) unit of ether and gwei(gigawei) is 1,000,000,000 wei

1 Like
  1. The cumulative sums of all the operations is the total gas cost for the transaction. Depending on the complexity of the operation the is how the big or small the cost of the gas will be.

  2. This is the maximum amount of gas you are willing to spend on a transaction.

  3. The transaction will run out of gas and eventually be stopped.

  4. The transaction will stay in the Mempool as Miners wont facilitate 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. gwei is a fractional unit of ether. Similar to a satoshi of bitcoin.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    The total cost of a transaction is the product of the gas limit and gas price : ( gas limit x gas price ) = transaction fee.

  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?
    Your transaction will start to be executed, but will eventually run out of gas and be stopped. Providing too little gas will result in a failed transaction, the fees are kept by the miner. 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.

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

  5. What is a gwei?
    Gwei is short for gigawei, or 1,000,000,000 wei. Wei, as the smallest (base) unit of ether. a unit of Gwei is defined as one-billionth (one Nano) of an Ether. So 1 Gwei equals 0.000000001 or 10-9 ETH.

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.

The value of gas is driven by the market and the nodes that prioritize higher gas prices when mining transactions.

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

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

Transaction fails.

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

Remained gas will be sent back to a user.

  1. What is a gwei?

Gwei is a fractional amount of ether.

1 Like
  1. How do we calculate the total gas cost for a transaction?
    You add up all the gas costs for executing each part of a transaction, there are table where you can see how much gas costs for an action.

  2. What is gas limit?
    It is the maximum amount of gas that the user is willing to pay for a transaction.

  3. What happens if we specify a gas limit that is too low?
    You will not get back ether spend on the gas used If its to low the contract wont execute.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Etherum Blocks have a gas limit size. The unused gas is refunded but the transaction might not be processed you cannot exceed the gas limit of the blocks if you wish for your transaction to be processed.

  5. What is a gwei?
    The smallest unit of ether and a gwei is 1000000000 wei.

1 Like

It’s caclulated based on the types of action you want to do onchain

It is the maximum cost of gas a user is willing to pay

The transaction will fail.

The transaction will go true and you will get back the excess amount of gas that was not needed

A Gwei is a fractional part of Ether. It represents 1.000.000.000 wei. Wei is the smallest unit of Ether.

1 Like

It’s caclulated based on the types of action you want to do onchain

It is the maximum cost of gas a user is willing to pay

The transaction will fail.

The transaction will go true and you will get back the excess amount of gas that was not needed

5
A Gwei is a fractional part of Ether. It represents 1.000.000.000 Wei. Wei is the smallest unit of Ether.

1 Like
  1. The cumulative sum of all the operations is the total gas cost for the transaction
  2. gas limit = the max amount of gas you are willing to spend on the transaction
  3. transaction will start to be executed, but will eventually run out of gas and be stopped
  4. blocks have a gas max limit (like block size in byte in Bitcoin) and it is possible that your tx will not be proceeded by the miners as it is not computationally dense enough. Miners only get paid the actual gas consumed for the tx.
  5. Wei is the smallest unit of ether, and gwei is simply 1.000.000.000 wei
1 Like
  • 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?
    Providing too little gas will result in a failed transaction.

  • What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Extra, unspent gas is refunded.

2 Likes
  1. Total gas for a transaction is calculated as a sum of all operation costs.

  2. Gas limit is a miximum amount of gas you are willing to pay for the transaction.

  3. If we set a gas limit that is too low, then the transaction will be not executed - it will stop. Gas will be assigned to miner. Object of the transaction (for example Ether sent) stays where it is, since it never left the wallet.

  4. Gas limit that is too high will result in transaction to be completed and gas that exceeds the operational costs will be refunded. There is also a miximum gas limit per block set by miners and if gas limit exceeds this amount, then the transaction will not be received by miners since it would slow the blockchain speed.

  5. Gwei is a smaller unit of Ether and is used to set a gas price.

2 Likes
  1. How do we calculate the total gas cost for a transaction?
    The cumulative sum of all operations is the total gas cost for the transaction

  2. What is gas limit?
    The Total 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 run out of Gas and stop but the Gas spent will belong to the miner.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Miners only get payment for the used Gas of a transaction and the remaining unused Gas will be returned.

  5. What is a gwei?
    Gwei is the unit of the gas price, it is another unit of ether. 1 ether is 1 billion gwei

2 Likes
  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

1.- Total gas of all actions in the smart contract/transaction.
2.- Maximum amount of gas someone is willing to pay.
3.- The transaction or smart contract is rejected and not fully executed.
4.- Unspent gas is refunded.
5.- Gwei = 1000000000 wei, the smallest unit of ether.

2 Likes
  1. How do we calculate the total gas cost for a transaction?
    The amount of gas depends on the amount of computation required to complete the transaction.

  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, 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?
    Putting a high value for the gas limit fills up the block gas limit, but isn’t computationally-dense enough for miners to want.

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

2 Likes