Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: jackjack on July 24, 2011, 09:27:16 PM



Title: [GUIDE] Cancel your 0/unconfirmed transactions
Post by: jackjack on July 24, 2011, 09:27:16 PM
This is far less efficient than using the new pywallet, see here: https://bitcointalk.org/index.php?topic=35214.0

Hi all
While playing with the bitcoin client, I made some 0/unconfirmed transactions (no confirmation for 2 days)
I didn't find anything simple to recover the bitcoins lost

When I finally found a method to cancel those transactions I made a python script to make that simple

So, are those unconfirmed transactions still a problem?
If so I'll write here how to cancel them


Here it is:
0. I'm assuming that your wallets are in Bitcoin default directory, if not, use -w and -n options at step 6
1. Backup your broken wallet.dat
2. Rename it wallet.old
3. Find the wallet into which you want to add the old adresses (you can run bitcoin to create a brand new one) and rename it  wallet.new
4. Download my pywallet fork: https://github.com/jackjack-jj/pywallet and write down the directory you put it
5. Download my walletco: https://github.com/jackjack-jj/walletco
6. Assuming both wallet.new and wallet.old are in bitcoin default directory(if not, look at walletco options), run this: /path/to/walletco.py -p /pywallet/directory/ -W wallet.old -N wallet.new
7. Rename wallet.new to wallet.dat (or use my bitcoin fork to chose the walletfile)

In the next release, walletco will auto backup both wallets

Feel free to make pull requests and tell me if it fixed your wallet


Title: Re: Are 0/unconfirmed transactions still a problem?
Post by: kookiekrak on July 24, 2011, 09:59:28 PM
was a problem for me. i had to use berkeleydb tools to remove those transactions


Title: Re: Are 0/unconfirmed transactions still a problem?
Post by: sequence on July 24, 2011, 11:34:34 PM
Yes I have one unconfirmed but I believe its because my block chain won't download even with two connections


Title: Re: Are 0/unconfirmed transactions still a problem?
Post by: jackjack on July 25, 2011, 12:32:14 AM
Check how many blocks your client downloaded
If it's 137873, your transaction should have some confirmations


Title: Re: Are 0/unconfirmed transactions still a problem?
Post by: BrianH on July 25, 2011, 04:26:26 AM
Yes. How do you cancel them?


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: jackjack on July 25, 2011, 10:19:54 AM
First post edited


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: BrianH on July 25, 2011, 09:32:22 PM
Thanks for your help on this. The transaction was removed from the wallet, but the funds did not change. Maybe there is something else wrong with my wallet?

I am on Win7 so I...
1. Backed up my broken wallet.dat
2. Renamed it wallet.old and left in Bitcoin directory
3. Created a new wallet.new in Bitcoin directory
4. Downloaded Python x64 (http://www.python.org/getit/)
5. Installed to C:\Python
6. Downloaded and extracted your pywallet fork to C:\Python
7. Downloaded and extracted walletco to C:\Python. (Check the link in OP.)
8. Opened a command window and ran this line "python walletco.py -p /python/ -W wallet.old -N wallet.new"

Shows "Importing: 100.00%"



Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: jimbo77 on July 25, 2011, 09:45:42 PM
If the transaction was broadcast it could go through at any time until you make a new transaction that spends it first?


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: BrianH on July 25, 2011, 09:55:38 PM
It must be something along those lines, because it looks like my debits/credits match.


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: jackjack on July 25, 2011, 10:00:45 PM
Thanks for your help on this. The transaction was removed from the wallet, but the funds did not change. Maybe there is something else wrong with my wallet?

I am on Win7 so I...
1. Backed up my broken wallet.dat
2. Renamed it wallet.old and left in Bitcoin directory
3. Created a new wallet.new in Bitcoin directory
4. Downloaded Python x64 (http://www.python.org/getit/)
5. Installed to C:\Python
6. Downloaded and extracted your pywallet fork to C:\Python
7. Downloaded and extracted walletco to C:\Python. (Check the link in OP.)
8. Opened a command window and ran this line "python walletco.py -p /python/ -W wallet.old -N wallet.new"

Shows "Importing: 100.00%"
First, DO NOT write here the privkeys (starting in 5), be sure to remove them all if you paste here the code in the console

Before "Importing:100%", what was written?
If it was like that, your new wallet has all the old keys:

Code:
Address: 1AdDressxxxxx
Privkey: 5xxxxxxx
Imported successfully

If not, please paste a little sample (again, remove the privkeys)


If debits/credits match, you should perform a -rescan


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: jackjack on July 25, 2011, 10:08:05 PM
If the transaction was broadcast it could go through at any time until you make a new transaction that spends it first?
Your sentence is too complicated for my poor english ;D
But if understand correctly, what you want to do is :
- make a transaction
- make your wallet forget it
- make a new transaction that spend the same funds than the first one
- hope the last one gets written in the blockchain before the first one

If you remove also your blockchain history, I believe it could work if the second transaction reachs a miner before the first

Are you thinking about the merchants who accept funds before being confirmed? ;)


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: jimbo77 on July 25, 2011, 10:14:56 PM
If the transaction was broadcast it could go through at any time until you make a new transaction that spends it first?
Your sentence is too complicated for my poor english ;D
But if understand correctly, what you want to do is :
- make a transaction
- make your wallet forget it
- make a new transaction that spend the same funds than the first one
- hope the last one gets written in the blockchain before the first one

If you remove also your blockchain history, I believe it could work if the second transaction reachs a miner before the first

Are you thinking about the merchants who accept funds before being confirmed? ;)
Yup thanks.


Title: Re: [GUIDE]How to cancel 0/unconfirmed transactions?
Post by: jackjack on July 26, 2011, 03:17:20 PM
It must be something along those lines, because it looks like my debits/credits match.
Please keep me updated, I'd like to know if it's useful


Title: Re: [GUIDE] Cancel your 0/unconfirmed transactions
Post by: krepta3000 on July 28, 2011, 10:09:01 PM
Hi all
While playing with the bitcoin client, I made some 0/unconfirmed transactions (no confirmation for 2 days)
I didn't find anything simple to recover the bitcoins lost

When I finally found a method to cancel those transactions I made a python script to make that simple

So, are those unconfirmed transactions still a problem?
If so I'll write here how to cancel them


Here it is:
0. I'm assuming that your wallets are in Bitcoin default directory, if not, use -w and -n options at step 6
1. Backup your broken wallet.dat
2. Rename it wallet.old
3. Find the wallet into which you want to add the old adresses (you can run bitcoin to create a brand new one) and rename it  wallet.new
4. Download my pywallet fork: https://github.com/jackjack-jj/pywallet and write down the directory you put it
5. Download my walletco: https://github.com/jackjack-jj/walletco
6. Assuming both wallet.new and wallet.old are in bitcoin default directory(if not, look at walletco options), run this: /path/to/walletco.py -p /pywallet/directory/ -W wallet.old -N wallet.new
7. Rename wallet.new to wallet.dat (or use my bitcoin fork to chose the walletfile)

In the next release, walletco will auto backup both wallets

Feel free to make pull requests and tell me if it fixed your wallet

I love you, in a platonic way, for doing this!  Awesome! :)