Author

Topic: getreceivedbyaddress exists, where is getaddressbalance (Read 1645 times)

full member
Activity: 203
Merit: 100
Quote
But it doesn't fit in the wallet abstraction provided by the client. Breaking that abstraction would confuse people who only want to use it, and do not care about the internal functioning. It's something for an expert mode, and belongs in what I call micro-management. Certainly people will want this, but it doesn't fit in what the client currently provides (the abstraction that it represents a wallet with money in).

Using the rpc IS the expert mode. Do you think that people who easily get confused will use the rpc for something? Adding a command does not "break" anything, for the people who won't even know about it, nothing will change. For the people that do know about this, things will only get easier. It is just a command that should've been there from the beginning.
legendary
Activity: 1072
Merit: 1174
Quote
They can keep track of income per public address you create, but only the balance of the entire wallet that matters to you if you are looking at the wallet abstraction (i.e., the amount you're able to spend).
Maybe not.

Maybe we have different addresses in a single wallet with btc coming from different sources and we want to keep them divided, and don't mix them.

That's certainly useful sometimes and very educational. It's also planned to be included in the client.

But it doesn't fit in the wallet abstraction provided by the client. Breaking that abstraction would confuse people who only want to use it, and do not care about the internal functioning. It's something for an expert mode, and belongs in what I call micro-management. Certainly people will want this, but it doesn't fit in what the client currently provides (the abstraction that it represents a wallet with money in).
legendary
Activity: 1148
Merit: 1008
If you want to walk on water, get out of the boat
Quote
They can keep track of income per public address you create, but only the balance of the entire wallet that matters to you if you are looking at the wallet abstraction (i.e., the amount you're able to spend).
Maybe not.

Maybe we have different addresses in a single wallet with btc coming from different sources and we want to keep them divided, and don't mix them.
legendary
Activity: 1896
Merit: 1353
I think that when people want to know "the balance of an address", they really want the balance of a wallet

I think you are wrong. When people ask for something, chances are that they want that thing Smiley
legendary
Activity: 1072
Merit: 1174
The core issue here is that the abstractions provided by the wallet and what you can see on blockchain explorers differs.

Wallets manage a set of keys, and a set of unspent coins available for those keys to spend. They can keep track of income per public address you create, but only the balance of the entire wallet that matters to you if you are looking at the wallet abstraction (i.e., the amount you're able to spend).

Internally, wallet create change addresses, and coins can be assigned to either public or change keys in the wallet. Blockchain explorer can however not see the entire wallet, they only see the individual addresses.

I think that when people want to know "the balance of an address", they really want the balance of a wallet, but have learnt to observe this through the only publically observable piece of information available: the individual addresses in it. The real solution is using watch-only deterministic wallets here, in my opinion (being worked on ...). That allows you to keep working in the wallet abstraction, without needing to be bothered with individual addresses and keys.

The alternative is using a lower-level wallet abstraction, where you micro-manage all keys and addresses yourself. There are certainly useful applications for this (for example satoshidice uses the specific input coins you sent them in your payouts, so they don't take a risk allowing low numbers of confirmations). This way of working is currently not supported in the reference client. There are plans to include this functionality, but it will only be the preferred solution for particular instances in my opinion. That said, it can be very educational.
legendary
Activity: 1652
Merit: 2216
Chief Scientist
I think you mean 99 lol.
I should lie and say I'm feeling extra generous to miners this morning and wanted to give them an imaginary 50 BTC fee...
rjk
sr. member
Activity: 448
Merit: 250
1ngldh
How would you use a 'getaddressbalance'?  What are you trying to do?

Start with an empty wallet.  I send you 100 BTC to address 'foo'. Then you send somebody else 1 BTC.

Internally, a new change address with 49 bitcoins is created, so getaddressbalance 'foo' would return zero. Would that ever be the right answer?


I think you mean 99 lol.
legendary
Activity: 1652
Merit: 2216
Chief Scientist
How would you use a 'getaddressbalance'?  What are you trying to do?

Start with an empty wallet.  I send you 100 BTC to address 'foo'. Then you send somebody else 1 BTC.

Internally, a new change address with 49 (edit: 99) bitcoins is created, so getaddressbalance 'foo' would return zero. Would that ever be the right answer?

hero member
Activity: 558
Merit: 500
It means, I can not get balance of specific address using official Bitcoin client??? Come on!
legendary
Activity: 1072
Merit: 1174
That would require an index from each address to all blocks/transactions that spend to or from it. Since this is not required for normal operations, and quite expensive, it is not (yet?) implemented in the reference client.
hero member
Activity: 558
Merit: 500
"getreceivedbyaddress" exists = shows total received...

Why there is no "getaddressbalance"?

How can I get balance of address?
Jump to: