Bitcoin Forum
May 04, 2024, 11:11:15 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum 3.0.5 list receiving addresses  (Read 169 times)
smartwombat (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 31, 2018, 11: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.


1714821075
Hero Member
*
Offline Offline

Posts: 1714821075

View Profile Personal Message (Offline)

Ignore
1714821075
Reply with quote  #2

1714821075
Report to moderator
1714821075
Hero Member
*
Offline Offline

Posts: 1714821075

View Profile Personal Message (Offline)

Ignore
1714821075
Reply with quote  #2

1714821075
Report to moderator
1714821075
Hero Member
*
Offline Offline

Posts: 1714821075

View Profile Personal Message (Offline)

Ignore
1714821075
Reply with quote  #2

1714821075
Report to moderator
The network tries to produce one block per 10 minutes. It does this by automatically adjusting how difficult it is to produce blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714821075
Hero Member
*
Offline Offline

Posts: 1714821075

View Profile Personal Message (Offline)

Ignore
1714821075
Reply with quote  #2

1714821075
Report to moderator
1714821075
Hero Member
*
Offline Offline

Posts: 1714821075

View Profile Personal Message (Offline)

Ignore
1714821075
Reply with quote  #2

1714821075
Report to moderator
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
August 31, 2018, 12:16:58 PM
 #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...

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
smartwombat (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 31, 2018, 02:03:44 PM
 #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.
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
August 31, 2018, 02:28:11 PM
 #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...
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
September 01, 2018, 12:40:38 AM
 #5

Thanks for that.
Documentation, instead of reading the code, would be useful.
You'll need to take that up with the devs...

Quote
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.

The console is more or less a cut down Python console. So what you see is basically just a Python interpretor error... Unfortunately, these aren't very helpful a lot of the time Tongue

Quote
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)
Thankfully, I only have 23 rows to count... But using that command I get 22 returned... It is definitely leaving out the one address which received then spent all funds.

However there are 2 other addresses which have received, but are still included when unused=True...

Quote
So perhaps self.wallet.is_used() doesn't mean what I guess it does.
I'd have to agree to a certain extent... I'm not 100% sure as I haven't gone digging into the code yet. Perhaps ask the devs direct on the Electrum GitHub?? https://github.com/spesmilo/electrum/issues

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

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!