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.

    Note that you have on average less than 30 seconds before the transaction is mined, so better catch the error pretty quick

    How could I change the nonce on new transaction ?

    If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review

    I am quiet desperate as I made a transation from ledger live with myledger nano S, I wanted to send 4.05 ehters and then have set up 250 000 gwei, as it was asked to me, and then I saw in ledger live -9.3 ehter, fee 5.25 ether so why I AM PAYING SO MUCH FEE??? IT TOOK ABOUT 10 min for the transaction, what is possible to do, can I CANCEL THE transaction...why is ledger live not more simple to use? I feel really scammed!!!

  • natewelch_

    natewelch_ Correct answer

    4 years ago

    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.

    How do you do this? could you provide code examples?

    How do you find an existing transaction and update the nonce?

    @JZ. i am going to use this guide to _overwrite_ a pending transaction using *geth* downloaded from here

    Okay but then how do I cancel the transaction with the lower gas price? It seems it remained stuck in the mempool.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM