Altcoins Talks - Cryptocurrency Forum

Cryptocurrency Ecosystem => Ethereum Forum => Basics => Topic started by: CryptoGirl on June 14, 2018, 07:15:44 PM

Title: How to cancel a transaction on the Ethereum Blockchain
Post by: CryptoGirl on June 14, 2018, 07:15:44 PM
Here is a guide on how to try to get rid of those pending transactions:

    How to cancel or replace a pending transaction

 - You cannot cancel transactions that have already been confirmed on etherscan. This is only possible for transactions sent with a low gas price (e.g 1-5 gwei) that can get stuck when the ethereum network has thousands of pending transactions.
       
 - If we succeed in replacing the pending transaction, you do not end up paying the gas for the now invalid old transaction.

    Nonce

    Every ethereum transaction has a number called the nonce (found at the bottom of the transaction details on etherscan). This number is the amount of transactions made by your address, and each transaction should have a nonce higher than the previous.



    Stopping a transaction

    If you manage to send out a transaction with the same nonce but with a higher gas price, there is a chance that the new transaction will replace the old one.

    You get 2 choices

        Retry: try to send the same thing again with a higher gas price.

        Cancel: send a random transaction to replace the pending one.

    Retry

    Now raise the gas price.

    Raising the gas by little won't make sense, as that transaction will probably end up pending as well.
    Normally 20-30 gwei should be fine to confirm the transaction in a few minutes, in extreme cases you might have to go up to 60.

        Remember that a higher gas price does make the transaction costs a little more expensive.

    Cancelling transaction

    You want to get rid of the pending transaction, but do not care about the contents of that transaction anymore. This is basically the same trick as the retry, we raise the gas price, but here we just want to send out any transaction quickly.
    The easiest and cheapest transaction to make is to send a transaction of 0 ETH to a wallet.


    Within like 30 seconds you should see a new transaction hash on etherscan instead of the old one.