0

I can specify a gas price and a gas limit. These give me the maximum values. I need to be able to compute the exact amount that is going to be deducted when I do a simple send (EOA to EOA transfers).

Is that possible? In Bitcoin, I can specify the exact fee I need to pay. I know Ethereum is not Bitcoin but at least for simple sends as above, this should be possible.

1

On blockchain:
Read opertaion -- free
Write operation -- cost according to transaction

When you send some ether to someone, actually you're writing that transaction on ethereum blockchain and Write operation cost some amount of ether in form of gas. You can put a cap on gas consumption for the transaction, how much you are ready to pay. This cap will determine your transaction validation time, means how much time it will take to verify and add in blockchain. Transaction with low gas takes more time compared to higher one.
This gas cost is a fee you're paying to miners to validate your transaction.
You can visualize this on Mist browser.

0

You can specify the exact fee you want to pay. The fee you pay is product of gas and gas price.

fee = gas * gasPrice

These give me the maximum values

No. These values are what you are willing to pay. You can estimate the gas before sending a transaction. See estimate gas. For EOA to EOA ether transfer (without additional data) the gas required is 21,000.

So if you are willing to pay 21GWei as your gasPrice. The exact price you pay is 0.000441 ether (0.000000021*21000).

Same applies to any transaction on the ethereum blockchain. You can estimate gas and then compute the exact dee that you will pay by computing gas*gasPrice.

It's up to you that what gas and gasPrice you are willing to pay, so you decide what fee you are willing to pay for the transaction.

Note : Be aware of consequences of supplying less gas and gas Price. If you supply less gas than the transaction requires, the transaction will run out of gas exception and your fee will be consumed. If you supply higher gas than required, then excess gas is refunded to your account.

0

You can estimate the exact fee need to mine the transactions in Ethereum Network.

myContract.methods.myMethod([param1[, param2[, ...]]]).estimateGas(options[, callback])

The above function estimateGas() helps us to estimate the exact amount of gas required mine the transactions.The estimation can differ from the actual gas used when later sending a transaction, as the state of the smart contract can be different at that time.

After Estimating the fee you can specify that while executing the functions as gas fee.

For details refer here.

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.