Skip to main content

Install full node from source code

Goal

This article will guide you to install Hathor core from source code.

Hathor core is the official and reference client for operating a full node in Hathor Network.

tip

Installing from source code is recommended only for the development of Hathor core, derived Hathor clients, or blueprints. For production environments or for developing and testing other components, it is recommended to install the full node alone via Docker or together with the headless wallet using Docker Compose.

Requirements

Requirements for operating Hathor core.

Hardware

For production environment:

  • CPU: 2 vCPU
  • Memory: 16 GB
  • Disk: 20 GB
  • Bandwidth: 10 Gbps

Reference machine: AWS EC2 type r6g.large.

Software

  • Platform: Linux, macOS, or WSL
  • Python v3.10

Environment

This article was created using the following environments:

Environment 1:

  • Ubuntu 22.04.04 LTS
  • Python v3.10.12
  • RocksDB v6.11.4-3
  • Poetry v1.8.3

Environment 2:

  • macOS 10.15.7
  • Python v3.10.14
  • RocksDB v9.4.0
  • Poetry v1.8.3

Different environments may require different steps, or may not work at all.

Step-by-step

  1. Download source code.
  2. Install dependencies.
  3. Start the application.

Step 1: download source code

  1. Start a shell session.
  2. Change the working directory to where you want to store the application — namely, source code and database.
  3. Create the data directory, to store the application database (mainly the blockchain).
  4. Download the latest release of Hathor core:
git clone -b release https://github.com/HathorNetwork/hathor-core.git

Step 2: install dependencies

  1. Install system dependencies:
sudo apt install build-essential python3.10-dev pkg-config libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev librocksdb-dev
  1. Install Poetry with the official installer:
curl -sSL https://install.python-poetry.org | python3 -
  1. Add export PATH="/home/ubuntu/.local/bin:$PATH" to your shell configuration file.

  2. Change the working directory (the one you chose to store the application) to its child hathor-core:

cd hathor-core
  1. Check if Poetry's current virtual environment is using Python v3.10:
poetry env info
  1. (Optional) If Poetry's current virtual environment isn't using the correct version of Python, create and activate the correct virtual environment:
poetry env use python3.10
  1. Install the application dependencies (Python packages):
poetry install
info
Installation in Ubuntu 24 LTS

As of August 13, 2024, if you attempt to follow this guide using Ubuntu 24 LTS, the poetry install command will return an error when installing the RocksDB dependency. To work around this error, you will need to compile RocksDB from source code by following the steps in the RocksDB installation guide on GitHub:

  1. Download RocksDB source code:
git clone -b 9.3.fb https://github.com/facebook/rocksdb.git
  1. Change to RocksDB source code directory:
cd rocksdb
  1. Compile RocksDB:
make shared_lib
  1. Install RocksDB:
make install-shared
  1. Proceed with the usual installation process.

Step 3: start the application

Start the application:

poetry run hathor-cli run_node --testnet --wallet-index --status 8080 --data ../data

Your Hathor full node will connect to other peers of Hathor Network testnet and will start syncing its database with theirs — i.e., all blocks and transactions ever recorded in Hathor blockchain testnet.

Task completed

In the browser, you can use the URL http://localhost:8080/v1a/status/ to monitor the status of your full node.

You now have a running instance of Hathor full node in Hathor Network testnet, that will listen to API requests at port 8080. Note that your full node cannot receive API requests or participate in network consensus while it is not synced with its peers. Syncing is an ongoing process that is part of the operations of a full node. However, reaching synchronization with Hathor Network starting from an empty database (from genesis block) takes on average 10 hours for testnet and 24 hours for mainnet. If you want to expedite this process, see How to bootstrap from a snapshot.

Finally, here we used the minimal configuration to have an operational full node. For a custom setup, see Hathor full node configuration.

What's next?