I'm building a sort of ether exchange. Now suppose I have 2eth in my wallet, and I want to transfer all of it to any user. What value should I transfer from my 2 ethers such that gas can also be deducted from my account and my account becomes empty at the end of the transaction? What is the math? How do I calculate it?? If it is dependent upon the difficulty level of mining then how can my calculations co-op up with it?? Any help would be appreciated, thanks.


If you just want to do a plain ether transfer between accounts then it costs 21,000 gas. Approximately the average gas price is 21Gwei now in the network, so your transaction fee is around 0,00044 ETH. So, you should have cca. 2,00044 ETH on your account.

This could be useful for you to do the math taking into account the changes of the gasprice you can easily calculate here the transaction fee.

Related post

  • The transaction goes into pending. Nothing happens. Any reason? – Sankalp Sharma Sep 28 '17 at 13:15
  • First guess: increase transaction fee, second guess: if you send it to a contract address, have a look at the fallback function of the contract. – István András Seres Sep 28 '17 at 14:37
  • It committed after two hours(ropsten) – Sankalp Sharma Sep 29 '17 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.