MultiversX Tracker is Live!

Trying to send all of my ETH in geth console: gas required exceeds allowance

Etherum Reddit

More / Etherum Reddit 107 Views

EDIT This is solved, see bottom

I'm trying to transfer as much ETH as I can to sideshift's address in geth console with the following command:

txh = eth.sendTransaction({from: eth.accounts[0], to: "0x25E8ac4C93c561672D22Ce6c0c7f90AbDC1F45eB", value: eth.getBalance(eth.accounts[0]).sub(web3.eth.gasPrice.mul(21000))}); Error: gas required exceeds allowance (10501) at web3.js:6387:9(39) at send (web3.js:5116:62(29)) at <eval>:1:26(27) 

But I always get the above error. Is there something wrong in my calculation? I don't actually know what the number in brackets is (10501) But I figured maybe a transaction does not cost 21000 in gas as I've read, so I tried the same with web3.eth.gasPrice.mul(21000 + 10501) instead, but get the same error now reading Error: gas required exceeds allowance (15752) (which is almost exactly 10501 + 10501/2, but maybe that's a coincidence).

Anyway, any help and suggestions are appreciated. Thanks!


SOLVED. Still not sure what the problem was exactly, it was probably either too low gasprice, or too little funds (due to miscalculation or rounding errors?)

In the end, I changed 2 things: I upped the gasprice a little from what eth.gasPrice reported, and added this price and the total gas explicitly to the call to sendTransaction

eth.gasPrice; [currentgasprice] var mygasprice = [some slightly higher value, I think I used 1.25 * currentgasprice]; var transactioncost = mygasprice.mul(21000); txh = eth.sendTransaction({from: eth.accounts[0], to: "0x25E8ac4C93c561672D22Ce6c0c7f90AbDC1F45eB", value: eth.getBalance(eth.accounts[0]).sub(transactioncost), gas: 21000, gasprice: mygasprice}); 

this way, the transaction went through almost instantly and left my account with exactly 0.0 ether.

Thanks everyone!

submitted by /u/bepaald
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments