How to setup Devnet with HTLC branch and Setup Zenon Cli for .NET on Ubuntu 22.04

Installation Instructions

The instructions below are for setting up a devnet with the HTLC branch merged. In addition, we setup the Zenon SDK for .NET.

Video Tutorial with Copy / Paste commands below

Required Software

Git

We will need git to interact wth the GitHub repositories. Execute the following command in a Terminal.

sudo apt install git

Golang

We will need Go to to compile the go-zenon code. Execute the following command in Terminal.

sudo apt install golang-go

Install DotNet SDK

The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don’t need to install the corresponding runtime. To install the .NET SDK, run the following commands in the Terminal:

sudo apt-get update && sudo apt-get install -y dotnet6

Install Make

sudo apt install make

GCC compiler

We need a gcc compiler to compile the go-zenon code. Check to make sure gcc is installed.

gcc --version

You should see something like the following in Ubuntu 22.04

gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If gcc is not installed run the following command

sudo apt install gcc

Configuration

After installing all the above tools make sure you close and open a new Bash Shell.

To use git we need to configure an user. Use you GitHub account if you have one; otherwise you can use anything you like.

git config --global user.email [your e-mail]
git config --global user.name [your name]

Compilation

We will make a repos directory under the current userprofile to store all our work. Replace the path if you want it stored on a different location.

cd ~/
mkdir repos
cd repos

BICH go-zenon

Create a clone of the devnet branch of the Big Inches Club House go-zenon repository.

git clone -b devnet https://github.com/Big-Inches-Club-House/go-zenon.git

Change directory to the go-zenon directory.

cd go-zenon

Merge the htlc branch with the devnet branch.

git merge origin/htlc

Compile the go-zenon code.

make znnd

Configure and run a devnet node.

./build/znnd --data ./devnet generate-devnet --genesis-block=z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7,40000,400000
./build/znnd --data ./devnet

Keep the shell open during the duration of this tutorial. It is now possible to connect the Zenon Explorer to the node.

Open a web browser and go to https://explorer.zenon.network and connect the Zenon Explorer to http://127.0.0.1:35997

Search for the address z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7

Try the Firefox browser if the Zenon Explorer does not want to connect. Google Chrome can throw a mixed content error when connecting to an insecure destination

znn-cli-csharp

Open a new Bash Shell and change directory to repos.

cd ~/repos

Create a clone of the htlc branch of the KingGorrin znn-cli-csharp repository.

git clone -b htlc https://github.com/KingGorrin/znn_cli_csharp.git

Change directory to the znn_cli_csharp directory.

cd znn_cli_csharp

Compile the znn_cli_csharp code

dotnet build --runtime linux-x64 src/ZenonCli/ZenonCli.csproj

Change directory to the binaries directory.

cd ~/repos/znn_cli_csharp/bin/ZenonCli/net6.0/linux-x64

HTLC Scenario 1 - Alice buys something from Bob

3 Likes

Great job 0x,

I hope you don’t mind if I integrate this in the tutorial. Better to have both installation instructions for Windows and Linux in one place.

1 Like

yes, that was the hope!

Just updated the instructions in the repository.

2 Likes

What?

Add support for the following Embedded Contracts

  • Spork Contract
  • Hashed Timelocked Contract

Why?

As of go-version v0.0.4 the Embedded Hashed Timelock Contract has been added and activated at Momentum Height 4188199.

The CLI needs to support the contracts to be able to interact with it.

How?

By implementing new CLI commands for Spork and Htlc interaction.

2 Likes

Added a build and release workflow to the Zenon CLI for .NET repository for Windows, macOS and Linux.

Thank you @aliencoder for doing some of the groundwork.

2 Likes