Skip to content

Instantly share code, notes, and snippets.

@evias
Last active Sep 20, 2021
Embed
What would you like to do?
dHealth Network Node Install Guide

How to install Nodes for DHealth Network

1. Download all install scripts

$ cd ~
$ curl -fsSL https://yourdlt.tools/files/install-requirements.sh -o install-requirements.sh

Verify checksum for downloaded scripts

This section displays the sha-512 checksum of the files you just downloaded. This step, while optional, verifies that the downloaded package did not get compromised.

On MacOS using shasum

$ shasum -a 512 install-requirements.sh
03e2de50f91607dddea87af87c2d6a6826dc13e94b067266424e9e5cae28979571e63538703a0d5d0cd97b3400e8433ae7f5e1aaff344acaf1c19b37a214bc8b  install-requirements.sh

If you are using Windows, you will need the following command: certutil -hashfile [file-to-hash] sha512. If you are using Linux, you will need the following command: sha512sum [file-to-hash].

2. Install all requirements

When you successfully verified the downloaded scripts, go ahead and install required dependencies. The install-requirements.sh script installs the following software:

  • Node v14.x LTS
  • Docker latest (>= 19.x)
  • Docker Compose 1.27.4

Following command starts the installation process:

$ sh install-requirements.sh
$ sudo reboot

3. Check requirements install

$ node -v && docker -v && docker-compose -v
v14.16.0
Docker version 20.10.5, build 55c4c88
docker-compose version 1.27.4, build 40524192

$ docker run hello-world | grep "Hello from Docker!"
Hello from Docker!

4. Install yourdlt

$ npm i -g yourdlt
$ cd /opt/dhealth

5. Check yourdlt install

$ yourdlt -v
yourdlt/1.3.3 linux-x64 node-v14.16.0

6. Customize the node

You can customize your node with a custom preset configuration, let's for example touch /opt/dhealth/dual_config.yml.

Put the following in this configuration file we just created, and replaye your-awesome-node by the friendly name you want to set to your node:

nodes:
  -
    host: ''
    friendlyName: 'your-awesome-node'

If you already have a domain name DNS mapped to your server IP, you can specify it as the host of your node. This is optional and in case it is left empty, your node will be identified by its' IP address instead.

Other useful configuration items among others:

  • beneficiaryAddress: Define a beneficiary address which will receive parts of the harvested fees on the node.
  • mainPrivateKey: Caution here, please only use this option if you want to use a specific account for this node.
  • remotePrivateKey: Caution here, please only use this option if you already linked your main account to a specific remote account.
  • vrfPrivateKey: Caution here, please only use this option if you already linked your main account to a specific VRF account.
  • maxUnlockedAccounts: Define the number of harvesting slots that are available for remote harvesting.
  • enableDelegatedHarvestersAutoDetection: Define whether you want to allow persistent delegated harvesting.

7. Configure node

First we'll go ahead and customize your node.

Choose one of the assemblies:

Full node

This method configures a network node with roles Api,Peer,Voting.

⚠️ Please make sure to open the following ports on the VPS:

3000:3000 7900:7900

Harvesting prerequirement

  • The node's main account balance should be non-empty.
  • Harvesting only begins a max. of 720 blocks after the link is confirmed on the network.
  • The node's main account must be linked with a remote, vrf and voting key. This should be done after configuring the node, as indicated below.

Configure the node

  • First configure a dual-node folder to contain your node's files:
$ yourdlt config -p dhealth -t dual-node -a dual -c dual_config.yml
  • Second, create docker-compose files for your node:
$ yourdlt compose -t dual-node -c dual_config.yml

You can decrypt the generated addresses using yourdlt decrypt --source dual-node/addresses.yml --destination dual-node/addresses.plain.yml

⚠️ If you decrypt your addresses file, please make sure to remove the plain text copy once consumed.

If you want to configure a friendly name, host or harvester and voting keys, you must create a config.yml and pass it as a custom preset to yourdlt. An example configuration file for dual-node can be downloaded using the following command:

