Gas - Reading Assignment

  1. Calculate the sum total of all operational gas costs by their predetermined values.

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

  3. Your transaction wont be able to complete, so the transaction wont be added to the block, failling due to running out of gas, when this occurs any Ether spent on used gas will not be returned.

  4. The unspent gas would be returned automatically.

  5. Gwei is short for gigawei, or 1,000,000,000 wei. Wei, as the smallest (base) unit of ether.

1 Like
  1. Add all operations and that is the total gas cost of the operation.
  2. Maximum amount of gas you will spend per transaction.
  3. The request will still be executed but it will stop if the gas runs out.
  4. It will be refunded.
  5. The smallest amount of ether
1 Like
  1. The calculation of gas price is based on how fast the user wants the transaction to occur, how much they are willing to pay and how much the nodes are willing to process the transaction for.
  2. The gas limit is the amount the user is willing to pay for the transaction.
  3. The remainder is credited back to the user’s account.
  4. gwei is 1000000000 wei
1 Like
  1. Each element of a transaction has a unit cost, you simply add these unit costs to establish the total gas cost of the transaction.

  2. The gas limit is the highest price you’re willing to spend on a transaction.

  3. If the gas limit is too low, the transaction will still be initiated, but then fail to complete due to an insufficient spend on the transaction fee. The fee offered will be lost.

  4. If the gas limit set is too high, the transaction will occupy too much of the block size relative to the size and complexity / density of the transaction. Excessive fees may also result in process rejection of the transaction.

  5. Gwei is a billion wei, which is a smallest unit of ether.

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?
    This is 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?
    Your transaction will start to be executed, but will eventually run out of gas and be stopped.
  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. The cumulative sum of all the operations is the total gas cost for the transaction.

  2. The maximum amount of gas used for a transaction to go through.

  3. Your transaction will not go through and the gas that is spent will not be refunded.

  4. If the gas limit is set too high the transaction may be rejected.

  5. Gwei is a denomination of gas that is equal to 0.000000001 ether .

1 Like
  1. It depends on the computation required to execute a tx.

  2. It is the maximum amount of gas you are allocating for a tx.

  3. If the gas limit is too low the tx will fail and you will lose the ether used for gas.

  4. Your tx will not process if your gas limit is higher than the gas limit of a block.

  5. gwei is the smallest unit of ether.

1 Like
  1. The amount of gas depends on the amount of computation required to complete the transaction.
  2. is the maximum amount of gas allotted to the transaction
  3. Insufficient gas in the Gas Limit will result in a failed transaction and the fee paid will be lost.
  4. There is a chance that miners won’t select this transaction to execute, as they are paid based on gas actually spent.
  5. Gwei is a fractional part of Ether, commonly used to refer to gas price.
1 Like
  1. The total gas cost for a transaction is specified by the sender of a transaction, which can either be accepted or rejected by a miner to place into a block. The sender will specify the maximum amount of gas they are willing to spend on the transaction (gas limit), and the price per unit of gas they are willing to pay, usually in wei or gwei.
    So the sender of the transaction will specify these two parameters, and depending on the type of transaction the miner will use a certain amount of gas, which is then multiplied by the incremental gas price set by the sender. This gives us the total gas cost for a transaction. The excess gas between what was used by the EVM and the senders gas limit never leaves the wallet, and the sender retains this gas.

  2. The gas limit is the maximum amount of gas the sender is willing to spend on the transaction. This is the upper bound of what they want to spend, and if the EVM needs to use more than this to complete the transaction, it will be reverted, and the only gas that is used is the amount required to open the transaction. If the EVM uses less than the gas limit set by the sender, it never leaves the senders wallet.

  3. If a sender specifies a gas limit that is too low, the EVM is unable to perform the transaction without going above the gas limit and the transaction will revert. The sender will keep their gas, minus the cost of opening the transaction, which goes to the miner.

  4. Each block has a gas limit on it’s own so it’s important to keep the gas limit close to what is required by the EVM to perform the transaction. If the sender sets an extremely high gas limit, it will fill up the miners block limit, and leave less room for other transactions to be placed into the block. This means that the miner may not accept your transaction if you are too heavy with the gas limit as it takes up scarce resources of block gas limits. A small discrepancy between the gas limit and what is required by the EVM is ideal for a miner, and if it’s a small amount it’s likely the miner will place your trasaction into the block and you will retain the excess gas that is not used by the EVM.

  5. A gwei is is fraction of ETH. There are 1000000000 gwei in 1 ETH. So when there is a gas unit cost of xx, it usually means 0.xxxxxxxxxx ETH per unit of gas used to perform the transaction.

1 Like

1.- By adding the operations necesary to be performed plus you can set a limite to to amount.
2.- It is the maximum amount that you can set for a gas fee.
3.- The funds will not leave the wallet and the operation will eat up all the fee and not return it back to the user.
4.- The diference will be returned to the user, only the requered amount will be used not all of it.
5.- It is the minimal part of ether.

1 Like

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

Total gas is the sum of the costs for each operation; MetaMask (and similar) will calculate this for you.

What is gas limit?

Gas limit is the total budget allocated to all operations

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

If the gas limit is too low - the operation may not get added to a block or it may not complete. The later scenario results in you losing the gas spent up to the point of running out of gas.

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

If gas limit is set too high (and the transaction is picked up by a miner), the unspent gas is returned

What is a gwei?

Gwei is a unit of ether and is the cost per unit of gas

