2

im new to bitcoin and want to find out which is the best API or way for getting the bitcoin balance of a bitcoin address for any bitcoin address in C#

1

The easiest way would be to use the API of a block explorer. Several provide such an API and some have wrapper libraries for C#.

For example the blockchain.info blockchain explorer has such an API and has a C# wrapper as well. Consult their Blockchain Data API which explains how to get the balance (among other data) from an address. More specifically, you need to call the following (HTTP) API:

https://blockchain.info/address/$bitcoin_address?format=json

The result is a json object and "final_balance" is what you need.

If you use the C# wrapper you can find an example on how to get the balance of an address (and many other things) here.

Alternatively, you could query a bitcoin node directly. The easiest way to do that in C# would be to use a wrapper library.

  • ok, i'll look into the Blockchain Data API and see if I can figure it out. Thanks – user31889 Jan 13 '16 at 19:38
  • I edited the answer to add the API needed plus an example using the C# wrapper library. – karask Jan 15 '16 at 9:59

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.