Hornet apt repository (Linux-distro specific)

Hornet apt repository is maintained by the Hornet developers. It installs Hornet as a systemd service under a user called hornet.

Ubuntu/Debian

Import the public key that is used to sign the software release:

wget -qO - https://ppa.hornet.zone/pubkey.txt | sudo apt-key add -

Add the Hornet APT repository to your APT sources:

sudo sh -c 'echo "deb http://ppa.hornet.zone stable main" >> /etc/apt/sources.list.d/hornet.list'

Update apt package lists and install Hornet:

sudo apt update
sudo apt install hornet

Enable the systemd service:

sudo systemctl enable hornet.service

The Hornet configuration files are located under the /var/lib/hornet directory. See more details on how to configure Hornet under the post installation chapter.

Environment file to configure multiple default parameters are located under the /etc/default/hornet directory.

Start the node; use systemd service to start running Hornet on the Mainnet:

sudo service hornet start

Managing the node

Displaying log output:

journalctl -fu hornet
  • -f: instructs journalctl to continue displaying the log to stdout until CTRL+C is pressed
  • -u hornet: filter log output by user name

Restarting Hornet:

sudo systemctl restart hornet

Stopping Hornet:

sudo systemctl stop hornet

Please note: Hornet uses an in-memory cache, so it is necessary to provide a grace period while shutting it down (at least 200 seconds) in order to save all data to the underlying persistent storage.

See more details on how to configure Hornet under the post installation chapter.


Pre-built binaries

There are several pre-built binaries of Hornet for major platforms available including some default configuration JSON files.

This method is considered a bit advanced for production use since you have to usually prepare a system environment in order to run the given executable as a service (in a daemon mode) via systemd or supervisord.

Download the latest release compiled for your system from GitHub release assets, for ex:

curl -LO https://github.com/gohornet/hornet/releases/download/v0.6.0/HORNET-0.6.0_Linux_x86_64.tar.gz

Some navigation hints:

  • HORNET-X.Y.Z_Linux_x86_64.tar.gz: standard 64-bit-linux-based executable, such as Ubuntu, Debian, etc.
  • HORNET-X.Y.Z_Linux_arm64.tar.gz: executable for Raspberry Pi 4
  • HORNET-X.Y.Z_Windows_x86_64.zip: executable for Windows 10-64-bit-based systems
  • HORNET-X.Y.Z_macOS_x86_64.tar.gz: executable for macOS

Extract the files in a folder of your choice (for ex. /opt on Linux), for ex:

tar -xf HORNET-0.6.0_Linux_x86_64.tar.gz
  • Once extracted, you get a main executable file
  • There are also sample configuration JSON files available in the archive (tar or zip)

Run Hornet using --help to get all executable-related arguments:

./hornet --help

Also double check that you have version 0.6.0+ deployed:

./hornet --version

Run Hornet using default settings:

./hornet

Using this method, you have to make sure the executable runs in a daemon mode using for example systemd.

Please note: Hornet uses an in-memory cache, so it is necessary to provide a grace period while shutting it down (at least 200 seconds) in order to save all data to the underlying persistent storage.

See more details on how to configure Hornet under the post installation chapter.

Example of systemd unit file

Assuming the Hornet executable is extracted to /opt/hornet together with configuration files, please find the following example of a systemd unit file:

[Unit]
Description=Hornet
Wants=network-online.target
After=network-online.target

[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=hornet
PrivateDevices=yes
PrivateTmp=yes
ProtectSystem=full
ProtectHome=yes

User=hornet
WorkingDirectory=/opt/hornet
TimeoutSec=1200
Restart=always
ExecStart=/opt/hornet/hornet

[Install]
WantedBy=multi-user.target

Build from source

This method is considered a bit advanced for production use since you usually have to prepare a system environment in order to run the given executable as a service (in a daemon mode) via systemd or supervisord.

Install Go:

Install Go

Install dependencies: Git and build-essentials:

sudo apt update
sudo apt install git build-essential

Check the golang/git version:

go version
git --version

Make sure you have the latest version from https://golang.org/dl/

Clone the Hornet source code from GitHub:

git clone https://github.com/gohornet/hornet.git && cd hornet

Build the Hornet:

./build_hornet_rocksdb_builtin.sh
  • it builds Hornet based on the latest commit from main branch
  • it takes a couple of minutes

Once it is compiled, then the executable file named hornet should be available in the current directory:

./hornet --version

Example of version:

HORNET 0.6.0-31ad46bb
  • there is also short commit sha added to be sure what commit the given version is compiled against

Run Hornet using --help to get all executable-related arguments:

./hornet --help

Run Hornet using a default settings:

./hornet

Using this method, you have to make sure the executable runs in a daemon mode using for example systemd.

Please note: Hornet uses an in-memory cache, so it is necessary to provide a grace period while shutting it down (at least 200 seconds) in order to save all data to the underlying persistent storage.

See more details on how to configure Hornet under the post installation chapter.

Example of systemd unit file

Assuming the Hornet executable is extracted to /opt/hornet together with configuration files, please find the following example of a systemd unit file:

[Unit]
Description=Hornet
Wants=network-online.target
After=network-online.target

[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=hornet
PrivateDevices=yes
PrivateTmp=yes
ProtectSystem=full
ProtectHome=yes

User=hornet
WorkingDirectory=/opt/hornet
TimeoutSec=1200
Restart=always
ExecStart=/opt/hornet/hornet

[Install]
WantedBy=multi-user.target