Gas - Reading Assignment

  1. You calculate the the gas costs plus each part of the transaction in the smart contract.

  2. This corresponds the the MAXIMUM amount of gas you are willing to spend on the transaction.

  3. Your contract will start to execute but if it runs out of gas your contract will not be mined to the network, and you will lose the gas fee you submit to the miner.

  4. 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 ether gas prices are measured in

1 Like
  1. How do we calculate the total gas cost for a transaction?
    Add together the cost of gas per operations within the smart-contract.
  2. What is gas limit?

The maximum amount of gas you’re willing to spend.

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

The transaction fails and the miner keeps the fees.

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

You receive a refund for the difference.

  1. What is a gwei?
    The smallest unit of ether
1 Like
  • How do we calculate the total gas cost for a transaction?
    The total gas cost is calculated by adding up the cost of gas per transaction for the smart contract. The cost of gas per transaction could be found on the etherscan reference table.

  • What is gas limit?
    A gas limit is what you pay to process a specific transaction in Ethereum. it is the amount of gas you are willing to pay.

  • What happens if we specify a gas limit that is too low?
    The transaction will start to process but it would not be completed and the transaction will stop. The gas amount you paid will not be refunded.

  • What happens if we specify a gas limit that is too high and therefore not consumed fully?
    The remainder of the unused gas amount will be refunded.

  • What is a gwei?
    A Gwei is a unit of ether. 1000000000 Wei.

1 Like
  1. Gas price per gas used.
  2. It´s the total gas that an user is willing to spend.
  3. Your transaction will start to be executed, but will eventually run out of gas and be stopped. You will not get back ether spend on the gas used, but since the transaction did not complete.
  4. By 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. Gwei is 1 billion Wei (smallest unit of ether)
1 Like
  1. How do we calculate the total gas cost for a transaction?
    By adding the sum of the cost of each 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 will run out of gas and be stopped. Gas spent will not be refunded.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    Excess gas is refunded.
  5. What is a gwei?
    Part of the gas price. Wei is the smallest unit of ether. a gwei is one billion wei.
1 Like
  1. Total gas cost is the sum of the cost of each operation included in the given transaction

  2. Gas limit is the max amount of gas that user is willing to spend on his/her transaction

  3. When gas limit specified is too low, the tx will start being executed but will be stopped, eventually. The fee taken will not be refunded, but the transfer will not occur as the tx is not completed, the blockchain will not be updated.

  4. When gas limit specified is too high, the tx possibly will stay in mempool because the miners would not want to deal with tx that is not computationally dense enough - miners are only get paid for the actual gas used to perform tx.

  5. Gwei is a fraction of Ether equals to 1000000000 wei. Wei is the smallest unit of Ether.

1 Like
  1. Gas cost is calculated by setting a Gas Limit and Gas Price.
  2. Gas limit is the max amount of gas that can be spent on the transaction.
  3. The transaction will be start to be executed but will never be completed as it will run out of gas which will not be enough to get included into a certain block. The funds will neve leave the wallet and the paid fees are never returned.
  4. As the miners are only paid for the consumed gas specified in the block, there is no need for them to deal with a higher gas limit.
  5. Gwei is a unit for the gas measurement at represents 1000000000/ 1000000000000000000 of ether.
1 Like

1- By adding up the cost of each operation on the EVM
A 21000 min gas limit for a Tx
2-The amount you are willing to pay to have the Tx confirmed.
Unspent gas is refunded however if the Tx fails, the fees are kept by the miner.
3-The Tx may fail because it will have run out of gas
4-The un used portion is refunded automatically
5-The gas price is measured in ETH called wei
and usually in gwei ( 1,000,000,000,000 wei )

This article really helped me understand this, finally!

1 Like
  1. By calculating the cumulative sum of all operations involved in the transaction.
  2. It’s maximum amount one is willing to spend on the transaction.
  3. The transaction will fail.
  4. The amount will be automatically refunded.
  5. 1 gwei is 1000000000 wei, with wei being the smallest unit of ETH.
1 Like
  • How do we calculate the total gas cost for a transaction?
    Current Gas Price can be checked online Etherscan or EtherGasStation, and the Gas Limit for things other than simple transfers can only be known by looking at the smart contract code or by looking at what the organization behind the ICO / smart contract says is appropriate for their smart contract.
  • What is gas limit?
    It is the maximum amount of gas one is willing to spend on the transaction.
  • What happens if we specify a gas limit that is too low?
    It results in a failed transaction. The transaction will not be carried out. The transaction will start to be executed, but will eventually run out of gas and be stopped. In that case, your funds never leave your wallet. However, the fee paid will be lost.
  • 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?
    Wei is the smallest unit of ether, and gwei is simply 1000000000 wei.
