Creating an AVADO package

Stefaan Ponnet
AVADO Blockchain Computer
7 min readDec 17, 2019

The recent announcement that Parity will stop support for their Ethereum client shows the importance of continually investing in alternatives. So we built a package that runs the Nethermind Ethereum client.

We also decided to show you all the steps involved, so if you want to dive in and create your own AVADO package, this can be your guide to get started!

(If you already know AVADO — feel free to skip the introduction and go straight to ‘Getting started’)

Background

AVADO is the easiest hardware device that you can buy to run your own blockchain node at home and to contribute to the decentralized internet. It is a plug-and-play solution that is simple to set up and maintain. It allows you to run a whole range of pre-configured software (like an Ethereum node, a Bitcoin node, the new Ethereum Beacon chain and much more) without going through all the hassle of figuring out how to set it up.

Furthermore, these software packages are offered in a DappStore from within the Administration UI of the AVADO. They are maintained and upgraded by the AVADO team so you don’t have to worry about this.

View of the AVADO DappStore with the new Ethereum Nethermind package

More info on our mission and our different products is available on our website https://ava.do/

Getting started

We will show you the different steps required to build an AVADO package. As an example, we’re going to explain how we wrapped the Nethermind Ethereum client into a new AVADO package.

Download tools

To get started building an AVADO package— install the following tools on your local machine

  1. Docker CE (https://www.docker.com/products/container-runtime)
  2. nodeJS, providing npm (https://nodejs.org/en/download/)
  3. Install this version of the DappNode SDK
    $npm install -g @dappnode/dappnodesdk@0.1.16

Prepare folders

Create a folder for the package.

$mkdir AVADO-DNP-Nethermind
$cd AVADO-DNP-Nethermind

Create a package structure

Some information you’ll need beforehand:

  • What external ports need to be mapped to your package? Most of the time P2P clients need to have one or more external ports opened for other peers to connect. Each external port can only be used/mapped once on your AVADO box - so make sure to use ports that are unique to the package. There is no current way of knowing free ports, just choose one that you believe to be free.
  • From the Nethermind documentation, we know that ports 30303/tcp and udp need to be mapped. Since they might overlap with ports of other running Ethereum or P2P clients, we will move these ports to 30403 in the Nethermind configuration file.
  • Your package will also need storage, so we choose to create a volume called data and map it to the local folder /nethermind/nethermind_db in our Docker container. We’ll fill that in below.

Now it’s time to initialize our package.

$dappnodesdk init

Fill out the fields as required:

? DAppNodePackage name (AVADO-DNP-Nethermind) 
? Version (0.0.1)
? Description AVADO Nethermind Ethereum Client
? Avatar avatar.png
? Type (Use arrow keys)
❯ service
library
dncore
? Author (sponnet)
? Ports to expose externally (eg: 31313:30303;31313:30303/udp ) 30303:30303;30303:30303/udp
? Volumes to be persistent (eg: ipfsdnpdappnodeeth_export:/export;/home/ipfs_data:/data/ipfs) data:/nethermind/nethermind_db
? Keywords (tags) separated by semicolons (eg: "DAppNodeCore;IPFS" ) Nethermind

OK - we now have set up the base structure of the AVADO package.

Give the package a try

You can already build the package for AVADO and test it.

First, connect to your AVADO box using the VPN or WiFi - it will need its IPFS server to upload the package image and manifest files.

$dappnodesdk buildBuilding Dockerfile to image avado-dnp-nethermind.public.dappnode.eth:0.0.1...
Building avado-dnp-nethermind.public.dappnode.eth
Step 1/3 : FROM alpine
---> 961769676411
Step 2/3 : WORKDIR /usr/src/app
---> Running in 81ad4dfebf06
Removing intermediate container 81ad4dfebf06
---> bca38881aec2
Step 3/3 : CMD [ "echo", "happy buidl" ]
---> Running in aa17c66aa7af
Removing intermediate container aa17c66aa7af
---> cbe712a4a42b

Successfully built cbe712a4a42b
Successfully tagged avado-dnp-nethermind.public.dappnode.eth:0.0.1
Saving docker image avado-dnp-nethermind.public.dappnode.eth:0.0.1 to file .//build_0.0.1/avado-dnp-nethermind.public.dappnode.eth_0.0.1.tar.xz...
100 % 2198.3 KiB / 5722.0 KiB = 0.384 1.8 MiB/s 0:03
Uploading docker image file .//build_0.0.1/avado-dnp-nethermind.public.dappnode.eth_0.0.1.tar.xz to IPFS...
Uploading... 11.65%
Uploading... 23.29%
Uploading... 34.94%
Uploading... 46.58%
Uploading... 58.23%
Uploading... 69.87%
Uploading... 81.52%
Uploading... 93.16%
Uploading... 100.00%
Manifest uploaded: /ipfs/QmQmrgz7CTXtpbWA72H5apcPLrySG69zmLXofh6Sha5H7y

Go to your AVADO’s DappStore (http://my.avado/#/installer)
and fill in the above IPFS hash.

Click search to see the package details and meta-data.

Now that the basic framework is created — let’s continue!

Create an avatar

Now it’s time to create and upload an AVATAR

Create a square png image of about 600x600 pixels and save it as avatar.png in your package’s folder and upload it to IPFS because you will need its IPFS hash later.
This can be done using the command:

$ipfs add avatar.png --api /ip4/23.254.227.151/tcp/5001

added QmX3oD2BQDmi4fqaKnJCZjjvpK6vavfDo5nQshrWnrzUua avatar.png

Take note of the resulting IPFS hash. you’ll need it in the next step.

Note that the provider option will use an external server (hosted by AVADO) as an entry point for your IPFS upload. Don’t worry about ‘centralization’ since everybody looking at & using your package will become a host for that same data, but you need an initial place to seed the data from. So this is a good place to start.

Add the AVATAR image hash to the dappnode_package.json

"description": "AVADO Nethermind Ethereum Client",
"avatar": "QmWEkTQMVmo5J1bRfeyoQfRHhJ8PutWF8DncH6CsrSrVfT",
"type": "service",
...

Great! Let’s add the software to the package now.

Configure the software

Gathering info

A look at the Nethermind documentation shows us that they already have a docker image with the software.

In the GitHub, we can also see some sample configs we can use.

Since other Ethereum packages on your AVADO might be already be using the port 30303 to map to the outside world, we’re going to modify the default config file so that it maps to another port.

So we take the config mainnet.cfg, put it in build/files/mainnet-avado.cfg and modify the ports:

...
"Network": {
"DiscoveryPort": 30403,
"P2PPort": 30403,
"ActivePeersMaxCount": 50
},
...

Use this info to build a custom Dockerfile

Now it’s time to modify the Dockerfile. So we go to our packages’ build directory and change it to:

FROM nethermind/nethermind

COPY files/mainnet-avado.cfg /nethermind/configs/mainnet.cfg

We also put the modified config in build/files

The folder structure now looks like this:

avatar.png		build/			dappnode_package.json	docker-compose.yml

./build:
Dockerfile files/

./build/files:
mainnet-avado.cfg

Test the image locally

We can now build and run the container to see if it works.

docker-compose build && docker-compose up

This results in our package starting as expected:

avado-dnp-nethermind.public.dappnode.eth_1  | Redirecting config /nethermind/mainnet.cfg to /nethermind/configs/mainnet.cfg
avado-dnp-nethermind.public.dappnode.eth_1 | Reading config file from /nethermind/configs/mainnet.cfg
avado-dnp-nethermind.public.dappnode.eth_1 | 2019-12-17 11:19:53.7014|Nethermind config:
avado-dnp-nethermind.public.dappnode.eth_1 | {
avado-dnp-nethermind.public.dappnode.eth_1 | "enableUnsecuredDevWallet": false,
avado-dnp-nethermind.public.dappnode.eth_1 | "keepDevWalletInMemory": false,
avado-dnp-nethermind.public.dappnode.eth_1 | "webSocketsEnabled": false,
avado-dnp-nethermind.public.dappnode.eth_1 | "discoveryEnabled": true,
avado-dnp-nethermind.public.dappnode.eth_1 | "synchronizationEnabled": true,
avado-dnp-nethermind.public.dappnode.eth_1 | "processingEnabled": true,
avado-dnp-nethermind.public.dappnode.eth_1 | "peerManagerEnabled": true,
avado-dnp-nethermind.public.dappnode.eth_1 | "isMining": false,
avado-dnp-nethermind.public.dappnode.eth_1 | "chainSpecPath": "chainspec/foundation.json",
avado-dnp-nethermind.public.dappnode.eth_1 | "chainSpecFormat": "chainspec",
avado-dnp-nethermind.public.dappnode.eth_1 | "baseDbPath": "nethermind_db/mainnet",
avado-dnp-nethermind.public.dappnode.eth_1 | "logFileName": "mainnet.logs.txt",
avado-dnp-nethermind.public.dappnode.eth_1 | "genesisHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
avado-dnp-nethermind.public.dappnode.eth_1 | "staticNodesPath": "Data/static-nodes.json",
avado-dnp-nethermind.public.dappnode.eth_1 | "storeTraces": false,
avado-dnp-nethermind.public.dappnode.eth_1 | "storeReceipts": true,
avado-dnp-nethermind.public.dappnode.eth_1 | "useMemDb": false
avado-dnp-nethermind.public.dappnode.eth_1 | }
avado-dnp-nethermind.public.dappnode.eth_1 | |
avado-dnp-nethermind.public.dappnode.eth_1 | 2019-12-17 11:19:53.7205|Monitoring is disabled|
avado-dnp-nethermind.public.dappnode.eth_1 | 2019-12-17 11:19:53.8079|Using http://checkip.amazonaws.com to get external ip|
...

Looking good, it already “works on my computer” TM!

Finish up and deploy on your AVADO

It’s time to build a release version of your AVADO package. This will create an IPFS hash that can be shared with other AVADO users.

$dappnodesdk build...
...
Uploading... 99.53%
Uploading... 99.79%
Uploading... 100.00%
Manifest uploaded: /ipfs/QmT78UyhYCUGyRqfdhBUiJ1GQWCLtXfNAjitpBojZjTqgA

Go to the DappStore and fill in the above hash:

Click search to show the full details of your new package:

Install the package, and proceed to manage package:

Nice! It seems to be running, showing the correct port-mappings and confirming that it’s storing its data on the allocated volume - data will not be lost when restarting the package or the AVADO box.

Finally — let’s take a look at the logs:

Perfect — our Nethermind node on AVADO is syncing. Congratulations!

Share with friends

You can now share this package with your friends just by giving them the IPFS hash. You don’t need to ask permission to anyone to use and distribute your package.

Share with the AVADO community

However, if you want to make your package available to all AVADO users, we can also add it to the AVADO DappStore. Give us a yell in our telegram channel and we would be happy to help you!

About AVADO:
AVADO provides dedicated Hardware to run your own node. A plug-and-play solution that is easy to set up and maintain. Producing the best hardware, user experience & support for running a node at home.
We are proudly based in the Cryptovalley — Switzerland.

If you are interested in our hardware platform — go to our website https://ava.do/shop/ and follow us on twitter.

--

--