$ curl -fsSL https://yourdlt.tools/files/custom_config_dual.yml -o /opt/dhealth/dual_config.yml

See also Custom configuration preset

Link your node accounts for dual-node

  • You must now link your account so that harvesting can be activated:

⚠️ Do not forget to fund the main account before executing the following command.

$ yourdlt link -t dual-node --url http://dual-01.dhealth.cloud:3000 --maxFee=100000

Backup ephemeral voting keys

Because voting keys for nodes are ephemeral, it is important to create a backup of those when you have successfully configured your node and linked accounts. In the following example, we use zip to password encrypt the voting keys folder and compress it to an archive:

$ sudo apt install zip
$ zip -er votingkeys.zip dual-node/dhealth-full-node/votingkeys

⚠️ Do not share the resulting archive with anyone and place this file on a secure encrypted drive.

Startup the node

  • Then, startup the node:
$ yourdlt run -t dual-node -d

You can shutdown your node with yourdlt stop -t dual-node

API node

This method configures a network node with roles Api.

⚠️ Please make sure to open the following ports on the VPS:

3000:3000 7900:7900

Configure the node

  • First configure a api-node folder to contain your node's files:
$ yourdlt config -p dhealth -t api-node -a api -c api_config.yml
  • Second, create docker-compose files for your node:
$ yourdlt compose -t api-node -c api_config.yml

You can decrypt the generated addresses using yourdlt decrypt --source api-node/addresses.yml --destination api-node/addresses.plain.yml

⚠️ If you decrypt your addresses file, please make sure to remove the plain text copy once consumed.

If you want to configure a friendly name, host or harvester and voting keys, you must create a config.yml and pass it as a custom preset to yourdlt. An example configuration file for api-node can be downloaded using the following command:

$ curl -fsSL https://yourdlt.tools/files/custom_config_api.yml -o /opt/dhealth/api_config.yml

See also Custom configuration preset

Startup the node

  • Then, startup the node:
$ yourdlt run -t api-node -d

You can shutdown your node with yourdlt stop -t api-node

Peer node

This method configures a network node with roles Peer.

⚠️ Please make sure to open the following ports on the VPS:

7900:7900

Harvesting prerequirement

  • The node's main account balance should be non-empty.
  • The node's main account must be linked with a remote, vrf and voting key (see Link your node accounts).
  • Harvesting only begins a max. of 720 blocks after the link is confirmed on the network.

Configure the node

  • First configure a peer-node folder to contain your node's files:
$ yourdlt config -p dhealth -t peer-node -a peer -c peer_config.yml
  • Second, create docker-compose files for your node:
$ yourdlt compose -t peer-node -c peer_config.yml

You can decrypt the generated addresses using yourdlt decrypt --source peer-node/addresses.yml --destination peer-node/addresses.plain.yml

⚠️ If you decrypt your addresses file, please make sure to remove the plain text copy once consumed.

If you want to configure a friendly name, host or harvester and voting keys, you must create a config.yml and pass it as a custom preset to yourdlt. An example configuration file for peer-node can be downloaded using the following command:

$ curl -fsSL https://yourdlt.tools/files/custom_config_peer.yml -o /opt/dhealth/peer_config.yml

See also Custom configuration preset

Link your node accounts for peer-node

  • You must now link your account so that harvesting can be activated:

⚠️ Do not forget to fund the main account before executing the following command.

$ yourdlt link -t peer-node --url http://dual-01.dhealth.cloud:3000 --maxFee=100000

Startup the node

  • Then, startup the node:
$ yourdlt run -t peer-node -d

You can shutdown your node with yourdlt stop -t peer-node

Voter node

This method configures a network node with roles Voting.

⚠️ Please make sure to open the following ports on the VPS:

7900:7900

Harvesting prerequirement

  • The node's main account balance should be non-empty.
  • The node's main account must be linked with a remote, vrf and voting key (see Link your node accounts).
  • Harvesting only begins a max. of 720 blocks after the link is confirmed on the network.

