Given that a transaction has
- A high enough gas limit for the transaction to succeed
- A high enough gas price for it to be mined
- No contract calls that throws
Is there any way that transaction can fail?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
If there's enough gas provided, with the necessary gas price, and no contract calls that throw, then it shouldn't fail.
You should also consider the case where even if a large amount of gas is provided, if the contract contains an unbounded loop, some complex computation or recursive calls, it could fail by running out of gas, even if you provide the maximum possible gas limit.
I see no possibilities how such transaction could be mined as unsuccessful, i.e. included into block but do not transfer ether. Though there are several possible reasons how such transaction could not be mined at all:
A possibility would be to 'double submit' a transaction. If one were to submit a transaction to the ethereum network, with sufficient gas limit, gas price, no contract call errors, etc (a perfect transaction) and THEN submit another 'perfect' transaction from the same account, with the SAME nonce as the previously sent transaction, one of these transactions will fail.
This is a property of the ethereum network, that all transactions from an account must occur in sequential order, increasing by one, every transaction. This is often used to 'cancel' a pending 'slow' transaction, one that is taking a long time waiting in a miner pool for inclusion into a block. Submitting a transaction, at the same nonce as the pending with a high gas price incentivizes miners to include this transaction. And consequently on transaction inclusion, will invalidate the pending 'slow' transaction