Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: heretolearn on February 25, 2014, 01:06:29 PM



Title: "listaccounts" and "labels" : why is it this way ?
Post by: heretolearn on February 25, 2014, 01:06:29 PM
I tried to make a new address and have the same label for two addresses. When I typed "listaccounts" it showed me only the label which was the same for both addresses.

When I change the label to something else then all the addresses according to labels are listed.

Why does listaccounts show according to labels ? I mean to ask what is the logic behind it. Wouldnt showing by addresses be more meaningful ?


Title: Re: "listaccounts" and "labels" : why is it this way ?
Post by: syslog on February 25, 2014, 02:15:51 PM
accounts & labels are the same,  

basically when you call listaccounts call it will show you accounts as key and balance as value ( it's quite usefull when you have multiple addresses pointed an account(label)


i think getaccountaddress getaddressesbyaccount call is what you are looking for .

PS: btc supports rpc2.0  this makes your life easier.




Title: Re: "listaccounts" and "labels" : why is it this way ?
Post by: davidpbrown on February 25, 2014, 02:22:20 PM
I tried to make a new address and have the same label for two addresses. When I typed "listaccounts" it showed me only the label which was the same for both addresses.

When I change the label to something else then all the addresses according to labels are listed.

Why does listaccounts show according to labels ? I mean to ask what is the logic behind it. Wouldnt showing by addresses be more meaningful ?


Accounts surely are a sum of addresses. So, what you've described makes sense.

If you want a list by addresseses then try
 listreceivedbyaddress 0 true
which, if I've remembered that correctly, will list all addresses even with zero balance and their label.

List by account then, from what you've described, groups by label =='account'.


Title: Re: "listaccounts" and "labels" : why is it this way ?
Post by: heretolearn on February 25, 2014, 08:40:36 PM
accounts & labels are the same, 

basically when you call listaccounts call it will show you accounts as key and balance as value ( it's quite usefull when you have multiple addresses pointed an account(label)


i think getaccountaddress call is what you are looking for .

PS: btc supports rpc2.0  this makes your life easier.

I tried getaccountaddress and found stange results, it sometimes generates a new address with the same label as the argument !! How does that work ?

Also any link as to how and what advantages rpc2.0 has when used with btc ?


Title: Re: "listaccounts" and "labels" : why is it this way ?
Post by: heretolearn on February 25, 2014, 08:44:50 PM
Accounts surely are a sum of addresses. So, what you've described makes sense.

If you want a list by addresseses then try
 listreceivedbyaddress 0 true
which, if I've remembered that correctly, will list all addresses even with zero balance and their label.

List by account then, from what you've described, groups by label =='account'.

Hmm that helped clear some doubts. Thanks.


Title: Re: "listaccounts" and "labels" : why is it this way ?
Post by: syslog on February 26, 2014, 08:18:34 AM
accounts & labels are the same,  

basically when you call listaccounts call it will show you accounts as key and balance as value ( it's quite usefull when you have multiple addresses pointed an account(label)


i think getaccountaddress call is what you are looking for .

PS: btc supports rpc2.0  this makes your life easier.

I tried getaccountaddress and found stange results, it sometimes generates a new address with the same label as the argument !! How does that work ?

Also any link as to how and what advantages rpc2.0 has when used with btc ?
Oh, i made a mistake.  your call should be getaddressesbyaccount not getaccountaddress (this actually returns only address)

about rpc2.0 http://www.jsonrpc.org/specification#examples

I'm sorry for the mistake.