Blocknet Decentralized Full Node Services Are Coming to EOS

The Blocknet Protocol
6 min readJan 15, 2020

--

At Blocknet, an interoperability and inter-chain communication protocol, we are staging to bring fully decentralized blockchain services to the EOS ecosystem. Through our decentralized network of Service Nodes spread across the world — consumers, developers, and organizations alike will be able to leverage access to EOS full-node services in a fully decentralized fashion over Blocknet’s XRouter product, allowing them to reduce and/or remove the many risks and burdens that come along with centralized service providers and systems.

If you would like to find out more about this technology (including testing and building on our services), please feel free to visit blocknet.co and stop by the Blocknet Discord server to get in touch with us:

EOS Setup Guide For Blocknet Service Nodes

The following guide will help get Blocknet Service Nodes staged to support EOS services on the Blocknet Protocol. We recommend setting up EOS in a Docker container, but Service Node operators can leverage whatever environment they’re most comfortable with in order to get a full trace-history and state-history EOS node in sync.

In this guide, we’ll cover getting nodeos (core EOS node daemon) running in a Docker container based on our official Blocknet Docker Image, getting nodeos setup and built from source utilizing an install script, and also getting nodeos setup using the .deb files from the EOSIO Github. Due to how EOS is built, do not run nodeos directly in a Windows environment (PowerShell, WSL, etc.)! The program isn't designed to run on these and you will run into various problems including port releasing issues that lead to all ports being consumed over a short period of time. It is recommended you run nodeos on a Linux VM (if using Windows) or Linux machine - these guides will be based on Ubuntu 18.04.

Things to Note

  • nodeos is single-threaded. This means having a multi-core server won't necessarily speed up your sync speed by any means. Over months of testing, we've found solid, high-clock processors to sync the fastest... so if you're syncing on a 1.8 GHz server, don't be alarmed if it's syncing much slower than a 4.0 GHz i7.
  • SSDs are required! The EOS blockchain has 2 blocks coming in per second (with numerous transactions per block) — do not try to sync the chain on an HDD!
  • Syncing EOS takes a very long time. Even on high-end machines you can expect to get EOS synced in anywhere from 45 to 60 days … patience is certainly required!
  • EOS in its current form is EXTREMELY fragile… we can’t emphasize this enough. Any sort of ungraceful shutdown will result in a total block database corruption (database dirty flag) requiring a full blockchain replay where replaying the blockchain takes almost the same amount of time as syncing it from scratch. You’ll want to make routine backups while syncing (every 2–4 days is recommended) just in case something goes wrong and you need to rollback your sync. Even once synced we recommended making backups of the same frequency for the same reasons. A full-sized backup takes about 3 hours or so, depending on the disks involved on either end, which is much better than losing 2 weeks to a month’s worth of sync progress if something goes wrong and you don’t have any backups.
  • EOS is quite large and is currently about 2.5 TB so plan accordingly (don’t forget about backups!)

Docker Setup Guide

If you don’t have Docker installed, there are various guides you can follow including this one here.

Staging

It is recommended that you leverage the docker -v functionality for your EOS container unless you wish to store all blockchain data in the default Docker volume location found at /var/lib/docker/volumes on the host machine. If you don't plan on using docker -v, skip to the Setup section, Step 2.a

Step 1

Choose a location you plan on using for your nodeos volume. For this example we'll use /opt/eos

Step 2

Create the directories needed for your config files and enter said directory:

  • mkdir -p /opt/eos/nodeos/config
  • cd /opt/eos/nodeos/config

Step 3

Create your config.ini, logging.json (logging.json is optional), and genesis.json files and save them in the current /opt/eos/nodeos/config directory.

config.ini

config.ini

logging.json

logging.json

genesis.json

genesis.json

Done!

Setup

Now that you’re staged, we’ll run the Docker container.

Step 1

Pull the official Blocknet EOS image:

  • docker pull blocknetdx/eos

Step 2

Run your container:

  • docker run -d -p 9876:9876 -p 8888:8888 -p 8080:8080 -v /opt/eos/:/root/.local/share/eosio/ --name eos blocknetdx/eos

Step 2.a (only for non docker -v setups)

  • docker run -d -p 9876:9876 -p 8888:8888 -p 8080:8080 --name eos blocknetdx/eos

In the above case, data from the container’s /root/.local/share/eosio directory will persist to the host machine's default /var/lib/docker/volumes directory.

Done!

if you run into permission denied issues related to leveraging docker -v, please research chown such as chown -R 1000:1000 /opt/eos

Controlling Your nodeos Container

The docker run command from the Setup section is used to first run and start your container. After this, you'll be leveraging the docker attach, docker stop, and docker start commands.

To gracefully shutdown nodeos running in your container, follow these steps:

Step 1

Enter your container

  • docker attach eos

Step 2

Gracefully shutdown nodeos

  • ctrl+c or
  • pkill --signal SIGINT nodeos

Done!

After nodeos shuts down, you should automatically exit the container. If for some reason you do not, make sure nodeos is indeed shutdown by checking top. When you confirm nodeos is shut down, you can then proceed to type and enter exit to exit the container and subsequently stop it with docker stop eos.

Warning: Stopping a container with nodeos actively running in it will lead to a corrupted block database requiring a replay!

Starting, Entering, and Exiting the Container

  • To start the container: docker start eos
  • To enter the container: docker attach eos
  • To exit the container and keep it running: ctrl+p+q

Building nodeos From Source

The following script will install all required dependencies, build and install nodeos, and generate the required config files.

Step 1

Create a eos.sh file and paste the following into it and save the file:

eos.sh

Step 2

Run the script

  • chmod +x eos.sh
  • ./eos.sh

Done!

Starting nodeos

The nodeos default data directory can be found at ~/.local/share/eosio

To start nodeos, navigate to where it was built:

  • cd ~/eosio/2.0/bin

And start it with:

  • ./nodeos --disable-replay-opts

Stopping nodeos

This is VERY important!

Stopping nodeos gracefully is required to avoid database corruption requiring a lengthy replay process.

Things that can cause ungraceful shutdowns:

  • Power outages/machine shutdowns while nodeos is running
  • Closing out the active terminal without nodeos properly running as a background process
  • Issuing any sort of SIGKILL command to the process

To stop nodeos gracefully, you must issue a SIGINT to the process, for example:

  • ctrl+c to the active terminal where the process and subsequent logs are running
  • If nodeos is running in the background, you can stop it gracefully with pkill --signal SIGINT nodeos
  • Make sure the process stops after issuing the commands! (you can check this with top or verifying ctrl+c brings you back to the command line after seeing nodeos successfully exiting.

.deb Install Setup

EOS provides a .deb package for install. To install the .deb, follow these steps:

Step 1

Download the .deb from the EOS Github:

Step 2

Install the package

Done!

To run nodeos with the .deb installed, use the same functionality you would above in the Non-Docker Install Script Setup section except you can run nodeos anywhere you please as follows:

  • nodeos --disable-replay-opts

The default data directory will be the same: ~/.local/share/eosio/

Gist version of guide: EOS Setup Guide

--

--

The Blocknet Protocol
The Blocknet Protocol

Written by The Blocknet Protocol

Blocknet is a 2nd layer blockchain interoperability protocol that enables communication, interaction & exchange between different blockchains.

Responses (1)