Author

Topic: Calculating gas (Read 390 times)

member
Activity: 89
Merit: 10
July 26, 2016, 05:21:26 PM
#3
use this to send 1 eth, substitute 1 with 5.24 if you want to send 5.24 eth:

Code:
eth.sendTransaction({from: eth.coinbase, to: "anotheraddress", value: web3.toWei(1, "ether"),gas:22000,gasPrice:web3.toWei(21,"Shannon")})

this will send from your (synced!) main geth account to anotheraddress.
21 Shannon or 21 gwei will do right now.

somehow getbalance transaction never worked for me.

Ok, thank you for your answer!, but if I put my total wallet amount instead of 1, I get the same error...

eth.getBalance(eth.coinbase) runs perfectly in my server, but I get the same error...

I tried also this:

eth.sendTransaction({from: eth.coinbase, to: "destAdrress", value: eth.getBalance(eth.coinbase)-(22000*web3.toWei(21,"Shannon")) , gas:22000 , gasPrice:web3.toWei(21,"Shannon")})

And then, the same error... Sad

"Insufficient funds for gas * price + value"

and web3.toWei(21,"Shannon") runs fine, I get:

"21000000000"

and eth.getBalance(eth.coinbase) runs perfectly to me!

No serious problem about this because at the end of the day I can transfer the whole number without decimals Wink, but I would like to know how I can transfer all my wallet.

Another idea?
legendary
Activity: 3892
Merit: 4331
July 26, 2016, 04:45:09 PM
#2
use this to send 1 eth, substitute 1 with 5.24 if you want to send 5.24 eth:

Code:
eth.sendTransaction({from: eth.coinbase, to: "anotheraddress", value: web3.toWei(1, "ether"),gas:22000,gasPrice:web3.toWei(21,"Shannon")})

this will send from your (synced!) main geth account to anotheraddress.
21 Shannon or 21 gwei will do right now.

somehow getbalance transaction never worked for me.
member
Activity: 89
Merit: 10
July 26, 2016, 04:34:03 PM
#1
Sorry for the question, I know that it's a newbie question but I readed a lot of information and I can't tranfer all my eth balance, and I don't know exactly what I'm doing wrong.

I used this in geth:

eth.sendTransaction({from:eth.coinbase, to:"address", value: eth.getBalance(eth.coinbase)-(21000*50000000000)})

And I get: "Insufficient funds for gas * price + value"

I specify also the gas amount and the price:

eth.sendTransaction({from:eth.coinbase, to:"address", value: eth.getBalance(eth.coinbase)-(21000*50000000000) gas:21000 gasPrice:5000000000})

But I get the same error. I know that I need to use some gas in my transaction and so, but I don't know how exactly calculate the correct amount.

Anyone can help me?

TIA

Jump to: