how do i send all my balance

urayuray indonesiaMember Posts: 37
using geth attach, already unlocked "from" account, then i issue the following command

eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:eth.getBalance(eth.accounts[0])})

but it said : Insufficient funds for gas * price + value
how to calculate maximum amount i can send? can't it just do it automatically?


  • mpolcimpolci Member Posts: 2
    I have the same problem. Did you find the answer?
  • EllaRollinsEllaRollins Member Posts: 5
    I don't have any idea..
  • yoyoyoyo Member Posts: 34 ✭✭✭
    In order to make a transaction you need some gas. The gas is going to be taken from the account, in addition to the amount you are sending.

    Usually the gas amount is picked up by default, like when you call sendTransaction like this. But since you send all your ether, there will be nothing left on the account to pay for the gas.

    So you need a slightly more involved process, such that you send exactly all the funds minus the gas required for the transaction, and specify that gas to be used.

    Please consult this QA:


    Note the two extra parameters gas and gasPrice at the end. Here the value we send is computed from the total balance minus the gas, minus 1 to account for a rounding error.

    In this example the gasPrice is 50 shannon although it should be OK for it to be as low as 20 shannon.

Sign In or Register to comment.