Gas - Reading Assignment

  1. How do we calculate the total gas cost for a transaction?
    Sum the cost of all operations performed in a smart contract.

  2. What is gas limit?
    Maximum gas amount you set to use.

  3. What happens if we specify a gas limit that is too low?
    The transaction may fail but the gas used during the transaction is spent.

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

  5. What is a gwei?
    1 gwei = 10^9 wei

1 Like
  1. How do we calculate the total gas cost for a transaction?
    By the sum of costs of all executed functions.
  2. What is gas limit?
    The minimum and maximum amount of gas one can set to execute a transaction.
  3. What happens if we specify a gas limit that is too low?
    The lower limit is 21000 Gas. If there isn´t enough gas the execution of the tranasction will stop and the spent gas will be lost but no transaction will be completed.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    It fills up the block gas limit.
  5. What is a gwei?
    Wei is the smallest unit of ETH. 1 Gwei is 10^9 Wei
1 Like
  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?
    the maximum amount of gas allotted to the transaction

  3. What happens if we specify a gas limit that is too low?
    insufficient gas results in a failed transaction, with the gas fee lost, but the transfer of the asset never leaves the wallet.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    blocks have a gas limit that specifies the maximum amount of gas all transactions in the block can consume. You cannot exceed the maximum amount for the transaction to be processed. Miners only get paid for the actual gas consumed by a transaction, so 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?
    – a denomination of Ether used on the Ethereum network to buy and sell goods and services.
    – one-billionth of one ETH
    – Used to specify Ethereum gas prices
    – refers to the fee or pricing value required to successfully conduct a transaction on the Ethereum network.

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

All transactions within the EVM require some amount of operations to perform. Each of these operations has an associated cost in gas. The cumulative sum of all the operations is the total gas cost for the transaction.

  1. What is gas limit?

Gas limit is maximum amount of gas user is willing to spend on the transaction.

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

If we specify a gas limit that is too low our transaction will start to be executed, but will eventually run out of gas and be stopped. Since the transaction did not complete, blockchain would not reflect a transfer and our funds will never stay in the wallet.

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

Since miners only get paid for the actual gas consumed by a transaction, putting a high value for the gas limit fills up the block gas limit, but isn’t computationally-dense enough for miners to want so it will probably stay in Mempool.

  1. What is a gwei?

Wei is the smallest unit of ether (ether = 1000000000000000000 wei), and gwei is simply 1000000000 wei.

1 Like
  1. The costs for transactions depends on the amount of computational steps, necessary to execute the transaction - the costs for specific operations is fixed and denominated in ‘gwei’. The transaction costs are then cumulated based on the operations requested. There is some base fee which must be paid and some ‘tip’ which can be paid in order to ensure faster processing and inclusion into blocks.

  2. Gas Limit describes the maximum amount of ‘gas’ one is willing to pay for a transaction.

  3. The transaction will not be executed, however the ‘gas’ used for starting the execution of the transaction will not be refunded.

  4. The Blocks have a gas limit that specifies the maximum amount of gas all transactions in the block can consume (comparable to, ‘block size’) - gas which can not be consumed will be refunded. ‘Validators’ may not be interested in executing the transaction, as this one single transaction might fill up the maximum amount of gas, which can be consumed within one block. Validators get paid only for the actual gas consumed.

  5. Smallest amount of Ethereum native-coin; Ether.

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

We calculate total gas cost for a transaction by adding up the total gas cost for each of the actions to do, and then multiply the total by it by the current GWEI value

  1. What is gas limit?

Gas limit is the maximum amount of gas someone designate for a transaction or operation on the network.

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

The gas will be spent and not refunded, but the transaction will not complete

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

The unspent gas will be returned to the wallet. If the gas limit is too high, miners may not want to handle the transaction and hence the transaction stays in the mempool.

  1. What is a gwei?

1000000000 wei

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

the sum of all operations inside the transacion would be the gas cost: " All transactions, from simple transfers to ICO smart contracts, require some amount of operations to perform. Each of these operations has an associated cost in gas . Thus, simple transactions like transfers will require less gas to perform than more intense smart contracts."

  1. What is gas limit?

gas limit is the max fee someone is willing to pay, in ether, for the transaction

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

the transactiton may stopped and not completed, thus increase the chance to paid for a failed transaction.

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

the leftove may be return back to the user; miners would only collect for set gas fees

  1. What is a gwei?

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

1 Like

A1. By summing cost of each operation in smart contract.
A2. Max amount user is willing to pay as fee.
A3. The transaction will have to wait until miners agree to process it at that amount.
A4. The transaction will have to wait in mempool until the block gets filled for miner to consider mining it.
A5. A fraction part of Ether

1 Like
  1. How do we calculate the total gas cost for a transaction?
    The gas cost can be calculated from the operations connected with the transaction.
  2. What is gas limit?
    A limit to how much gas you will buy for doing a particular transaction.
  3. What happens if we specify a gas limit that is too low?
    The transaction will not be completed. The assets which would have otherwise been transferred from your wallet remian there, since the blockchain is not updated about a transfer from your wallet. However the gas fees are spent, and not returned to your wallet.
  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?
    gwei is 1000000000 wei
