Given that a transaction has

  1. A high enough gas limit for the transaction to succeed
  2. A high enough gas price for it to be mined
  3. No contract calls that throws

Is there any way that transaction can fail?


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.

  • And the receipt of such transactions(tx runs out of gas) would return "Success" or "0x1"? – Ayushya Oct 5 '18 at 11:19

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:

  1. Not enough ether on origination account to perform transfer and pay for gas
  2. Nonce is too high or too low
  3. Signature is incorrect
  4. Transaction gas consumption exceeds block gas limit

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

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.