Introducing Hive libraries for Microsoft .NET
![](https://i.imgur.com/uBDjiIT.png)
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](https://gitlab.syncad.com/hive/hive-net).
If you have any comments or requests, please create an issue on GitLab too. You can also contact me on [Discord](https://discordapp.com/channels/@me/237480770933882881) or [Telegram](https://t.me/the_arcange)
---
### Check out my apps and services
### [Vote for me as a witness ![](https://i.imgur.com/2bi4SnT.png)](https://hivesigner.com/sign/account-witness-vote?witness=arcange&approve=1)</div>
See: Introducing Hive libraries for Microsoft .NET by @arcange