spending some of the coins nullifies address' balance. where does the remainder goes?

2

I use litecoin-qt, but my guess it'll be the same for Bitcoin or any other crypto coin.

I created a new wallet, added an address and received the coins I expected. Then I created another wallet on different PC added another (non default) address, and sent some of the coins from first address mentioned to the second. I used 'sendfrom' command.

Now both wallets show exactly what I would expect, however on any online block explorer I see something strange. When I enter the first address, I see the transaction with the initial amount, but then another row that withdraw that amount. Clicking on the transaction I see that the second address is credited with the amount I sent, and the rest goes to an unfamiliar address.

What does it mean or what am I missing? Where's this 3rd address coming from? I thought I know how things are working with cryptocoins, but now I'm completely lost.

ElyaSh

Posted 2013-08-29T11:17:37.773

Reputation: 133

Question was closed 2013-09-17T18:06:45.837

Can you give this question a more descriptive title, please?Nate Eldredge 2013-08-29T15:19:53.840

Answers

3

As you may know, transactions have inputs and outputs. The outputs give the addresses to which coins are being sent, and the inputs link back to outputs of the prior transactions that gave the coins to this transaction's sender, thus forming a chain. Anyone on the network can step along this chain to verify that all the coins in circulation legitimately got to their present owners.

To make it easier to verify the chain, the Bitcoin protocol has a rule that each input must spend all the coins that were in the output that it links to. (I am presuming that Litecoin is the same.) So if the smallest (or only) transaction to your address had an output of 150 LTC, then you have to spend 150 LTC. But since you only really want to spend 45 LTC, your wallet gives the transaction a second output that sends the remaining 105 LTC back to you, as "change".

Rather than sending the change back to the same address that is spending the coins, some wallets choose to generate a new address and send the change there. I am not exactly sure why; perhaps it's to help obscure what addresses belong to whom, for privacy. But in any case, you should find that your wallet holds the private key to this new address. The 105 coins are still yours, they're just at a different address.

Nate Eldredge

Posted 2013-08-29T11:17:37.773

Reputation: 21 420

Thanks. Indeed, running validateaddress confirms that the 'unfamiliar' addresses belongs to me, meaning I hold theirs private key. I didn't know a private key can generate/verify more than one address.ElyaSh 2013-08-29T15:36:52.557

1@elyash: It doesn't. Each address has its own private key, and your wallet holds all of them.Nate Eldredge 2013-08-29T15:45:39.110

10x. Point to myself - storing the private key of the initial address is useless, once you spend some of the coins. Only wallet.dat backup will be sufficeElyaSh 2013-09-01T06:42:24.997

@elyash: True. Some wallets pre-generate a bunch of keys/addresses so they can be backed up with wallet.dat even before they are used.Nate Eldredge 2013-09-01T12:06:59.897