5

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)
6
  • 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
0

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.

1
  • zapwallettxes has been removed and replaced with "abandontransaction" – Janus Troelsen 11 hours ago
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.

1
  • 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.

2
  • 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
  • A "double spend" means to create two transactions using the same unspent input. If the input has been spent, then it is NOT a double spend, it's just an invalid transaction. – Rebroad Feb 22 at 21:55
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

2
  • The steps outlined here to recoup the unspent/unconfirmed coins in the wallet work as expcected. Unclear on the following, just want a second opinion from anyone who knows. " 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." This means A) the transaction can still be processed from the mempool as it was broadcasted to the network, correct? B) "using the same input" - I'm assuming that this means making a duplicate transaction matching the send to address and amount, just with a higher fee so it can be proce – Greg Feb 21 at 18:00
  • A) "the mempool" - there is no single mempool - they (transactions) are stored on computers, and can be stored indefinitely. B) No, the send to address and amount can be different, it's just the input that needs to be made invalid (by making it spent). – Rebroad Feb 22 at 21:45

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.