1

Say a transaction is time-sensitive and the user that submitted it knows the transaction expires at block number X. User submits the transaction at block number X-4, sees the transaction does not get confirmed in any of the remaining blocks, and then knows the transaction will be a waste of gas if a future block picks it up.

Can the user say "Hey, nevermind, don't submit this!" or is that impossible?

1

It's not possible. Once a transaction is broadcasted to the network you can't call it back.

What you can do is send another transaction with a higher gas price that being included in a block before the original transaction will make the original transaction invalid thus it will never be executed and included in a block.

  1. Let's say you sent a transaction A that from your estimations would require 500k gas.
  2. After some time this transaction is not included in a block but you know that it will fail and only waste 500k gas.
  3. You send a transaction B that simply transfers all your ether from your account to another account. This would cost you only 21k gas (the intrinsic transaction cost). Since now the original transaction is invalid because there is no balance on the sender's account it will be discarded by all nodes. It cost you 21k gas which depending on the gas price may be cheaper than the gas cost of the original transaction.

In fact if you can send any other transaction from the same account and it will be included in a block before the original transaction (one way is to set the gas price higher than in the original transaction) it will make the original transaction invalid as the transaction nonce validation will fail (every transaction must contain nonce which must be equal to the account nonce which in turn is incremented with every new transaction). Transaction validation rules are specified in the yellow paper section 6.

  • Ok good to know. I think the solution here is to check the transaction expiration in the very first few operations so that expired transaction overhead is minimal – OneChillDude Oct 29 '17 at 18:09
-6

Ask you grandmpa he might know because they had better technology back in the days, when people actually went outside.

  • Ask your grandmpa he might know because they had better technology back in the days, when people actually went outside – Alex gucci Oct 28 '17 at 20:00

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.