The question is published on by Tutorial Guruji team.
Suppose we reach a state where only transactions that pay a fee are accepted by miners. Further supposed that someone created a transaction using an old/odd client that allowed them not to send any fees.
In this case, what would happen to the transaction? Could it be undone? Would the coins be lost forever?
Answer
I have successfully used the methodology described here to delete a transaction which didn’t go anywhere because of a too low fee. In short, the process is as follows:
- Configure Linux machine with db4.8-util and bitcointools. Ubuntu works fine.
Run following command on your data folder:
./dbdump.py --datadir ~/.bitcoin --wallet-tx > tx.txt
Open tx.txt using text editor. Find transaction in question. Should look like:
==WalletTransaction== 12a75d48a002ab920 ... block: 00000000000000000000000000000000 ... 2 tx in, 1 out TxIn: value: 0.007640 prev(c09e92cb94ff1fb6d4 ... TxIn: value: 0.000050 prev(7dcda75e6ad8b5adc7 ... TxOut: value: 0.007690 pubkey: Script: DUP HA...
Reverse the
12a75d48a002ab920...
value, get something like92ab02a0485da712
. Don’t need to reverse the whole line, just a few hex values from beginning. You will need to search for this in the database dump.Dump the database using following command:
db4.8_dump ~/.bitcoin/wallet.dat > dumpfile
Using text editor open the dumpfile and search for that
92ab02a0485da712
line you found earlier. There will be two lines – key and value, you need to delete both. Save the file.Re-import the database using the following command:
db4.8_load ~/.bitcoin/wallet2.dat < dumpfile
If all went fine, the wallet2.dat will have a database without transaction in question.
All of this, of course, only works if transaction was never accepted by the network, which is likely the case if you already waited a day, and nothing happens. There is no way to undo transaction which was already accepted by the network. I tried this technology twice and both times worked fine.