0

According to economic incentive, gasPrice and gasLimit is required for every transaction and total transaction fee is gasPrice * gasLimit. If the transaction failed to be validated or out of gas, the transaction will not be written into block and gasPrice * gasLimit is wasted.

Here are my questions:
1. If the the transaction failed, is the error information or something saved in the chain? If not, where the transfer that gas to miners recorded? If yes, how can I get the kind of error information?
2. If the transaction is signed with incorrect private key, it should be found in the first place when node processes the transaction. Will total or part of transaction fee(gasLimit * gasPrice) costed in this scenario?

0

If the transaction failed to be validated or out of gas, the transaction will not be written into block and gasPrice * gasLimit is wasted.

This is incorrect. A transaction that runs out of gas, or fails to validate (reverts at some point during the execution) is still included in the block. However, any state changes that would have been made by the transaction are not applied.

If the the transaction failed, is the error information or something saved in the chain?

Post-byzantium, transaction receipts contain a success status. You can see an example of failed transactions here: revert, out of gas.

If your transaction runs out of gas, the full gasLimit*gasPrice fee is forfeit.

Before byzantium, an error during execution also forfeited the full amount. Post byzantium, you only forfeit the fee required by the gas that was used during execution, so a failure early in the transaction is cheaper than one near the end.

If the transaction is signed with incorrect private key, it should be found in the first place when node processes the transaction. Will total or part of transaction fee(gasLimit * gasPrice) costed in this scenario?

A transaction that is not signed correctly will not be included in any blocks, or even broadcasted, as it is an invalid transaction. Since it is not mined, it costs nothing.

  • Thanks for your answer. One more question, what is the meaning of Post-byzantium? – Frankie Aug 4 '18 at 4:46
  • Byzantium was the most recent hardfork, starting at block 4,370,000 – Raghav Sood Aug 4 '18 at 4:52

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.