1 Like

1.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.Gas Limit is the upper boundary of how much you are willing to spend on the execution.3.
3.The transaction will process until the lmiit is met. If it’s too low, the transaction will stop (get rolled back / not committed) and the user will not get their spent gas back.
4.The unused gas is refunded but the transaction might not be processed as each block has a gas limit.
5.GWei is the smallest amount of Ether and gwei is 1000000000 wei

1 Like
  1. Gas is a determined cost of an operation that is executed on the Ethereum network.
    It depends on the amount of computation required to complete the transaction.
    For a transaction to be executed & succee several operations may be needed.
    We calculate the total gas needed by calculating the sum of the gas of all the operations included in
    a transaction.

  2. Gas limit is the maximum amout one is willing to spend on a transaction.

  3. A too low specified gas limit will result in a failed transaction, while the fees will be kept by the miner.
    As the transaction did not complete, the blockchain does not reflect a transfer.
    The funds never left the wallet as the transaction started executing but run out of gas.

  4. The blocks have a gas limit that specifies the max amount of gas all the tx in the block can
    consume.Ether miners have the option to in/de-crease the gas limit of blocks so that they are quickly
    propagated. We cannot exceed this amount if we wish our tx to be processed.
    Putting a high value for the gas limit fills up the block gas limit.
    The tx will not be executed, but in this instance the tx starts & conusmes gas or is reverted saving us
    all gas?

  5. A gwei is a denominator of the gas paid, a part of Ether, where it’s smallest part is wei & gwei is
    1000000000 wei.

1 Like
  1. The sum of all operations
  2. The maximun amount of gas you are willing to spend.
  3. A failed transaction and the fees used up to the failed transaction are kept by the miner.
  4. Miners are only paid for the gas used for the transaction and nothing more. There is a gas limit for the block and miners wil not pickup you transaction if its going to take up space they could have been using on another transaction
  5. A gwei is 1000000000 wei
1 Like

You add up the cost of all of your operations, each action has a cost depending on its computational task, simple tasks are cheaper than complex smart contracts, Like going into a shop you can buy a can of coke for a small price, a bottle of wine a little more expensive or a high end malt whiskey costing a lot more.

Its the price you’re willing to pay for the transaction. the price fluctuates with the market and it more expensive at certain times when there is high traffic and lower prices when less traffic. when prices are low demand goes up and prices follows.

The transaction will fail. you will pay the gas fee to the miner but as the transaction was not completed you won’t pay the fees associated with the transaction you were trying to process.

The unspent gas is refunded because the transaction was not processed.

it’s a fraction of an Ether.
Wei is the smallest unit of Eth and a Gwei is 1000000000 Wei

1 Like
  • How do we calculate the total gas cost for a transaction?
    Sum of all transaction costs, almost everything has costs except for viewing things in the blockchain (i think), like view functions such as check balance.

  • What is gas limit?
    Max amount you can manually set for a gas fee (higher fees makes faster transactions)

  • What happens if we specify a gas limit that is too low?
    The transaction would not likely get processed (no miner would do your transaction if the gas pain to them is too low)

  • What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Unspent gas is returned to owner

  • What is a gwei?
    The metric used for gas, smallest unit of Ether

1 Like
  1. We calculate the total gas cost for a transaction by the amount of operations and complexity of the transaction. The cumulative sum of all the operations is the total gas cost for the transaction.

  2. A gas limit is the maximum amount of gas you are willing to spend on the transaction.

  3. If we specify a gas limit that is too low it will result in a failed transaction and the fees are kept by the miner. The main funds will be kept.

  4. If we specify a gas that is too high and therefore not fully consumed the extra unspent gas will be refunded.

  5. A gwei is 1000000000 wei which is the smallest unit of ether.

1 Like
  1. We calculate the total gas cost for a transaction by adding all operations in the contracts together. The sum of those is the total gas cost.

  2. Gas limit is the maximum amount of gas that you are willing to spend on a transaction. It varies depending on the transaction you are deploying.

  3. If we specify a gas limit that is too low, the transaction will fail and the miner will keep the fees.

  4. If we specify a gas limit that is too high and therefore not consumed fully, the transaction will not be processed.

  5. A gwei is a gas price.

Thanks!

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

It depends on where we’re sending ether and how much such functionality will cost inside the evm.

  1. What is gas limit?

The maximum amount of gas we are willing to spend

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

The functions will run out of gus, stop executing and the transaction will fail to finalize, but the already spent gas will be consumed.

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

Blocks have a gas limit so it may not be processed.

  1. What is a gwei?

1000000000 wei (giga wei I presume ?)

1 Like

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

Every operation performed on the Ethereum Virtual Machine has a gas cost. The sum of the gas cost for all operations included on a transaction gives us the total gas cost.

What is gas limit?

The gas limit is the maximum amount a user is willing to spend for a transaction to be made.

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

When we specify a low gas limit, the transaction will start executing but will not finish because it got short of gas. This means the transaction will not be reflected on the blockchain but the amount specified for gas would be spent anyway.

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

It’s not recommended to put a very high amount of gas as blocks have gas limits and miners only get paid for the actual gas used for the transaction. Setting a high gas will consume space on the block, space that could be used by miners for other transactions; this means there are less chances that miners pick your transaction.

What is a gwei?

Gwei is used as a metric to measure the price of gas.
Wei is the smallest unit of ether --> 1 gwei = 1000000000 wei

1 Like