How to reverse/delete a bitcoin transaction (unconfirmed) with Electrum Wallet

in bitcoin •  5 years ago  (edited)

There wasn't a good tutorial out there on how to reverse a bitcoin transaction that is unconfirmed on the network. There are some but not complete from A-Z, and others that just say "use RBF (replace by fee)", "use CPFP (child pays for parent)" or double spend with a higher transaction fee without explaining how to do it.

These instructions are for using Electrum Wallet (http://electrum.org) and the website BlockCypher for transmitting the double spend transaction (Option 3).

Option 1 - Replace by Fee
If you only want to make your transaction go faster / RBF. This allows you to increase the speed of your transaction. It will still go to the target wallet and not be cancelled.

Step 1. Right click on the Unconfirmed transaction in Electrum, select Increase Fee.

Step 2. Enter a fee based on the site: https://bitcoinfees.earn.com/ (see Option 3 > Step 9 below for more details)

If you originally set your fee to 1 satoshi or whatever was recommended by Electrum, try a higher fee.

Option 2 - Child pays for parent
This option will also make your transaction go faster by adding another transaction and sending it back to yourself, but then using that fee to pay for the parent transaction.

Step 1. Right click on the Unconfirmed transaction in Electrum, select Child Pays for Parent.

Step 2. Enter a fee based on the site: https://bitcoinfees.earn.com/ (see Option 3 > Step 9 below for more details)

Step 3. Wait for the transaction to confirm

Option 3 - Double Spending

Let's say now that you accidentally sent the bitcoin to the wrong address, or you sent it to a shady person and you find out it's a scam. As long as the transaction is still the "mempool" (queue of transactions) you can double spend your coins with a higher fee and send it back to yourself. Please don't use these instructions to scam others. That's why it's important to ALWAYS wait for confirmations when waiting for a payment.

For reference, here's the list of current BTC unconfirmed transactions: https://www.blockchain.com/btc/unconfirmed-transactions

Step 1. Download Electrum wallet if you don't already have it: https://electrum.org/#download

Step 2. Make sure your transaction is unconfirmed, search transaction ID or your sending address at: https://www.blockchain.com/ or https://blockstream.info/

We have an unconfirmed transaction here, and we need to get rid of it, so here is what you will do:

It will also show Unconfirmed in your wallet. If you are not using Electrum or you didn't use Electrum wallet to send the transaction, you can import your private key via File > New > Next > Import Bitcoin addresses or private keys and paste your private key from another wallet.


Note: If Electrum says watching only in the top bar, you cannot spend coins and need to import a private key

Step 3. Copy the transaction ID by right clicking on the Unconfirmed transaction and select Details. Highlight and copy the "transaction ID" field with CTRL-C, for example this one is: a8a0444fbd23ad0ebc6f34ea770b9518066f81a34cc052d25f402e5b4df8b270

Step 4. Disconnect your wireless or network cable, because we will remove this transaction from the wallet, it's unconfirmed so don't worry. Don't reconnect the Internet, because it will re-download it, and you have to start all over again.

Step 5. Close Electrum and locate your wallet file, typically located in C:\Users\YOURNAME\AppData\Roaming\Electrum\wallets. The first/default wallet is called default_1, but yours may be named something else. IMPORTANT: Create a backup of the wallet, so if you mess up you can restore it!

Step 6. Open the wallet file with notepad/text editor. The format of the wallet is JSON, so it should be easy to edit if you are familiar with it. This is the step that is the most easy to mess up, so make sure you made a backup :)

Press CTRL-F on the keyboard, and search for this hash in the file. It should appear several times, in different places, you need to delete them, but carefully to keep the JSON syntax intact, so I have highlighted what you need to delete, it should be different for you, but you will get the idea, it should be everything that is highlighted. Make sure to also delete the commas above or below the transaction.


Step 7. Now open the wallet (you should still be offline), and check if it loads. If it loads then you did it correctly. If it doesn't load then you restore the backup and do it again because you probably deleted something that you should have not.

The unconfirmed transaction should no longer be there, so that now we can spend it again!

Step 8. Go to Electrum's Tools > Preferences, and enable the checkbox "Enable fees manual" and "Use replace-by-fee"

Step 9. Copy your Receiving address from the Receive tab, and paste it into the Send tab. This will be the transaction that replaces the unconfirmed transaction. Enter the amount you wish to send (probably Max) and enter a fee based on the site: https://bitcoinfees.earn.com/

Look for the text below for recommended fee.. or if you want the highest fee you can look at the bottom of the graph. For example, if you pay anything over 100 satoshi/byte on this graph it will typically be processed first.

Step 10. Click Preview to open the transaction details.

Step 11. Click Sign to sign the transaction and Copy to copy it to your clipboard. You can also click Export to save it to a file.

Step 12. Enable your wireless or Internet and load the site: https://live.blockcypher.com/btc/pushtx/
Alternatives: https://coinb.in/#broadcast, https://txid.io/wallet/#broadcast

Step 13. Copy and paste your transaction in to the site, and click Broadcast Transaction


Note: Your transaction may show a lower confidence due to detected double spend!

That's it, you are done now, your previous unconfirmed transaction will be cancelled, and it will be overwritten by this new one we created, and with a proper fee, it should get confirmed in no-time! Your balance will be back in your wallet.

Note: There is also now a service that can do this for a fee, using your private key at https://txid.io/wallet/#double

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @shadow42! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made your First Vote
You published your First Post
You got a First Vote

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Dang Mang! You should have told me you joined!!!
I will put U on auto vote and send U some DELI

🎣