Author

Topic: How to get current balance of address with bitcoind or maybe not bitcoind? (Read 2203 times)

full member
Activity: 126
Merit: 100
I found these problems too when working with bitcoind - it's really a bit of a pain to work with. I appreciate that Bitcoin works the way that bitcoin works. But it makes developing Bitcoin applications much slower than it could be for people new to working with it.
full member
Activity: 224
Merit: 100
And I think it would be better if listunspent could return in associative array a time of transaction.
Because again, I need to loop through another array and call gettransaction for each txid.
full member
Activity: 224
Merit: 100
Thanks!
Got it and tested it. One thing, that I must walk through all elements of listunspent result to get balance for particular address.

legendary
Activity: 1512
Merit: 1032
The problem with such a command is it wouldn't work the way you would expect:

1. someone sends my 1DCeLERon address 5 BTC
2. i send 1 BTC to my friend
3. the balance of my 1DCeLERon address is 0 BTC

This is because if the 5 BTC is the only money in my wallet, the remainder 4 BTC is sent back to a different address in my wallet as change. If I get paid another 5 BTC to the same address again, I have 5 BTC in that address and 4 BTC in the other.

This is why Bitcoin gives you a wallet balance, not an address balance. It is also why looking up an address on a blockchain explorer site will confuse noobs. These sites can't tell if the 4 BTC or the 1 BTC is change back to you, or even if they are both payments to other parties.

I mean using local server bitcoind, sure blockchain.info has more possibilities.


you could use listunspend and filter by address.
The RPC command is "listunspent". I have 24 addresses with a balance in my current wallet just used for personal testing, and that is even after sending some money back to myself to consolidate it. What one entry from this command looks like, btw:

copper member
Activity: 1498
Merit: 1499
No I dont escrow anymore.
I mean using local server bitcoind, sure blockchain.info has more possibilities.


you could use listunspend and filter by address.
full member
Activity: 224
Merit: 100
I mean using local server bitcoind, sure blockchain.info has more possibilities.
sr. member
Activity: 294
Merit: 250
did you named btc address?
if you request "getbalance name" it returns.

also this returns satoshi: https://blockchain.info/q/addressbalance/13qVUetqX6ZWLyEaYAwd8its5m64Bm1SaP
full member
Activity: 224
Merit: 100
Question:

There is getreceivedbyaddress, but there is no command to get current balance of address.

Is there any workarounds ?


Jump to: