But what happened to the coins that were in the private keys that were not 'funded'? Because the transactions record that coins went to that private address.
Or were they just amalgamated at some point in the course of transactions? I just want to make sure I didn't lose coins somewhere.
The short answer is that you spent them
When you send coins out, Electrum (unless instructed otherwise using coin control or privacy features etc) will generally select the most 'efficient' set of UTXOs that makes up the amount to be sent, while minimising the size of the transaction...
That is to say... assume you have:
1AddressA = 0.00012448
1AddressB = 0.00145671
1AddressC = 0.00248822
1AddressD = 0.00292394
In the background you'd actually have something like 25+ addresses automatically generated, so:
listaddresses - Would show 25+ keys
listaddresses("funded") - would only show the 4 addresses with coins, A,B,C & D
Now let's say you want to send 0.004 BTC to Bob... You don't have any UTXOs of 0.004 (or more), so the wallet has to combine several.
It could use any of the following combinations:
A+B+C 0.00406941
B+D 0.00438065
C+D 0.00541216
A+B+D 0.00450513
A+C+D 0.00553664
A+B+C+D 0.00699335
Let's say that Electrum decides to use B+D... it'll "spend" the UTXOs on those addresses (remember, in bitcoin you have to spend the whole amount, you don't spend partials), and then send 0.004 to BTC to Bob and return any leftovers (- transaction fee) to a change address... so you'll end up with:
1AddressA = 0.00012448
1AddressB = 0.00000000
1AddressC = 0.00248822
1AddressD = 0.00000000
1Change1 = 0.00037800 (0.00038065 - an imaginary 265 sat transaction fee)
Now if you do:
listaddresses() - you'd see exactly the same number of addresses as before
listaddresses("funded") - you would only see THREE addresses... A, C & Change1... because
they're the only ones that currently contain coins.Scenario 2. If Electrum had used A+B+C+D... your wallet would now look like this:
1AddressA = 0.00000000
1AddressB = 0.00000000
1AddressC = 0.00000000
1AddressD = 0.00000000
1Change1 = 0.00299000 (0.00299335 - an imaginary 335 sat transaction fee)
And if you did:
listaddresses() - You'd
still see exactly the same number of addresses as before... ie. ALL of your addresses
listaddresses("funded") - You'd now only see ONE address... Change1... as...
that is the only address with coins in it.
All that being said, it might be easier to visualise with the GUI. If you haven't already, enable the filter on the "addresses" tab.:
Then you can set to:
- "All" + "All" - shows EVERY address (ie. zero balance, non-zero balance and zero transactions etc.)
- "All" + "Unused" - Shows only addresses that have a zero balance
and a zero number of transactions.
- "All" + "Funded" - Shows only addresses that have a non-zero
balance- "All" + "Used" - Shows addresses that have a zero balance, but also have a
non-zero number of transactions (ie. they did have coins in them at some point, but they are now empty)
NOTE: you will
always have "unused" addresses because Electrum, by default, has a gap limit of 20. So you will always have at least 20 "zero balance and zero transaction" addresses. Therefore, it should not come as a surprise, that "funded" will return less than "All"... even if you have only ever received coins and never spent any.