Author

Topic: Electrum 3.0.5 list receiving addresses (Read 190 times)

HCP
legendary
Activity: 2086
Merit: 4361
August 31, 2018, 07:40:38 PM
#5
Thanks for that.
Documentation, instead of reading the code, would be useful.
You'll need to take that up with the devs...

Based on what HCP posted,
Can't you just use
Code:
listaddresses(true,false,false,false,true,false)
which will get all of the receiving addresses that aren't frozen or with labells or bitcoin in them and have not been used...
He said it didn't work... I've tested it and it "sort of" works... But perhaps not as one might imagine... So I think the definition of "unused" is slightly different to what the OP is expecting.

Also, note that you need to use True and False... Capitalisation is important. Wink
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
August 31, 2018, 09:28:11 AM
#4
def listaddresses(self, receiving=False, change=False, labels=False, frozen=False, unused=False, funded=False, balance=False):
"""List wallet addresses. Returns the list of all addresses in your wallet. Use optional arguments to filter the results."""

Based on what HCP posted,
Can't you just use
Code:
listaddresses(true,false,false,false,true,false)
which will get all of the receiving addresses that aren't frozen or with labells or bitcoin in them and have not been used...
newbie
Activity: 4
Merit: 0
August 31, 2018, 09:03:44 AM
#3
Thanks for that.
Documentation, instead of reading the code, would be useful.

Also the error reporting from the console is, how can I put it politely, sub-optimal.
"Traceback (most recent call last):" tells me absolutely nothing useful when (not if) I make a mistake.

For my use I think I need this:
Code:
listaddresses(True,False,False,False,True)
Because I don't want to re-use addrresses ... but it returns 14407 rows the same as listaddresses(True)

So it appears that this code:
Code:
        for addr in self.wallet.get_addresses():
            if frozen and not self.wallet.is_frozen(addr):
                continue
            if receiving and self.wallet.is_change(addr):
                continue
            if change and not self.wallet.is_change(addr):
                continue
            if unused and self.wallet.is_used(addr):
                continue
            if funded and self.wallet.is_empty(addr):
                continue
            item = addr
Doesn't work.
Because unused was passed as True and it returns the same list as when left as default (=False).
So perhaps self.wallet.is_used() doesn't mean what I guess it does.


By adding random parentheses to a non-working example, I found this gets the unused addresses as well:
Code:
print ("\n".join(i for i in wallet.get_receiving_addresses() if len(wallet.history.get(i,{})) == 0))
And returning only 5165 rows, I think it's more like the right answer.
HCP
legendary
Activity: 2086
Merit: 4361
August 31, 2018, 07:16:58 AM
#2
listaddresses() takes optional arguments...

def listaddresses(self, receiving=False, change=False, labels=False, frozen=False, unused=False, funded=False, balance=False):
"""List wallet addresses. Returns the list of all addresses in your wallet. Use optional arguments to filter the results."""

So, listaddresses(True) will give you receive. listaddresses(False,True) will give you change...
newbie
Activity: 4
Merit: 0
August 31, 2018, 06:38:39 AM
#1
In the console, or in the wallet UI, how can I extract a list of only receiving addresses ?

>> listaddresses()

Will return all addresses it seems, both change and receiving.

In the UI on the addresses tab I can filter to just receiving or just change addresses.
And then filter to unused, funded, used.

But there appears no way to extract that list.


Jump to: