Author

Topic: Weird transactions after changing wallet.dat (Read 645 times)

member
Activity: 85
Merit: 10
Nice explanation indeed  Cool
newbie
Activity: 26
Merit: 0
Ah, thanks for such a detailed explanation! Yes, I got antsy and transferred the 0.54 to another key on my new wallet.dat before my old wallet.dat could decide the 0.54 wasn't going to exist. But it seems I have nothing to worry about, phew.
legendary
Activity: 3472
Merit: 4801
This is the "change" from the transaction:

With the way bitcoin works, you can't partially spend a previous output that you received.  It has to be completely spent.  So, if you receive 10 BTC all in a single transaction from someone/somewhere at an address, then that address now has a single 10 BTC output.

Later if you want to send 2 BTC to somebody, the program can use the previous 10 BTC output as an input into the transaction, and create a 2 BTC output to the address where you want to send it.  This leaves 8 BTC leftover in the transaction.  If you don't send those 8 BTC somewhere, then they become miner fees and end up in the coinbase transaction of the new block for the miner to keep.  If you don't want to give those 8 BTC away as fees to the miner, then you need to include a second output in your transaction sending the 8 BTC back to your own wallet.  As an analogy, think of pulling a $10 bill out of your pocket to pay for something that costs $2, you get $8 back in "change".

The way Bitcoin-Qt does this is to create a new bitcoin address that it doesn't tell you about and keeps track of that address and the associated private key in your wallet.dat.  Since this isn't an address that you requested in the "Receive Coins" tab of the user interface, it doesn't show up in that list.  Bitcoin-Qt knows about the address since it is in the wallet.dat file, so it includes it in the balance that it shows you.  Bitcoin-Qt uses a new change address for every transaction.  So if you create 10 different transactions, each sending bitcoins somewhere, then your wallet will have used 10 different change addresses (although some of them may be empty if Bitcoin-Qt used the bitcoins associated with some of those address as inputs into other transactions).

It really is dangerous to play around with advanced functions (such as dumpprivkey and importprivkey) if you don't understand how the wallet works.  You are likely to lose bitcoins permanently that way.  Fortunately, you still have the old wallet.dat that has the rest of the bitcoins.

If you want to see all the unspent outputs that your old wallet.dat is keeping track of, you can run the following instead of dumpprivkey:

Quote
listunspent

This will give you a list of unspent transaction outputs.  You can then look up each of those transactions to find the address that the output is associated with.  If you dumpprivkey on every address that has an unspent output, and then importprivkey all of those private keys into the new wallet, you should see the full expected balance.

1AqcqV61PijxU9iNSGZJJyJXjYWTznEtfH received the following outputs on these dates:

2012-09-18: 0.00200000 BTC (spent on 2013-04-30)
2012-09-18: 0.00000718 BTC
2012-09-19: 0.00010000 BTC
2012-11-23: 1.00135320 BTC (spent on 2013-04-28)

This means that the address still has 0.00000718 + 0.0001 = 0.00010718 BTC associated with it.

When the 1.0013532 BTC was spent, the 0.8513532 BTC change went to 1A2y9KbKe2iARVx6enEBwXuimmkEB9gNp3.
When the 0.002 BTC was spent (along with a 0.5472532 BTC output from another address), it went to 1NHch4Z4XwsyAVjcnjB6sLimeCYAAE5yRS transferring a total of 0.54886038 BTC (with 0.00039282 BTC paying the transaction fee). There was no change here, the total amount being spent (minus the transaction fee) from the two inputs was sent to the new address.

All of the 0.54886038 BTC sent to 1NHch4Z4XwsyAVjcnjB6sLimeCYAAE5yRS is still associated with that address and unspent.

Of the 0.8513532 BTC change sent to 1A2y9KbKe2iARVx6enEBwXuimmkEB9gNp3 you created an additional transaction sending 0.3036 BTC of it to BTC-e at 1N3GDmJvLV9rn8J75qJ2hfBnS5sygGGTgj and a 0.0005 BTC transaction fee with the remaining 0.5472532 BTC going back into your wallet at the new change address of 1PBKHXJFNGL37XZAFxD9MAqyJ8G6TDdsnf.

Then the 0.5472532 BTC was spent along with the 0.002 BTC mentioned earlier in the transaction that sent 0.54886038 BTC to 1NHch4Z4XwsyAVjcnjB6sLimeCYAAE5yRS

It seems that this 1NHch4Z4XwsyAVjcnjB6sLimeCYAAE5yRS address has the 0.54 BTC you are looking for.  You didn't send this?
newbie
Activity: 26
Merit: 0
Hello, I had 1BTC on a wallet.dat, and I wanted to import it into another wallet.dat. So I did dumpprivkey, copied it, and importprivkey on the new wallet.dat. I had given 0.15BTC to a friend, and spent a bit, so I expected to see 0.54BTC left or so.

But after running Bitcoin again with -rescan, it shows that somehow 0.85BTC was transferred to some address I didn't know about? This clearly can't have happened, because I used part of that, which is why I had 0.54BTC left not 0.85BTC. And when I put my old wallet.dat back and -rescan, I get my old balance 0.54BTC. What the hell just happened here?

The address with the 1BTC:
http://blockchain.info/fb/1aqcqv6

I did NOT send 0.85BTC to 1A2y9KbKe2iARVx6enEBwXuimmkEB9gNp3

I sent ~0.30 something to BTC-e, and I still have it there.
Jump to: