Are there any C# wrappers for the Bitcoin REST API?

8

1

Are there any C# wappers that take an OOO approach to the Bitcoin REST API, and encapsulate it in an easy to use format?

goodguys_activate

Posted 2012-11-23T15:04:36.050

Reputation: 11 898

Answers

2

Take a look at this c# bitcoin rpc api wrapper: https://github.com/GeorgeKimionis/BitcoinLib that, unlike bitnet, is up-to-date.

George Kimionis

Posted 2012-11-23T15:04:36.050

Reputation: 2 824

2This is so far the best library on this page!goodguys_activate 2014-02-13T02:19:20.330

1

I'm the author of WalletClient.net and it's fairly up to date, covering most of the json-rpc commands. It has an async model and strongly typed return objects. There's also specific support for Blockchain.info vs native Bitcoind.

Let me know what you think.

ChrisW

Posted 2012-11-23T15:04:36.050

Reputation: 840

1I like the Blockchain integration, George's solution seems to be better on the QT side.goodguys_activate 2014-02-13T02:18:28.857

1

I wrote my own wrapper, it wasn't complicated, this is the basic gist of it below. Adapt for your specific needs.

Example of getting raw transaction

internal static string GetRawTransaction(string txid)
{
    var CredentialCache = new CredentialCache();
    CredentialCache.Add(new Uri("http://127.0.0.1:8332"), "Basic", new NetworkCredential("[your rpc username]", "your rpc password"));

    var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1:8332");
    httpWebRequest.ContentType = "text/json";
    httpWebRequest.Method = "POST";
    httpWebRequest.Credentials = CredentialCache;

    using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
    {
        string json;
        json = "{ \"jsonrpc\": \"2.0\", \"id\":\"" + Guid.NewGuid().ToString() + "\", \"method\": \"getrawtransaction\",\"params\":[\"" + txid + "\",1]}";

        streamWriter.Write(json);
    }
    var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    {
        var responseText = streamReader.ReadToEnd();
        return responseText;
    }
}

Sean Bradley

Posted 2012-11-23T15:04:36.050

Reputation: 401

0

https://github.com/Glasswalker/Wallet.Net/tree/master/Bitnet.Client I use bitnet client, nothing but good things to say, if its missing anything you need its quite easy to add/modify anything you need.

If you open up bitcoin -qt then go to the console and type in help you will see a list of all the methods. (as not every single one is implemented in bitnet)

Isuru Fonseka

Posted 2012-11-23T15:04:36.050

Reputation: 149

0

Here is my job, mostly for transactions but probably I'll update it in free time

https://github.com/kamilk91/BitcoinManagerCsharp

Kamil

Posted 2012-11-23T15:04:36.050

Reputation: 101