Netezos is a package of .NET Standard 2.0 libraries for working with Tezos. At this stage, Netezos.Rpc and Netezos.Keys are implemented. Let’s dive a little deeper and see how it works.

Installation

Netezos.Rpc and Netezos.Keys packages are available on NuGet, a package manager for .NET developers. Thus, you can install the packages via the Nuget Package Manager graphical interface or the following command:

PM> Install-Package Netezos.Keys

Or just clone the project from our GitHub repository:

Let’s get it started!

To get started, we need an account with funds. There are two ways to do this: to activate a new account from a JSON file, or a much simpler way to get money from the Faucet Telegram Bot. Let’s consider both of them.

Using faucet bot

Let’s generate a new key and get test coins from the telegram bot:

NOTE: Save secret key and tz address, we’ll need them in the next step.

Let’s go to the Faucet Bot and get some test coins. You can use the 🤑 Get coins option to deposit 100 ꜩ to your tz address, or ➕ Add subscription and set Amount to ensure your balance is always non-zero.

Activation via JSON

First of all, let’s download a JSON file from https://faucet.tzalpha.net/ and parse the data:

We can use that to extract the private key:

This is the most frequent use case, but you have multiple options though:

Note: Currently we support ed25519 and secp256k1 curves.

Now, that we have received the key, we can activate the account. We will use Netezos.Rpc package for that purpose. Read all about it in this blogpost.

Account activation

Let’s create a content list for our future operation. The pkh and secret fields are taken from the downloaded JSON file:

Then let’s create an RPC object and get the required data from the chain:

Once we get operation bytes we can sign them with our key and broadcast to the network:

Public key revelation

After successful account activation, we will perform the reveal operation.

First, one has to get a fresh counter value and public key hash to build an operation content:

Next steps are similar to the activation operation:

Transaction

And finally, we can make a transaction.

Preparing an operation content first:

Taking forge-sign-inject steps:

That’s it! Local forging and automatic content fill will be implemented and documented a bit later, so stay tuned.

We would also like to remind you that Netezos is an open-developing project, and any kind of contribution is highly appreciated!

Cheers!

Originally published at https://baking-bad.org on November 14, 2019, where you can find full version of the article.