4

In Bitcoin Core, is it possible to cancel a transaction whose status is:

"Status: 0/offline, has not been successfully broadcast yet"

The client hasn't caught up with the network. It looks like it's going to do that first, and then send the transaction.

Is that right, or is the transaction already irrevocable?

If I can cancel the transaction, what's the best way to do that?

I tried abandontransaction but it gives the error:

Transaction not eligible for abandonment (code -5)
  • First of all, quit Bitcoin Core. Disconnect the machine from the Internet to be even safer. The -zapwallettxes option might do what you want, but I am not certain. – Nate Eldredge Dec 12 '16 at 21:31
  • Could you check if the transaction is confirmed, or if the transaction is in the memory pool (getrawmempool) ? – Nick ODell Dec 13 '16 at 1:40
  • @NickODell, confirmed as in confirmations? It has none. I'll check getrawmempool now. – Buster Dec 13 '16 at 1:45
  • @Buster confirmed as in confirmations. – Nick ODell Dec 13 '16 at 1:46
  • @NickODell, getrawmempool shows one transaction, which is the one I'd like to cancel. So -zapwallettxes? – Buster Dec 13 '16 at 1:51
2

As mentioned in comments: quit bitcoin core and restart it with zapwallettxes flag:

bitcoin-qt.exe -zapwallettxes=1
-or-
bitcoin-qt.exe -zapwallettxes=2

As per bitcoin wiki:

-zapwallettxes= Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup (1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)

It will take some time to rescan all blocks.

Update: It did not worked in my case. Transaction stayed in mempool. So I have had to restore older wallet.dat and run full rescan again.

Update2: Starting from bitcoin core 0.14.0, the mempool will be saved to disk. So none of above solutions helped in my case. Closing wallet and deleting mempool.dat finally did the job.

| improve this answer | |
1

I did a trick back in the day when I send btc I did not mean to. If you have a backup of your wallet then load this up on a new machine and u can send the coins from that address to another, thus double spending and voiding your initial first transaction. So long as first transaction has not been broardcast then this should be possible.

| improve this answer | |
  • Not relevant in this case, but thanks! – Buster Dec 15 '16 at 15:05
1

As mentioned: double spend it if you still can. And when you do that dont forget to put a high enough fee (10 times the auto-calculated one for instance just to be sure, will only be a few cents anyway) so that it jumps the mempool and gets confirmed in the next block.

| improve this answer | |
  • 2
    The input had not been spent, so there's no need to double spend. Restarting the client with "-zapwallettxes" is all I needed to do. Thanks! – Buster Dec 15 '16 at 15:05
0

The best way is to abandon the transaction as zapping the wallet takes a LONG time for the rescan. In order to fool bitcoin into thinking the transaction has not been broadcast, you need to shut down bitcoin-qt, rename mempool.dat to mempool.dat.old, add "walletbroadcast=0" to bitcoin.conf, and re-run bitcoin-qt. Then you can abandon the tx, then you can shutdown bitcoin-qt, rename mempool.dat.old back to mempool.dat and remove the walletbroadcast line from bitcoin.conf.

Given the tx was broadcast (as the error "Transaction not eligible for abandonment (code -5)" means this), there is still some risk that it will make its way into a block, given the valid tx could have been stored somewhere. The only way to ensure it doesn't make it into a block, is to create another transaction using the same input and get this into a block.

Also, see this for an explanation from one of the bitcoin core developers on issues you might encounter with abandoning the transaction: https://github.com/bitcoin/bitcoin/issues/11060#issuecomment-323124996

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.