1

A simple question on gas spent on a transaction here.

I'm experimenting with testnet transaction on a simple contract that stores a value, trying to figure out how much a client would pay. What would be exact cost of gas in ETH of this transaction?

https://ropsten.etherscan.io/tx/0x560e98b194ea5d5cbf05160cc4f01cf495c4a16b85abed4db8344ef1dc1fc656

Would it be 0.0024565 testnet Ethers, i.e. 0.0024565*336$ (price of 1 ETH when I write this) = 0.82 dollars in real network?

So the fee for 33 cents transaction would be 82 cents if it were on the production blockchain, is this so?

Thanks.

2

The transaction cost is calculated on the basis of gas and gas price. The formula is -

gas*gasprice

From the documentation -

The way the fee works is as follows. Every transaction must contain, alongside its other data, a GASPRICE and STARTGAS value. STARTGAS is the amount of "gas" that the transaction assigns itself, and GASPRICE is the fee that the transaction pays per unit of gas; thus, when a transaction is sent, the first thing that is done during evaluation is subtracting STARTGAS * GASPRICE wei plus the transaction's value from the sending account balance. GASPRICE is set by the transaction sender, but miners will likely refuse to process transactions whose GASPRICE is too low.

Take a look at this question to understand the concept of Gas.


So you may end up losing extra amount once your transaction is completed because of the transaction fee. You can decrease the GAS value to lower the transaction fee but in that case, miner may give low priority to your transation and that will delay transaction completion.

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.