When users withdraw ETH from our website then users must pay fee the transaction. So what should be the Fix fee for each withdrawal?

For example

User want to withdraw 0000001233489520 wei from our website

then how much wei i should decrease from the deposit amount to charge user for the fee?


Depends on how you have implemented the withdrawal. I can see two options: through a smart contract or your backend issuing a transaction to send Ether from a wallet.

1) Through a smart contract

If the user initializes the withdrawal, they have to pay the transaction fee and it doesn't make sense to reduce the amount of Ether they get. If you initialize the withdrawal, you have to analyze how much gas the transaction requires and you can reduce the sent Ether based on that.

2) Backend issuing a transaction

In this case there is no smart contract involved and your backend system (not inside the blockchain) sends a transaction to tranfer the Ether to the user's wallet. You can use http://ethgasstation.info/ to estimate how much the transfer costs.

  • For the second scenario: the transaction receipt contains gasUsed. Multiply that by the gasPrice of the transaction and you get the precise fee. My suggestion is: overestimate the fee, when the user starts the withdrawal, and after the transaction succeeds, refund the remaining gas to the user's account. – mafrasi2 Mar 27 '18 at 12:16

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.