5

Address A holds 1 ether and address B holds 0 ethers.

Lets create a transaction to transfer all balance from A to B.

This transaction will consume roughly gas_price * gas_used = 20 gwei * 21000 = 0.00042 ethers at the time of writing.

In the end, the B will hold 1 - 0.00042 = 0.99958 ethers either way since there's only 1 ether in total existence.

When the sender creates the transaction, say with https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction, should he leave the estimated transaction cost 0.00042 ethers in A and reduce the transaction value to 0.99958? Or is the fee reduced from the transaction's value automatically?

Put another way, if the sender sets the transaction's value to be 1 ether, will this transaction complete or not?

1 Answer 1

5

Do not amend the value to be transferred by costs. The value specified in the transaction is transferred as is.

On top that, the sender will be charged gasSpent * gasPrice, which in the case of value transfer is fixed (as mentioned in the question). This is taken additionally.

Note that the geth node will check if the account balance is less than gasLimit * gasPrice + value and reject the transaction if it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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