Introducing Hive libraries for Microsoft .NET

in HiveDevs3 years ago (edited)

Today I want to introduce you to a new Microsoft .NET library for Hive developers.

Why a .NET library?

While languages like Python or JavaScript have become very popular for web development, there are also developers out there who are unfamiliar with them. Some developers oriented towards Microsoft languages like VB.NET or C # may be frustrated at having to move away from their preferred programming language and tools like Microsoft Visual Studio.

That's why I've created easy-to-use .NET classes, exposing almost all the APIs of hived and cli_wallet, and allowing .NET developers to play with any API node.

The class library is available for both VB.NET and C# languages.

I also provide a "COM library" (aka .dll) so you will also be able to use it directly in your favorite COM-enabled Windows application like Word or Excel, ... even if you don't have Microsoft Visual Studio to develop and compile applications.

Code example

The library is really easy to use. Here a simple VB.NET code example that read the information from an account and stream the last 100 blocks from the blockchain:

Dim oHC As HttpClient = New HttpClient()
Using oHive As New CHived(oHC,"https://api.hive.blog")
   Debug.Print(ohive.get_config.ToString)
   Debug.Print(ohive.get_account_count.ToString)

   oHive.get_account("arcange")
   Debug.Print(oAccount.ToString)

   Dim oBlock As JObject
   Dim oTrans As JObject
   Dim lLastBlockID As Long 
   
   lLastBlockID = oHive.get_dynamic_global_properties().Item("last_irreversible_block_num")

   For lBlockID As Long = lLastBlockID - 100 To lLastBlockID
      oBlock = ohive.get_block(lBlockID)
      If Not oBlock.Item("transactions") Is Nothing Then
         Debug.Print(String.Format("Block {0} {1} contains {2} transactions",
            oBlock.Item("block_num"),
            oBlock.Item("timestamp").ToObject(Of DateTime),
            oBlock.Item("transactions").Count))
      End If
   Next
End Using

Here another example showing how one interacts with its wallet:

Dim oHC As HttpClient = New HttpClient()
Using oWallet As New hiveAPI.ChiveWallet(oHC,"http://my.wallet.node")
   If oWallet.is_locked Then
      oWallet.unlock("mysuperwalletpassword")
   End If

   If oWallet.list_my_accounts.Count = 0 Then
      oWallet.import_key("MY_PRIVATE_POST_KEY")
   End If

   For Each oAccount In oWallet.list_my_accounts
      Debug.Print(oAccount.Item("name"))
   Next

   ' Lets vote on a post ...
   oWallet.vote("arcange", "hiveio", "announcing-the-launch-of-hive-blockchain")
   oWallet.lock()
End Using
        

Open source

The libraries are open source and can be found on GitLab.

If you have any comments or requests, please create an issue on GitLab too. You can also contact me on Discord or Telegram


Check out my apps and services


Vote for me as a witness

Sort:  

As a VB.NET hack and slash programmer, this is great news... thanks!

Glad you like it @slobberchops

@arcange,
I am a C# developer & due to lack of data & libraries I have moved to JavaScript. Seems I could go back! Very interesting thing. So we could have windows applications that might easy work with our PCs. Highly appreciate this work!
$tangent

Cheers~


Congratulations, @theguruasia You Successfully Trended The Post Shared By @arcange.
You Utilized 2/3 Daily Summon Bot Calls.

TAN Current Market Price : 0.320 HIVE

oh waw, cool, cool, that opens up new possibilities!

Welcome to the world of possibles 😉

Thank you for everything you do for our HIVE

Thank you @nathanmars

More platforms the better :)
thank you for this.

Yes, another way to make my contribution to expanding our developer base.

I’m not a programmer but that seems top-notch to me. Otherwise, I don't know if other chains also have libraries for Microsoft.NET which is actually an important framework in the business environment. If they are not blind and short-sighted they should have.

If they are not blind and short-sighted they should have.

Hence why I made this one.
Thank you for your appreciation @seckorama

Wow that's good news. It's been a while since I stopped coding something in C# and I think I have slowly evolved to other languages. But this will be a great addition to Hive. I can at least suggest this to some of my friends who are still .NET devs.

Thanks, arcange.

Absolutely, let's leave no one behind. 👍

this is very interesting. I will surely have a look at it. thanks you.

Very interesting, thanks for sharing

Congratulations @arcange! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

Your post got the highest payout of the day

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @hivebuzz:

Project Activity Update

This is great, thank you very much for getting this ported over to Hive!

Microsoft?
That's related to the guy trying to vaccinate the entire planet right now, isn't it?

Is there anything related to my work that you are trying to make me understand with your comment?

This is a great work and a good news

Oh! the possibilities for making ALL of TEH sPreadsheets ;) Very cool.


Congratulations @arcange, You Earned 2.356 TAN & Curators Made 1.649 TAN.

tangent.token


Join CORE / VAULT Token Discord Channel or Trade TANGENT Token
TAN Current Market Price : 0.953 HIVE

.