Reference implementation for the Zenon SDK for .NET. Compatible with the Zenon Alphanet - Network of Momentum Phase 0. It provides a simple integration with any .NET based projects.
Install the Zenon.Sdk package from NuGet
dotnet add package Zenon.Sdk
using Zenon;
var nodeUrl = new Uri("ws://nodes.zenon.place:35998");
await Znn.Instance.Client.Value.StartAsync(nodeUrl);
...
await Znn.Instance.Client.Value.StopAsync();
using Zenon;
var wallet = "name";
var passphrase = "secret";
Znn.Instance.DefaultKeyStorePath =
Znn.Instance.KeyStoreManager.CreateNew(passphrase, wallet);
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);
using Zenon;
var wallet = "name";
var passphrase = "secret";
var mnemonic =
"route become dream access impulse price inform obtain engage ski believe awful absent pig thing vibrant possible exotic flee pepper marble rural fire fancy";
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.CreateFromMnemonic(mnemonic, passphrase, wallet);
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);
using Zenon;
var nodeUrl = new Uri("ws://nodes.zenon.place:35998");
var wallet = "name";
var passphrase = "secret";
var mnemonic =
"route become dream access impulse price inform obtain engage ski believe awful absent pig thing vibrant possible exotic flee pepper marble rural fire fancy";
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.CreateFromMnemonic(mnemonic, passphrase, wallet);
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);
Znn.Instance.DefaultKeyPair =
Znn.Instance.DefaultKeyStore.GetKeyPair(); // Use primary address
await Znn.Instance.Client.Value.StartAsync(nodeUrl);
var tx = Znn.Instance.Embedded.Pillar.CollectReward();
await Znn.Instance.Send(tx);
await Znn.Instance.Client.Value.StopAsync();
using Zenon;
using Zenon.Model.NoM;
var nodeUrl = new Uri("ws://nodes.zenon.place:35998");
var wallet = "name";
var passphrase = "secret";
var mnemonic =
"route become dream access impulse price inform obtain engage ski believe awful absent pig thing vibrant possible exotic flee pepper marble rural fire fancy";
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.CreateFromMnemonic(mnemonic, passphrase, wallet);
Znn.Instance.DefaultKeyStore =
Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);
Znn.Instance.DefaultKeyPair =
Znn.Instance.DefaultKeyStore.GetKeyPair(); // Use primary address
await Znn.Instance.Client.Value.StartAsync(nodeUrl);
var result = await Znn.Instance.Ledger
.GetUnreceivedBlocksByAddress(Znn.Instance.DefaultKeyPair.Address);
if (result.Count != 0)
{
foreach (var item in result.List)
{
var tx = AccountBlockTemplate.Receive(item.Hash);
await Znn.Instance.Send(tx, true);
}
}
await Znn.Instance.Client.Value.StopAsync();
Please check CONTRIBUTING for more details.
The MIT License (MIT). Please check LICENSE for more information.