 # Gas - Reading Assignment

#21
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.

#22

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.

#23
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.

#24

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.

#25
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.

#26
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.

#27
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

#28
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

#29
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.

#30
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.

#31
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).