How do I check a balance of a Bitcoin address (any, not necessarily mine), let's say in a Java application (or any other language)?
I need a functionality like the one on blockchain.info or biteasy.com but I don't want to use their API. Bitcoin is open source, so I thought maybe it won't be so difficult to get the data myself?
Use blockexplorer.com model and piggy back off their server or run your own using open source version at github.com/lirazsiri/blockexplorer
For now there is no simple way to get balance of a address that not in the wallet with bitcoin core. Maybe this function is under developing.
To get a address's balance, you need to compute the utxos on the address from the whole block chain. (I guess fornow there maybe no record of balance on each address, so you've to calculate it form the whole block chain)
You said in your question, you didn't want to use third site's API
(For example https://api.blockcypher.com/v1/btc/main/addrs/38DGj87axzmQiZeAd1w1y5FEmuu5a7pfBa).
You can run a bitcoin browser in you device, for example bitcoin explorer
It is not necessary to use web wallets to create addresses. You can install your own bitcoin server/daemon and act like your own bank.
This is the place to start if you want to know how to do it (https://en.bitcoin.it/wiki/Main_Page).
Bitcoin can be queried using JSON RPC methods. So if you are running a bitcoin daemon locally you can just query them. The documentation for the same is located at
Running Bitcoin - https://en.bitcoin.it/wiki/Running_Bitcoin
API Reference - https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
API Call List - https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
Hope this helps.
You can use JSON-RPC method. bitcoind widely supports JSON-RPC calls. So just go to the official website of bitcoin and find all of the methods.
Here is an example in PHP. Just include the jsonClient.php file
<\?php
require_once jsonRPCClient.php'; <br />
$bitcoin = 'https://' . $rpcusername . ':' . $rpcpassword .
'@' . $rpcip . ':' . $rpcport . '/'; <br />
print_r($bitcoin->getnewaddress());
?>
来源:https://stackoverflow.com/questions/20481478/how-to-check-bitcoin-address-balance-from-my-application