Configure the node

  • First configure a voter-node folder to contain your node's files:
$ yourdlt config -p dhealth -t voter-node -a voter -c voter_config.yml
  • Second, create docker-compose files for your node:
$ yourdlt compose -t voter-node -c voter_config.yml

You can decrypt the generated addresses using yourdlt decrypt --source voter-node/addresses.yml --destination voter-node/addresses.plain.yml

⚠️ If you decrypt your addresses file, please make sure to remove the plain text copy once consumed.

If you want to configure a friendly name, host or harvester and voting keys, you must create a config.yml and pass it as a custom preset to yourdlt. An example configuration file for voter-node can be downloaded using the following command:

$ curl -fsSL https://yourdlt.tools/files/custom_config_voter.yml -o /opt/dhealth/voter_config.yml

See also Custom configuration preset

Link your node accounts for voter-node

  • You must now link your account so that harvesting can be activated:

⚠️ Do not forget to fund the main account before executing the following command.

$ yourdlt link -t voter-node --url http://dual-01.dhealth.cloud:3000 --maxFee=100000

Backup ephemeral voting keys

Because voting keys for nodes are ephemeral, it is important to create a backup of those when you have successfully configured your node and linked accounts. In the following example, we use zip to password encrypt the voting keys folder and compress it to an archive:

$ sudo apt install zip
$ zip -er votingkeys.zip dual-node/dhealth-voter-node/votingkeys

⚠️ Do not share the resulting archive with anyone and place this file on a secure encrypted drive.

Startup the node

  • Then, startup the node:
$ yourdlt run -t voter-node -d

You can shutdown your node with yourdlt stop -t voter-node

Relay

This method configures a network node with roles Api.

This method also configures and deploys a web wallet on port 80 and a web explorer on port 90.

⚠️ Please make sure to open the following ports on the VPS:

3000:3000 7900:7900 80:80 90:90

Configure the node

  • First configure a relay-node folder to contain your node's files:
$ yourdlt config -p dhealth -t relay-node -a relay -c relay_config.yml
  • Second, create docker-compose files for your node:
$ yourdlt compose -t relay-node -c relay_config.yml

Startup the node

  • Then, startup the node:
$ yourdlt run -t relay-node -d

You can shutdown your node with yourdlt stop -t relay-node

HTTPS

You can enable HTTPS for your node by using our https-portal image. It is very straight forward. Following commands are to be executed:

$ cd /opt/dhealth
$ curl -fsSL https://yourdlt.tools/files/https-portal.zip -o https-portal.zip
$ unzip https-portal.zip && rm -f https-portal.zip
  • Now open the file docker-compose file with vim https-portal/docker-compose.yml.
  • And edit the dual-01.dhealth.dev domain name for your registered domain name.
  • Save and exit the editor.

⚠️ DNS Ready: You must make sure that the IP of your server is correctly mapped to the specified domain name.

⚠️ HTTP(S) Ports: You must open ports 80, 443 and 3001 on your server such that they are at least accessible internally.

Our https-portal uses letsencrypt self-signed certificates and will request your server on port 80 to perform verification.

  • Once your DNS changes are propagated and after opening ports, you can now run the https-portal with the following command:
$ docker-compose -f /opt/dhealth/https-portal/docker-compose.yml up -d

Examples

Custom configuration preset

With a custom preset file, using yourdlt you can specify several node-specific configuration settings for the underlying Symbol from NEM node software. Following file is an example custom preset for a peer-node or a dual-node:

nodes:
  -
    host: ''
    friendlyName: 'your-awesome-node'
    maxUnlockedAccounts: 40
    enableDelegatedHarvestersAutoDetection: true
    enableAutoHarvesting: true
    beneficiaryAddress: INPUT_HERE
    mainPrivateKey: INPUT_HERE

For an api-node, the custom configuration can be kept minimal as shows the following:

nodes:
  -
    host: ''
    friendlyName: 'your-awesome-node'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment