eosnet 2.0.0
See the version list below for details.
dotnet add package eosnet --version 2.0.0
NuGet\Install-Package eosnet -Version 2.0.0
<PackageReference Include="eosnet" Version="2.0.0" />
paket add eosnet --version 2.0.0
#r "nuget: eosnet, 2.0.0"
// Install eosnet as a Cake Addin #addin nuget:?package=eosnet&version=2.0.0 // Install eosnet as a Cake Tool #tool nuget:?package=eosnet&version=2.0.0
eosnet
An asynchronous, non-blocking, .net core implementation of the client for EOS blockchain (https://eos.io/). The library contains an RPC client as well as a wallet for managing keys and signing transactions.
Getting started
The library is available on NuGet
Install using Package Manager Console:
Install-Package eosnet
Examples
Create a wallet with private keys which will be responsible for signing transactions:
var wallet = new EosWallet(new []
{
"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3", // private key for myaccount111
"5KKXE5rsqQ1niB4hKTJkvBGJHgguFfta41vHLaWGR1jKXrG2BbL" // private key for myaccount222
});
Create a client for interaction with the blockchain. By default, client connects to a local EOS instance (nodeos) running on default host: http://localhost:8888
var client = new EosClient(wallet);
The node can be overridden in the constructor:
var client = new EosClient(new Uri("http://api.eosnewyork.io"), wallet);
The simplest way to trigger a smart contract is to push an action. Remember, there must be a private key in the wallet for an account(s) specified in the authorization section:
var transactionId = await client.PushActionsAsync(new []
{
new EOS.Client.Models.Action()
{
Account = "eosio.token",
Name = "transfer",
Authorization = new []
{
new Authorization
{
Actor = "myaccount111",
Permission = "active"
}
},
Data = new Dictionary<string, object>
{
{"from", "myaccount111"},
{"to", "someuserrrrr"},
{"quantity", "100.0000 EOS"},
{"memo", ""}
}
}
});
The code above will generate a transaction with default parameters and the specified action. To generate a custom transaction use PushTransactionAsync method:
var transactionId = await client.PushTransactionAsync(new Transaction
{
RefBlockNum = 11762412, // mandatory
RefBlockPrefix = 15881242, // mandatory
Expiration = DateTime.Parse("2018-08-20T13:13:13Z"), // mandatory
/* other optional parametrs */
Actions = new []
{
new EOS.Client.Models.Action()
{
Account = "eosio.token",
Name = "transfer",
Authorization = new []
{
new Authorization
{
Actor = "myaccount111",
Permission = "active"
}
},
Data = new Dictionary<string, object>
{
{"from", "myaccount111"},
{"to", "someuserrrrr"},
{"quantity", "100.0000 EOS"},
{"memo", ""}
}
}
}
});
Interaction with the blockchain:
// Get status of the blockchain
var chainInfo = await client.Api.GetInfoAsync();
// Get info about the account eosnewyorkio
var account = await client.Api.GetAccountAsync("eosnewyorkio");
// Get a concrete block using the block number or unique id
var block = await client.Api.GetBlockAsync("5485906");
// Get a balance of the everipedia token (IQ) for account eosnewyorkio
var balance = await client.Api.GetCurrencyBalanceAsync("everipediaiq", "eosnewyorkio", "IQ");
// Sending a transaction into the blockchain. The transaction must be signed using EosWallet
// or any other signature provider:
var res = await client.Api.PushTransactionAsync(signedTransaction);
All methods throw either HttpRequestException (if there were a network error) or HttpResponseException (if the node returned an unsuccessful result).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Cryptography.ECDSA.Secp256K1 (>= 1.1.2)
- Newtonsoft.Json (>= 11.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Implemented EosWallet for signing transactions. Implemented EosClient as a top-level abstraction over EosApi which provides more user-friendly way to deal with transactions.