5

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?

pmichna
  • 4,800
  • 13
  • 53
  • 90
  • 2
    If you don't want to use an API, download the bitcoin client, fetch the blockchain and parse it. – Sirko Dec 09 '13 at 21:47
  • could be a duplicate of http://bitcoin.stackexchange.com/questions/10090/how-to-get-an-addresss-balance-with-the-bitcoin-client – knocte Dec 08 '15 at 07:32

4 Answers4

1

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

LF00
  • 27,015
  • 29
  • 156
  • 295
-1

Use blockexplorer.com model and piggy back off their server or run your own using open source version at github.com/lirazsiri/blockexplorer

scott7ree
  • 3
  • 3
-3

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.

Abishek
  • 11,191
  • 19
  • 72
  • 111
-3

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()); 

?>
drs
  • 5,679
  • 4
  • 42
  • 67