2 Likes
  1. Total cost of transaction is calculated by adding up all operations of a smart contract code, each line of code costs a certain amount of gwei to run.

  2. Gas limit is the maximum amount of ether you want to spend on the transaction and is set by the sender.

  3. If too low gas has been set, the transaction will run out of gas and get sent back to your wallet. but the already spent gas will still be sent to the miner (or validator/staker now?)
    b) If too high gas has been set, any unused gas will not be spent, but if it exceeds the max limit in the smart contract, the transaction will fail.

  4. ‘Gwei’’ A small amount of Ethereum’s currency ether.
    1 gwei is one-billionth of 1 ETH. Term is often used to measure GAS prices when submitting transactions.
    The different denominations of ethereum also have different names after them, for example: Gwei has the name ‘‘Shannon’’ named after Claude Shannon. An expert of Information Theory, coder and crypto-analysis. Ether has ‘‘Buterin’’, guess who that is named after?

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.

  1. What is 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?

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.

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

  1. What is a gwei?

Gwei is a denomination of the cryptocurrency ether (ETH).

1 Like
  1. Total gas price is calculated as a sum of the gas price for each piece of code in a transaction.
  2. Gas limit is the the maximum amount of Gas a user is willing to pay for the execution of code.
  3. If the transaction Gas limit is too low the transaction will not be executed but the gas fees will be lost.
  4. If the Gas limit is too high unspent Gas will be refunded.
  5. Gwei is 1,000,000,000 Wei. Wei is the smallest unit of Ether.
1 Like
  1. How do we calculate the total gas cost for a transaction?
    There is the traffic factor and the miners behave, the computation, the addition of each operation in transactions, the time etc. Is calculated in gwei, the smallest unit of ETH
  2. What is gas limit?
    The maximum amount of gas on that specific transaction.
  3. What happens if we specify a gas limit that is too low?
    The operation will be aborted or incomplete resulting in a loss of gas fees.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Unlikely to happen since the gas fee is offered on different levels but it could be returned on the wallet.
  5. What is a gwei?
    is the “cents” unit of ETH :grin:
    1 Ether = 1,000,000,000,000,000,000 Wei.
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.Gas Limit is the maximum amount of gas that you are willing to pay.

  1. The transaction is going to fail when you run out of gas.

4.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 a transaction.

  2. What is gas limit?
    When on a site like MyEtherWallet, you’re going to see a field called “Gas Limit”. This corresponds to 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 will start and be executed, however, it will eventually run out of gas and be stopped. Ether will not be refunded in this instance.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    The minimum gas limit for transaction is 21000 + the amount to execute any fallback functions if it’s sent to a contract. Miners only get paid for the actual gas consumed by a transaction, so 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?
    Gas price is measured in ether (specifically some amount of wei, usually gwei).

1 Like
  1. Add up the gas costs for each operation in the code that is executing
  2. The maximum amount of gas you are willing to spend on a transaction
  3. You will lose the gas and the transaction will fail
  4. The miners will get the extra gas
  5. 10^-9 ETH
  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. This is comparable to Bitcoin’s block size in bytes, but ether miners have the option to increase or decrease the gas limit of blocks so that they are propagated quickly. You cannot exceed this amount if you wish for your transaction to be processed.
gas price is usually some amount of gwei. Wei is the smallest unit of ether, and gwei is simply 1000000000 wei.

  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.

Gas price is the amount of ether you are willing to spend on every unit of gas. You determine the price of gas AND maximum amount of gas you want to spend on performing a transaction on the Ethereum network. Although gas limit is just a simple quantity, gas price is measured in ether (specifically some amount of wei, usually gwei). The value of gas is driven by the market and the nodes that prioritize higher gas prices when mining transactions.

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

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

Extra, unspent gas is refunded automatically

  1. What is a gwei?

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

  1. How do we calculate the total gas cost for a transaction?
    There’s a published table for each EVM-compatible chain as to how much gas each assembly language operation costs. Compile your code into EVM assembly and add up instructions, and calculate loops.

  2. What is gas limit?
    How much gas the user is willing to pay for their transaction to execute on-chain.

  3. What happens if we specify a gas limit that is too low?
    The transaction will likely not be picked up by validators. They want tips. Failing that the transaction will revert if gas expires before processing ends.

  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    The transaction may exceed its allocated space in the block due to the block’s total gas limit. Otherwise unused gas will be refunded to the user.

  5. What is a gwei?
    G-wei is the unit of gas on an EVM-compatible chain. It is denominated in wei, the 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? 21000 +

  3. **What happens if we specify a gas limit that is too low? **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? miners have the option to increase or decrease the gas limit of blocks so that they are propagated quickly. You cannot exceed this amount if you wish for your transaction to be processed. Also, miners only get paid for the actual gas consumed by a transaction, so putting a high value for the gas limit fills up the block gas limit,

  5. What is a gwei? This means we are only willing to spend a maximum on 31500 gas at the price of 20 gwei / gas on the transaction.

  • How do we calculate the total gas cost for a transaction?
    It’s the cost of running all the operations of a transaction on the EVM
  • What is gas limit?
    Maximum amount of gas allocated to a transaction by the user
  • What happens if we specify a gas limit that is too low?
    The operations will start but not conclude, the miner will keep the gas and the funds of the transaction will stay in the wallet (from which they never left)
  • What happens if we specify a gas limit that is too high and therefore not consumed fully?
    if the transaction goes through we get the unspent gas back
  • What is a gwei?
    The unit in which Gas is usually expressed. 1gwei is gwei is 1000000000 wei(the smallest measure of ETH)