Thursday, June 16, 2016

How to Cancel Unconfirmed Bitcoin Transactions

unconfirmed-bitcoin-transaction

With the recent spike in the price of Bitcoin the number of unconfirmed transactions has increased significantly yet again and the Bitcoin blocks are getting closer and closer to being full. This essentially slows down transactions on the network and in order to ensure that your transaction is being processed faster you need to increase the fee over the standard recommended one. While this may be just fine for larger BTC transfers with fewer inputs, if you want to make a small transaction of few Bitcoin cents or a large one with a lot of inputs the network fees can get quite high. If the fee is not large enough and the waiting list is big you can easily end up with your transaction not getting confirmed and included in a block for over a day and that usually causes a problem, especially if you are paying for something in BTC. The solution would be to just cancel any unconfirmed transaction that did not go through for over 24 hours and it is not that hard to do it actually, although the process itself may require some time.

bitcoin-qt-zapwallettxes

Cancelling stuck Bitcoin transaction sent from your local BTC wallet requires you to run the qt wallet client with a special option that would remove all pending transactions that are not included in the blockchain. You need to run bitcoin-qt.exe (or the respective qt executable file depending on the OS you are using) with the -zapwallettxes parameter, but before running it make sure you backup your wallet.dat file. This will take some time as it will initiate a blockchain rescan, so be prepared to wait until the process finishes and do not forget to remove the extra parameter the next time you run your wallet as it is not needed anymore. As a result you will be able to initiate a new transaction with the unspent coins and by increasing the network fee you pay you should be able to move them faster and have the transaction confirmed this time. You will be essentially double spending your Bitcoins, but the second transaction you initiate will cancel out the earlier one. You cannot successfully double spend Bitcoins unless you control more than half of the Bitcoin network, so no worries here. The only thing you will be able to do is free up your coins that were stuck in an unconfirmed transaction for a long time and then be able to initiate a new transaction to send them successfully this time.

Do note that although we are giving this example for Bitcoin, it should work on many other altcoins as well that are based on a more recent forked Bitcoin wallet code as the option we use here is not included in the earlier version of the Bitcoin client. There are some more complex alternatives for performing the same thing described here if your wallet does not support the zapwallettxes option, so you are not out of luck in such cases either. You can do the same thing with the Python-based tool called Pywallet as an alternative to using the qt wallet method described here.

No comments:

Post a Comment