1 Like
  • How do we calculate the total gas cost for a transaction?
    By adding up all the execution cost of all computation needed.
  • What is gas limit?
    How much you are willing to spend on gas needed to execute the contract.
  • What happens if we specify a gas limit that is too low?
    The computation may start but fail half way and run out of gas.
  • What happens if we specify a gas limit that is too high and therefore not consumed fully?
    It will be refunded back to user
  • What is a gwei?
    Wei is the smallest unit of ether. 1 gwei is 1000000000 wei
1 Like

1.All transactions, from simple transfers to ICO smart contracts, require some amount of operations to perform. The cumulative sum of all the operations is the total gas cost for the transaction.
2. This corresponds the the maximum amount of gas you are willing to spend on the transaction.
3.Your transaction will start to be executed, but will eventually run out of gas and be stopped.
4.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. Wei is the smallest unit of ether, gwei is 1000000000 wei.

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?
    – When on a site like MyEtherWallet, you’re going to see 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?
    – 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.

  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, 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. 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, but isn’t computationally-dense enough for miners to want.

  5. What is a gwei?
    – Wei is the smallest unit of ether, and gwei is simply 1000000000 wei.

2 Likes
  1. by summing the cost of each operation.

  2. The maximum gas you are willing to spend on a transaction is called gas limit.

  3. The transaction most likely will not go through. in another word it will not be picked by miners to execute, also the fee will be lost but the ETH will not leave the wallet.

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

  5. The gas price is calculated based on gwei. gwei is simply 1 billion wei( Wei is the smallest unit of ETH)

1 Like
  1. By summing up all the computation (functions within a smart contract) that is required to complete the transaction
  2. The max amount of gas you want to pay to complete the transaction
  3. The transaction will not be performed, the gas is “lost” (in the pocket of the miner) and the funds returned to the owner
  4. the excess amount of gas is returned
  5. Wei is the smallest unit of ether, 1 gwei is 1.000.000.000 wei. This is a unit of account used for calculating gas prices.
2 Likes
  1. Total gas of a transaction is calculated adding the cost of each instruction in the code and the type of transaction.
  2. Is the maximum fees that we’re willing to pay for the transaction.
  3. If the gas limit is too low, the transaction may not be completed and we will not be returned the gas up to the point in which we run out of gas.
  4. If the limit is too high, the transaction will consume only what it needs.
  5. Wei is the smallest unit of Ether and Gwei is giga Wei.
2 Likes
  1. How do we calculate the total gas cost for a transaction?
    By adding up all operations used in the transaction and it’s depend on the complexity of each operation
  2. What is gas limit?
    The gas limit is the limit that you willing to pay in order too execute and confirm any transaction.
  3. What happens if we specify a gas limit that is too low? The transaction will failed
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully? The excess of gas will be refund automatically
  5. What is a gwei?
    A gwei is 1000000000 wei ( this is a fractionnal part of Ether)
1 Like

Response:

  1. Total gas cost is calculated by adding all parts of the operations involved. The more ops involved, the higher the gas cost.
  2. The maximum amount that you’re willing to spend for the tx is known as the Gas Limit.
  3. If you don’t figure a sufficient gas amount, your tx will start to execute, but then run out of gas and won’t be able to finish. The amount that was spent up until the point of running out will be lost, however, the amount being transferred will remain in your possession.
  4. Having too high of a gas limit will most likely be overlooked by miners as you are consuming the space of the block being mined and they know that the actual gas you will spend on the tx won’t pay out after the operations are calculated.
  5. a gwei is 1 billion wei units (the smallest unit of ether being 1 wei)
1 Like
  1. How do we calculate the total gas cost for a transaction?
    you just need to calculate which operations are required for the EVM to process, check each operation gas price, and then sum it all up.
  2. What is gas limit?
    It is the maximum amount of GAS you’re willing to spend in a given transaction.
  3. What happens if we specify a gas limit that is too low?
    If this is the case, maybe the transaction will start to be executed and will not be finished because of too low gas. If this is the case, you will not get the gas spent (I find this rather unfriendly to the newbees). So whatever GAS you spent will never go back, but the amount you were going to send with the transaction is still there, because it never left the wallet.
  4. What happens if we specify a gas limit that is too high and therefore not consumed fully?
    This excess gas is returned automatically.
  5. What is a gwei?
    is 1 ether times 10 to the minus 18th power. it is 0.0000000000000000001 Ether
2 Likes
  1. Each mathematical operation executed by the EVM has a gas cost based on its complexity, and the cumulative sum of all the necessary operations is the total gas cost.
  2. Gas limit is the highest amount of wei a user is willing to pay to execute a transaction
  3. The transaction will stop and will not be recorded to the next block, but the gas will be lost.
  4. blocks have a maximum gas limit that it can consume, so exceeding this amount will not help your transaction proceed
  5. Wei is the smallest possible unit of ether, and 1 gwei = 1e9 wei.
1 Like