How to cancel a pending (not confirmed) ethereum transaction
How to cancel a pending (not confirmed) ethereum transaction
This is what a pending transaction looks like on http://etherscan.io
This method will teach you how to cancel any transaction submitted by a wallet of which you own the private key, no matter what you used, may it be Parity, Metamask, MyEtherWallet or any other tool or command line interface.
All you need to know is your wallet address, that will look something like this: 0x86fdfabd5dedd9ecaac94c1aa9705aee896adee2
And you need to have at hand the private key of your wallet, most tools like Metamask and Parity allow you to export it, if you are in trouble just Google "how to find the private key of my ethereum wallet", maybe adding the tool you used to send the transaction .
We'll gather all the information needed from that single piece of information and we'll follow a simple procedure to cancel the transaction, for a small fee.
Technically, what you are going to do is "overwrite" the pending transaction with a new one. This new transaction will be processed and thus cancel the old pending one. The cost you are going to pay is the gas used to process that transaction, at the current evaluation a few cents of a dollar.
The process
Let's say you have sent a transaction with a very low gas price (you might not be aware of that, some graphic tool hides the price you are paying for gas), but the network is clogged and the transaction it's stuck in pending state (like the picture above).
You have two options, one which most tools will grant you, and one that we'll cover here, although, if you are bright, you will figure out they are the exactly same thing:
- submit the transaction with a higher gas price
- cancel the transaction
Let's cancel it
1) First, let's find your transaction.
If you have your wallet address all you need to do is go to http://etherscan.io and enter your wallet address in the search box on the top right of the screen.
If you already know the transaction hash, which is what we are looking for, you might as well type that and go to the next section.
Hitting GO will display your wallet. The page, by default will show you the list of transaction for that wallet, something like this:
If you have Pending Transactions in Metamask – All you need to know is its Nonce – that number that is displayed near “…” three dots and Pending word.
Pay attention, the transaction you are searching for should be pending (unless already processed) and keep an eye on the value in ether, it should match the transaction you sent.
2) Gather information
Click on the pending transaction (left column, where it says TxHash), it should open a dedicated view for that transaction, similar to the one on top of the article.
It should still be pending.
We need just one number: the Nonce, an integer, look for the label "Nonce & {Position}, you should write it down somewhere.
In the example used the Nonce was 0 (zero), but yours might differ.
3) Cancel the transaction
In order to cancel the transaction we'll overwrite it with another transaction: we'll send 0 (zero) Ether from your wallet to your wallet.
Yes, that's right, not a typo, it's a perfectly legitimate transaction.
Click on Send Offline
Type your wallet address in the "From Address" field
Type your wallet address in the "To Address" field
Type 0 (zero) in the "Value / Amount to Send" field
Leave the "Gas Limit" field as suggested from the interface
Leave the "Gas Price field as suggested from the interface or make it a bigger number. (Careful though, this will determine how much you will pay for the transaction. Leaving as suggest is usually enough for a fast transaction)
You can use a calculator to figure out how much it is going to cost you, for example https://etherconverter.online/Type the Nonce number you wrote down from your pending transaction in the "Nonce" field. (This is the crucial part, this number will make it so the network thinks this transaction is the same as your pending one).
Leave the "Data" field as it is
Scroll down and choose "Private Key" as method to access your wallet
MyEtherWallet will warn you that this is not a wise choice, and it is not, but unfortunately the other options are not working right now for this kind of transaction. If, in the future, they will, I suggest you pick a safer method.
Paste your private key and unlock your wallet
You should get a "Wallet successfully decrypted" message at the bottom of the page.Now, click on "Generate Transaction", it will fill the two empty boxes with data
Scroll down and click on "Send Transaction"
And that's it, you are done!
If you now go back to https://etherscan.io and search again for your address, you should see the old pending transaction replaced by this new one. You might need to give it a few seconds, up to a minute in order to see the change, don't worry if you have to wait a bit.
Hope you find this useful, I welcome comments