getting the unspent bitcoins based on bitcoin address

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#

user31889

Posted 2016-01-13T18:08:22.253

Reputation: 31

Answers

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.

karask

Posted 2016-01-13T18:08:22.253

Reputation: 2 089

ok, i'll look into the Blockchain Data API and see if I can figure it out. Thanksuser31889 2016-01-13T19:38:12.060

I edited the answer to add the API needed plus an example using the C# wrapper library.karask 2016-01-15T09:59:33.187