I am a merchant that accepts bitcoins, and I'm building my own desktop client for receiving them in Java.

When I receive a transaction, I would like to be able to see in my client how much bitcoin is stored in the address that I am receiving from.

I have the full blockchain downloaded on my computer.

How can I access the balance of an address from the blockchain? I would like to be able to do this offline by accessing the blockchain stored on my hard drive.

Thanks in advance


Perhaps you can look at the source code of full-mode bitcoin implementations in Java, such as bitsofproof (BOF).

It seems bitcoinj also has a full-mode but it is experimental only and not really suitable for prod.

Hope this helps...


You can use this blockchain link to get the balance


while you request it from the java


Using the bitcoinj Java library, you can retrieve your current balance very easily:

// To create your wallet.
public static NetworkParameters params = TestNet3Params.get();
public static String filePrefix = "forwarding-service-testnet";
public static WalletAppKit kit = new WalletAppKit(params, new File("."), filePrefix);

// to retrieve your balance.
String balance = kit.wallet().getBalance().toFriendlyString();
  • Your example code uses the Bitcoin testnet, while the OP wants to know how to check the balance from his locally-downloaded blockchain. Can you update your answer accordingly? Jan 31 '18 at 0:15

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.