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.
Install-Package ark.net Go on the nuget website for more information.
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
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.
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);
//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());
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();
...
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);
Please, use github issues for questions or feedback. For confidential requests or specific demands, contact us on our public channels.
Visual Studio Community Edition : https://www.visualstudio.com/products/visual-studio-community-vs
Chris ([email protected]) & Sharkdev-j, with a lot of help from FX Thoorens [email protected] and ARK Community
Ark address:AUgTuukcKeE4XFdzaK6rEHMD5FLmVBSmHk
Copyright (c) 2018 ARK