2

I'm a merchant that is currently developing program that I will use for receiving transactions for my business.

I would like my program to be able to check how much Bitcoin the address sending to me has. I have the entire blockchain downloaded to the computer.

Ideally I'd like something that works like this:

String address = "1PSxTeWTVgomscit2BoViZYKSc4QoyrmAk";
Double balance = blockChain.getBalance(address);

Is this possible? I am having a difficult time finding a way to do this using the blockchain stored on my computer. It seems like it would be fairly easy to do this just using blockchain.info's API, but I would like to keep the process contained on my computer.

Thanks in advance.

  • Addresses do not have balances, so expecting bitcoin core to give you this information is unreasonable. – Guest Aug 23 '14 at 2:02
  • @Guest While that's technically true, it's a very misleading thing to say. – Nick ODell Oct 22 '14 at 2:50
1

If the address is not in your wallet that is not possible with the current bitcoind RPC API. You have to either go through the blockchain calculating the balance of the address yourself (i.e. find the last transaction from that address or sum the payouts to the address) or use an online tool like blockchain.info as you mentioned.

  • ...or BlockTrail API or Chain API. Blockchain.info have been proving to be somewhat unreliable lately, so always good to be aware of the alternatives out there. – OACDesigns Oct 22 '14 at 17:12
1

If you want to get balance by using address, then you should try :

BitcoinJSONRPCClient tr = new BitcoinJSONRPCClient();

tr.gettransaction("txnId");

It will give you the Balance and everything related to that particular address.

I hope this will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.