Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Elwar on August 10, 2012, 09:16:22 PM



Title: What would be the best way to get the balance of an address?
Post by: Elwar on August 10, 2012, 09:16:22 PM
I am looking to check an address to see if it is empty and if not empty, check to see how many bitcoins the address contains.

Would I be able to do this with a call from bitcoinj or would I need to add up transactions through the blockchain or what?


Title: Re: What would be the best way to get the balance of an address?
Post by: Stephen Gornick on August 10, 2012, 11:36:58 PM
Would I be able to do this with a call from bitcoinj or would I need to add up transactions through the blockchain or what?

There is a service that might help, if you weren't aware of it:

 - http://btcbalance.net


Also, via API:
 - https://blockexplorer.com/q/addressbalance/<address>
 - http://blockchain.info/q/addressbalance/<address>


Title: Re: What would be the best way to get the balance of an address?
Post by: Elwar on August 11, 2012, 12:48:07 AM
Would I be able to do this with a call from bitcoinj or would I need to add up transactions through the blockchain or what?

There is a service that might help, if you weren't aware of it:

 - http://btcbalance.net


Also, via API:
 - https://blockexplorer.com/q/addressbalance/<address>
 - http://blockchain.info/q/addressbalance/<address>

So I assume that means that parsing the full blockchain is the way to go. I cannot rely on a third party.


Title: Re: What would be the best way to get the balance of an address?
Post by: scintill on August 11, 2012, 01:04:50 AM
So I assume that means that parsing the full blockchain is the way to go. I cannot rely on a third party.

Check out blockparser (https://github.com/znort987/blockparser).  The command would be something like blockparser tally <address>.  Requires synced blockchain from original client, Ubuntu x86-64.  There may be a way to query arbitrary addresses through the original client's RPC commands, too.


Title: Re: What would be the best way to get the balance of an address?
Post by: Stephen Gornick on August 11, 2012, 08:07:19 AM
I assume that means that parsing the full blockchain is the way to go.

There are others;

 - libBitcoin
 - Armory (see Extras)
 - Bitcoin ABE
 - BitcoinJ
 - BitcoinJS