eosnet 2.0.1

A .NET Standard implementation of the client for EOS blockchain (https://eos.io/).

Install-Package eosnet -Version 2.0.1
dotnet add package eosnet --version 2.0.1
<PackageReference Include="eosnet" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add eosnet --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: eosnet, 2.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install eosnet as a Cake Addin
#addin nuget:?package=eosnet&version=2.0.1

// Install eosnet as a Cake Tool
#tool nuget:?package=eosnet&version=2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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.

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).

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.

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).

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.1 713 9/9/2018
2.0.0 512 9/3/2018
1.0.0 501 7/15/2018