[Ethereum] How is Ethereum Wallet’s transaction cost calculated


Lately, I've seen wildly varying transaction costs when using Ethereum Wallet. How is the fee range computed?

Current range:




Best Answer

The Mist wallet will be connecting to a local Ethereum protocol implementation, commonly Geth. Mist connects to Geth via Web3.js and transaction fees are relayed back to your Mist wallet depending on how you client implementation calculated it.

Mist would be using the estimateGas API to help with its calculations:


And we know that transaction fees are calculated as:

Total gas cost = estimatedGas * gasPrice;

Basically, Mist would be executing something similar to this:

var transactionFee = web3.eth.gasPrice * web3.eth.estimateGas(transactionObject);

You can find the exact source code from the Mist project that calculates this here.
To understand transaction fees in more detail: please refer to this question.

Finally, you're probably seeing these fluctuations in transaction costs because of the wide range of gas prices on the network set by miners on the network. Right now, it costs very little to get your transaction mined, see here. If the miners decrease their gasPrice to include more transactions then they'll see an increase in orphan rate. The cost of getting orphaned is denominated in ETH, so the gas price miners are willing to accept should go up as the ETH price does.

Hope this helps.

Related Topic