Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: Henri Cartier on February 20, 2020, 11:11:47 AM



Title: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: Henri Cartier on February 20, 2020, 11:11:47 AM
Recently, I did a transaction and it got failed due to out of gas. So I increased the gas limit and resent many times but still, it did not go through. Below is the error I am getting on the blockchain -

https://i.imgur.com/VlfeVbY.png

The transaction id is - 0x3300f036d11577ca2e171f7fca295442c6344cb5e8fe9a68b0ae474c8a517bce

Please help me, what should I do in this case?


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: DdmrDdmr on February 20, 2020, 12:05:56 PM
Take a look at the other TXs around the time you sent yours:
https://etherscan.io/txs?a=0xe0b7927c4af23765cb51314a0e0521a9645f0e2a&p=9 (find your TX here, or in the following pages, since more TXs may have been added since I wrote this post).

Check the Gas limit and Gwei they used (*) by those that passed as a commited TX. You’ll see that they use a larger gas limit (and way lower Gwei too, so you can lower your value). Tokens normally require higher gas limits, and your’s is below those I’ve seen.
The TX on some of those went through with around 37,467 Gas used (you used a limit of 34,693).

(*) Look at the parameters in the "click to see more" section of TXs (this is yours https://etherscan.io/tx/0x3300f036d11577ca2e171f7fca295442c6344cb5e8fe9a68b0ae474c8a517bce).


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: akhjob on February 20, 2020, 12:57:34 PM
Either the gas limit and gwei are low as mentioned above or the tokens might have been locked.

Edit: Just checked your address 0x26cfe324f40817e9fe8c6d1262c82a74e010ff9a (https://etherscan.io/address/0x26cfe324f40817e9fe8c6d1262c82a74e010ff9a). Looks like the issue was fixing low gas limit and your have moved the tokens. Please close the topic as issue was resolved.


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: rosezionjohn on February 20, 2020, 03:37:15 PM
A good way to avoid having this 'out of gas' error is to always check the allowable gas at a particular time or the 'safe low'. You can see it on sites like https://www.ethgasstation.info I usually add one or two more gwei to the safe low in case the gas fee suddenly increases while I'm trying to send. Sometimes I would just follow the standard for faster tx confirmation.


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: hosseinimr93 on February 20, 2020, 04:05:21 PM
The best thing you can do to avoid such error in future is to use bigger amounts for gas limit.
Note that the extra gas will be sent back to your wallet. So you won't lose anything if you use bigger amounts than needed for the gas limit.

The transaction fee is calculated as follows:
Transactions fee = used gas * gas price

The confirmation time and fee depend on gas price and has nothing to do with gas limit.

If a transaction needs 50,000 gas to be made and you use 200,000 gas, the 150,000 extra gas will return to your wallet. So, I recommend you to use big amounts for the gas limit and use ETH Gas Station (https://ethgasstation.info/) for gas price.

If you use bigger amounts than needed for gas price, you will waste your Ethereum. But you lose nothing if you use bigger amounts than needed for gas limit.

For making a transaction, you need to have gas limit * gas price in your wallet. But the amount finally deducted from your wallet is used gas * gas price.




Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: jackg on February 20, 2020, 04:48:25 PM
A good way to avoid having this 'out of gas' error is to always check the allowable gas at a particular time or the 'safe low'. You can see it on sites like https://www.ethgasstation.info I usually add one or two more gwei to the safe low in case the gas fee suddenly increases while I'm trying to send. Sometimes I would just follow the standard for faster tx confirmation.

Have no idea how ethereum works but I had to use dai and I just use 1 gwei every time I want to send something... Seems to confirm within an hour and I don't care about fast transactions so...


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: hosseinimr93 on February 20, 2020, 05:13:37 PM
Have no idea how ethereum works but I had to use dai and I just use 1 gwei every time I want to send something... Seems to confirm within an hour and I don't care about fast transactions so...

1 Gwei is what you used for gas price. The transaction will finally be confirmed even if the gas price is 0.1 Gwei

1 Gwei = 10-9 Ethereum

The problem OP faced is not due to low gas price. That's due to low gas limit. If the gas limit is lower than gas needed to be used, the transaction will be failed even if the gas price is 1000 Gwei.

Gas price is something like Sat/byte in bitcoin transactions.

A big difference of Ethereum with bitcoin is in size of the transaction.
In bitcoin transactions, you don't need to enter the size of transaction. But in Ethereum you must do that.
Used gas is something like size of transaction.

In bitcoin transactions:
Fee = size (in byte) * (Sat/byte)

In Ethereum transactions:
Fee= used gas * gas price

For making a transaction in Ethereum blockchain, you must enter a value for gas limit. The gas limit must be bigger than gas needed to be used. Otherwise, the transaction will be failed.
The gas that is not used (extra gas) will be sent back to your wallet.

In most of Ethereum wallets, the gas limit is automatically entered by the wallet and that's why you haven't faced any problem till now.


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: bitmover on February 20, 2020, 11:29:50 PM
I made this topic log ago about how to use the gas system I  ethereum

Take a look. You need to increase gas limit, but you can use a low gas price.

Some time ago I participated in an Initial Coin Offering (ICO) and they defined the following parameters for Eth contributions:
Maximum Gas Price: 50 Gwei
Gas Limit: 150 000
I made a little research to learn what these attributes means.

Gwei, Wei and Ether are different unit measures of the same thing.
1 Ether = 1.000.000.000.000.000.000 Wei
1 Wei is the smallest unit of Ether, as 1 Satoshi (0.00000001 BTC) is the smallest of Bitcoin.

All computational work of running Smartcontracts or transactions in the Ethereum Network are paid in Ether (Eth), which is the fuel of that network.
Gas is a unit of measuring this computation work, which is usually measured in Gwei.
Some amount of Gas is charged for every computational operation in the Etehreum Network. For example, and addition costs 5 Gas.

Gas Limit and Gas Price attributes define the total cost of your transactions, according to the formula below:
gas limit * gas price

Gas Price: Amount of Gwei you are willing to spend per unit of gas.
Gas Limit: Maximum amount of units of gas you are willing to spend on a transaction.

From my ICO example, if the Gas Price is 50 Gwei and the Gas Limit is 150.000, this transaction will cost 7.500.000 Gwei (or 0.0075 Eth).

To determine what is the gas price, just check out this website
https://ethgasstation.info/


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: LbtalkL on February 20, 2020, 11:59:21 PM
Take note Gas limit is different from Gas Price, Some tokens requires higher Gas limit enable to transfer their tokens.  If this will happen to you again or this problem is not fixed yet, try to search the contract address of the token on etherscan and look for successful transaction and look what gas limit and gas price they used and copy and try it. That should went through, there are some cases also that out of gas means the token are locked but with this case I guess your token is not locked you need to increase Gas Limit I have seen successful transfers on 80k Gas limit. and for gas price used recommended here ethgasstation.info


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: hosseinimr93 on February 21, 2020, 04:19:21 AM
-snip-

No, that's not how transaction fee is calculated.

Transaction fee is not gas limit * gas price. Transaction fee is used gas * gas price.

Given the amount of gas limit, there are two cases.

  • If the gas limit is lower than gas needed to be used, the transaction will be failed and gas limit * gas price will be wasted.
  • If the gas limit is bigger than gas needed to be used, the transaction will be made. Used gas * gas price will be deducted from your wallet and extra gas * gas price will return to your wallet.  
    (Extra gas = gas limit - used gas)
    In this case, the transaction speed only depends on gas price and has no relation with gas limit or used gas.

Take a look at the transaction OP made.
https://etherscan.io/tx/0x3300f036d11577ca2e171f7fca295442c6344cb5e8fe9a68b0ae474c8a517bce

In this transaction, gas limit is 34,693 and gas price is 0.00000075 Ether (750 Gwei). Gas limit was less than gas needed to be used and transaction was failed.  
34,693*0.00000075= 0.02601975 was wasted.

According to what is shown in etherscan, the OP increased the gas limit and finally made the transaction.

Take a look at this transaction.
https://etherscan.io/tx/0xf7c65f88608ae4ecf9e9277c6edb9eaf6a717a0c2c40c1e6b318431052f59a7d

In this transaction, gas limit is 65,817 and gas price is 0.0000000066 Ether (6.6 Gwei).
As the gas limit was bigger than gas used, the transaction was successfuly made.

The fee paid for this transaction is not gas limit * gas price. The fee is used gas * gas price = 43,878 * 0.0000000066 = 0.0002895948 Ether
In this transaction, the used gas was only 43,878 which is 66.67% of the gas limit and the extra gas was sent back to the wallet.


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: libert19 on February 21, 2020, 04:26:57 AM
Use ethgasstation (https://ethgasstation.info) to estimate gas price (or use wallets like mew where they estimate automatically for you), 750 gwei way too much and unnecessary while the gas limit for token transfers should be 200k.

Repeat the transfer with 10 gwei gas price and 200k gas limit, it should go through.


Title: Re: [Need help] What should be done when the transaction fails due to "Out of Gas"?
Post by: Henri Cartier on February 21, 2020, 12:05:36 PM
Thanks, everyone for the help. The issue has been resolved.