[Ethereum] Is it possible to cancel a transaction


Is it possible to cancel a transaction after it has been broadcasted, but before it has been mined?

This could be useful on sending an erroneous transaction containing invalid data.

Best Answer

It can't be canceled, but it can be "out-gassed". You can grab the nonce (can be found on the pending tx on etherscan) and send another transaction with a higher gas price with the same nonce. If you use a different nonce, then they can both be mined, but if you use the same nonce, only one can be mined. If miners see both, they should be smart enough to choose to mine the tx with the higher gas price.

Related Topic