How do nodes (not necessarily miners) treat transactions that result in Solidity throw (i.e. Out Of Gas error, transaction reverted)? Such transactions' only effect is gas (ether) transfer from the sender's account to the miner. So miners have incentive to mine them; but do nodes relay them by default?
-
There is no transaction revert in a sense that the caller recovers the Ether spent on gas. Upon hitting a throw, execution is halted and the funds are not sent back to the caller.– SebiCommented Aug 8, 2016 at 8:57
-
Thanks, but this is not what I'm asking. I'm just asking if Ethereum network nodes (eg. geth instances) relay such transaction objects between each other. I'm not asking about the value that is transferred between accounts.– maziCommented Aug 8, 2016 at 8:59
-
If you mean they are stored inside the block chain yes. An aborted transaction is stored in the block chain but the state of the contract it changed during execution up until the point the exception occurred is reverted to the initial state prior to the transaction (method call).– SebiCommented Aug 8, 2016 at 9:28
-
No, I'm not asking transactions being stored in the block chain.– maziCommented Aug 10, 2016 at 8:28
1 Answer
Yes, nodes relay the transactions by default. Transactions are relayed before they are executed and their gas consumption and behavior is determined. Nodes just do a basic check such as:
- is the signature valid?
- does the sending account have enough Ether to pay for the gas?
- is the gas below the block gas limit?
If the basic checks pass, the node relays the transaction. Miners then perform the relatively expensive job of executing the transaction, and then include it in a block. When a "full node" gets the block, it then executes the transactions in the block to verify the security and integrity of the blockchain that it builds.
-
As discussed on ethereum.stackexchange.com/a/1669/16 it seems that clients also check that the gas price is above some limit (to prevent 0 gas price DDoS) Commented Oct 7, 2017 at 20:32
-
@ValidityLabs-Sebastian Good point, a client allows creating a transaction with 0 gas price, but a client receiving a transaction with 0 gas price is unlikely to relay it by default.– eth ♦Commented Oct 10, 2017 at 8:53