Skip to content

boldninja/ark-net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alt text

Waffle.io - Columns and their card count GitHub issues GitHub forks GitHub stars GitHub license

Why Ark.NET

Ark.NET is the ARK Ecosystem library for the .NET platform. It implements all most relevant ARK functionalities to help you develop efficient .NET applications built upon ARK platform. It provides also low level access to ARK so you can easily build your application on top of it.

The package supports:

  • With full features, Windows Desktop applications, Mono Desktop applications, and platform supported at .NET Standard Library. Works on all .NET solutions with framework >= 4.7.1 & Net Standard 2.0.
  • Async/Await with coresponding synchronous methods.

Source Browser

How to install?

With nuget:

nuget

Install-Package ark.net Go on the nuget website for more information.

From source:

To compile it by yourself, you can git clone, open the project and hit the compile button on visual studio. In command prompt:

git clone https://github.com/ArkEcosystem/ark-net
cd ark-net

How to get started?

All ark-node service reponses have object representations. You can use service classes under service folder. Responses are IEnumerable for a list or an object for a single item. Every method has a cooresponding async method.

It's best to let the code do the speaking. For more examples look at the ARK.NET Tests, where all tests are written and you can see the api usage. Some code snippets are below.

Ark.Net Client init

First call needs to be start, so all settings within the library can initialize before going into action. Multiple instances of ArkNetApi can be used at the same time (DevNet & MainNet in the same application)

private ArkNetApi _arkNetApi;
public ArkNetApi ArkNetApi
{
    get { return _arkNetApi ?? (_arkNetApi = new ArkNetApi()); }
}
await ArkNetApi.Start(NetworkType.MainNet); //Other type is DevNet
//or
await ArkNetApi.Start(specificPeerIp, specificPeerPort);

Account/Wallet layer

//Existing account
var accCtnrl = new AccountController(ArkNetApi, "top secret pass");

//Send ARK
var result = accCtnrl.SendArk(100, "AUgTuukcKeE4XFdzaK6rEHMD5FLmVBSmHk", "Akr.Net test trans from Account");

//Vote 4 Delegate                
var result = accCtnrl.VoteForDelegate( votes, "top secret pass");

//Create and send transaction.  Transaction can be saved offine (.ToJson()) and sent later.              
var transaction = accCtnrl.CreateTransaction(100, "AUgTuukcKeE4XFdzaK6rEHMD5FLmVBSmHk", "Akr.Net test trans from Account");
var result = accCtnrl.SendTransaction(transaction);

//Get Account
var account = accCtnrl.GetArkAccount();

//New acount
new AccountController(ArkNetApi, ArkNetApi.AccountService.GeneratePassphrase());

Service layer

For a full list of available api calls please look at the ARK.NET Test project

//PeerService
var peers = ArkNetApi.PeerService.GetAll();
var peersOK = peers.Where(x => x.Status.Equals("OK"));

//TransactionService
var trans = ArkNetApi.TransactionService.GetAll();

//BlockService
var blocks = ArkNetApi.BlockService.GetAll();

//AccountService - Generate passphrase
var result = ArkNetApi.AccountService.GeneratePassphrase();

//DelegateService
var delegates = ArkNetApi.DelegateService.GetAll();

//LoaderService
var autoConfigParams = ArkNetApi.LoaderService.GetAutoConfigureParameters();
...

Core Layer

Layer is used for core Ark blockchain communication (transaction, crypto...). It is wrapped by api libraries that are called from the service and Account layer.

//Create & send transaction
TransactionApi tx = ArkNetApi.TransactionApi.CreateTransaction(recepient, amount, description, passphrase);
Peer peer = ArkNetApi.NetworkApi.GetRandomPeer();
var result = peer.PostTransaction(tx);

//Connect to specific peer
var peerApi = new PeerApi(ipAddress, Port)

// Switch network (Can also create new ArkNetApi instance as alternative solution)
await ArkNetApi.SwitchNetwork(NetworkType.DevNet)

//New network
_arkNetApiDevNet = new ArkNetApi();
await _arkNetApiDevNet.Start(NetworkType.DevNet);      

More information about ARK Ecosystem and etc

Please, use github issues for questions or feedback. For confidential requests or specific demands, contact us on our public channels.

Useful link for a free IDE :

Visual Studio Community Edition : https://www.visualstudio.com/products/visual-studio-community-vs

Authors

Chris (kristjan.kosic@gmail.com) & Sharkdev-j, with a lot of help from FX Thoorens fx@ark.io and ARK Community

Support this project

alt text Ark address:AUgTuukcKeE4XFdzaK6rEHMD5FLmVBSmHk

License

License: MIT

Copyright (c) 2018 ARK

About

Ark Client for .NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%