[Golos.NET] A Microsoft .NET library for Golos API

2 года назад
80 в голос

Let me introduce Microsoft .NET class library for Golos : Golos.NET

Not everybody is familiar with Python or JavaScript. Some Microsoft Visual Studio developers might get frustrated having to move away from their favorite programming language.

That's why I created an open source .NET class exposing all golosd and cli_wallet API.
This will give you the power to play with any RPC or WebSocket endpoint.

The library is really easy to use, check the example below.

Golos.Net is also available as a compiled COM library (aka .dll) so you will also be able to use it in your favorite COM-enabled Windows application like Word or Excel ... even if you don't have Microsoft Visual Studio to compile the code.

Example using Golos.NET with golosd

Imports Newtonsoft.Json  
Module Test    
   Public Sub Main()     
      Using oGolos As New CGolosAPI

         Dim arrAcct As New ArrayList


         For Each oAccount In oGolos.get_accounts(arrAcct)

         Dim oBlock As Linq.JObject
         Dim oTrans As Linq.JObject
         Dim lLastBlockID As Long = 

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

               For Each oTrans In oBlock.Item("transactions")
                  Debug.Print(String.Format("Transaction is {0} operations",
            End If
      End Using
   End Sub

End Module 

Using Golos.NET with cli_wallet example

Using oWallet As New GolosAPI.CGolosWallet
   If oWallet.is_locked Then
   End If
   If oWallet.list_my_accounts.Count = 0 Then
   End If
   For Each oAccount In oWallet.list_my_accounts

   ' Lets help me - you can do the same ...
   oWallet.vote("arcange", "arcange", "Golos-api-for-microsoft-net-available")

   ' We are done. Secure lock the wallet

End Using

Websocket support

Golos.Net does not require running a local node. Websocket connection support has been implemented and you can connect your CGolosd object to an external seed node.


Using oGolos As New GolosAPI.CGolosd("ws://golos-seed.arcange.eu ")
    Dim lLastBlockID As Long = 
    Dim oJBlock As Linq.JObject

    For lBlockID As Long = lLastBlockID - 50 To lLastBlockID
        oJBlock = oGolos.get_block(lBlockID)
     ... Process block ...
End Using

For security reasons, CGolosWallet still requires a local node.

Golos.NET is open source

Full source code can be found on github here and is available for VB.NET and C#.NET.


I will maintain and improve the library as I am using it for several projects. If you have any comment, request or want to add your own touch to the project, feel free to contact me on golos.net channel on chat.golos.io.

Hopefully this will allow developers to build amazing tools and help the Golos community to grow.

Голосуйте за меня в качестве делегата

Вы также можете проголосовать прямо со Голос здесь. Для этого внизу страницы нужно проделать следующее

Если Вам понравился этот пост,
не забудьте проголосовать или подписаться на меня или поделиться

Авторы получают вознаграждение, когда пользователи голосуют за их посты.
Голосующие читатели также получают вознаграждение за свой голос.
Порядок сортировки:  Популярное
  ·  2 года назад

Здорово! Я являюсь .Net разработчиком. Проголосовал за тебя.

  ·  2 года назад

Спасибо большое !!!

  ·  2 года назад

WebSocket используемый в коде поддерживает платформу Windows 8 и выше, соответственно Windows 7 и ниже не поддерживается. ClientWebSocket