Yes there is a way to repair a conflicted transaction.
A conflicted transaction is a not-accepted transaction. It is not the same a double spend, because a conflicted transaction is not saved in the blockchain. It takes a lot of effort to make a double spend, I can't think of anyone who has achieved this.
I was rescanning my bitcoin wallets from 2013 and 2015, because they are worth more now. It turned out to be the exact same wallet, and I made payments from these two wallets to my v0.20.0 BTC client.
I didn't even wait till the wallet was rescanned, and frankly i spended bitcoins i didn't own. So the transaction was conflicted and stuck in the mempool before reaching a block. So then I had two wallets with a conflicting transaction.
What do you do in this case?
- Go to the Bitcoin Core datadirectory and rename the mempool.dat file
- Restart Bitcoin Core with the -walletbroadcast=0 option
- Go to the transactions list, right click the transaction that is stuck. It is no longer greyed out! Choose the Abandon Transaction option.
qt-bitcoin.exe
should be fully up-to-date with the blockchain.
Go to your conflicted wallet's transactions and copy the transaction ID of the transaction you should delete.
Then go in the console and export the wallet to a textfile.
dumpwallet editthis.txt
It's in the same directory as
'qt-bitcoin.exe'
.
Have a texteditor with linenumbers. Find the line with the transaction ID, say it's line 678 of a textblock starting at line 5. Now go to the empty line halfway of the textfile, say the first line of the next block is 3413. Now that textblock is just as long as the first block of text.
(l - 3413) = (678-5) => l = 4086
And that line should be deleted now. After that, delete line 678.
Don't mess this up or you'll end up a loosing money!line 678:
KzCScG4SW .. jfGgV22HE 2013-11-18T18:43:42Z reserve=1 #addr=bc1q0rzxfw5v .. 9hjf5gdmjs26
is a secret encoded key, the date and time, transaction label, and input/output address.
line 4086:
0014118ae8ba .. 7f9b1ba9eb2d93 0 script=1 # addr=37ZT8tAq9m .. xSiB7SJfJYmLM
are tuples of the same data, they only have encoded data.
So delete these lines and now go to the BTC client console
importwallet editedthis.txt
Now the full blockchain will be rescanned with your wallet, it will take four hours or so.
Go to the Bitcoin Core datadirectory and rename the mempool.dat.old to mempool.dat file
Restart the client.
And you have your BTC back!