scrobble.life
HiveDevs

Introducing Hive libraries for Microsoft .NET

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

Comments · 21

  • @diem(25)· 2096d

    .

  • @bala41288(80)· 2104d

    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.

  • @tan.app(45)· 2105d

    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

  • @poshbot(59)· 2106d
  • @eturnerx(69)· 2106d

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

  • @stefano.massari(75)· 2107d

    This is a great work and a good news

  • @emrebeyler(76)· 2107d

    great work.

  • @nathanmars(75)· 2107d

    Thank you for everything you do for our HIVE

  • @bubke(61)· 2107d

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

  • @smokiethebear912(44)· 2107d

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

  • @bobinson(67)· 2107d

    More platforms the better :) thank you for this.

  • @slobberchops(82)· 2107d

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

  • @hashkings(67)· 2107d

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

  • @theguruasia(69)· 2107d

    @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~

  • @hivebuzz(74)· 2108d

    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
  • @nuraoiiin(25)· 2108d

    niiiiice

  • @davidmuhammad(60)· 2108d

    Very interesting, thanks for sharing

  • @imfarhad(74)· 2108d

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

  • @seckorama(78)· 2108d

    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.

  • @beerlover(65)· 2108d


    Hey @arcange, here is a little bit of BEER from @pixresteemer for you. Enjoy it!

    Learn how to earn FREE BEER each day by staking your BEER.

  • @pixresteemer(71)· 2108d

    pixresteemer_incognito_angel_mini.png

    Bang, I did it again... I just rehived your post!

    Week 32 of my contest just started...you can now check the winners of the previous week!

    !BEER

    5