Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: JimmyGre on June 09, 2014, 05:53:13 AM



Title: get external addresses balance in bitcoind
Post by: JimmyGre on June 09, 2014, 05:53:13 AM
Hi,
I just installed bitcoin daemon on my server. Now I only can get address balance from my wallet.
Is that possible to get external addresses balance in my bitcoin daemon (PHP)?

(I don't want to use something like blockchain api ...)
(getreceivedbylabel is not working for me  ???)

Cheers,
J


Title: Re: get external addresses balance in bitcoind
Post by: Newar on June 09, 2014, 01:27:17 PM
You mean an address that is not part of your wallet? That is not possible with bitcoind. That's why we have all those blockr.io, blockexplorer, blockchain.info etc. There's also some projects to parse the locally stored blockchain, I guess it could be achieved that way too.


Title: Re: get external addresses balance in bitcoind
Post by: DannyHamilton on June 09, 2014, 01:59:57 PM
The answer in this sub-forum is the same as it was in the other sub-forum where you asked the exact same question:

As far as I'm aware, you'd have to process the entire blockchain using commands such as getblockhash, getblock, and getrawtransaction to search for any and all unspent transaction outputs associated with the address you are interested in.  Then you'd have to add up all the unspent outputs to arrive at a total balance.

To avoid having to repeatedly scan the entire blockchain, you'd probably be better off scanning it once and building a database table with the complete UTXO set.  Then you'd want to use blocknotify to update your UTXO table everytime a new block is created.  That way you could just query your UTXO table to find address balances.


Title: Re: get external addresses balance in bitcoind
Post by: JimmyGre on June 11, 2014, 04:41:20 AM
The answer in this sub-forum is the same as it was in the other sub-forum where you asked the exact same question:

As far as I'm aware, you'd have to process the entire blockchain using commands such as getblockhash, getblock, and getrawtransaction to search for any and all unspent transaction outputs associated with the address you are interested in.  Then you'd have to add up all the unspent outputs to arrive at a total balance.

To avoid having to repeatedly scan the entire blockchain, you'd probably be better off scanning it once and building a database table with the complete UTXO set.  Then you'd want to use blocknotify to update your UTXO table everytime a new block is created.  That way you could just query your UTXO table to find address balances.

Um...where can I input the address that i'm interested in?


Title: Re: get external addresses balance in bitcoind
Post by: DannyHamilton on June 11, 2014, 12:26:01 PM
The answer in this sub-forum is the same as it was in the other sub-forum where you asked the exact same question:

As far as I'm aware, you'd have to process the entire blockchain using commands such as getblockhash, getblock, and getrawtransaction to search for any and all unspent transaction outputs associated with the address you are interested in.  Then you'd have to add up all the unspent outputs to arrive at a total balance.

To avoid having to repeatedly scan the entire blockchain, you'd probably be better off scanning it once and building a database table with the complete UTXO set.  Then you'd want to use blocknotify to update your UTXO table everytime a new block is created.  That way you could just query your UTXO table to find address balances.

Um...where can I input the address that i'm interested in?

I'm not sure what you're asking.

If you are asking how you can add an address to the bitcoin daemon, then you need to have the private key.  You can then issue the importprivkey command and the daemon will add the private key to its own list of private keys and calculate the bitcoin address.