Install core (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.
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
- Download source code.
- Install dependencies.
- Start the application.
Step 1: download source code
- Start a shell session.
- Change the working directory to where you want to store the application — namely, source code and database.
- Create the
data
directory, to store the application database (mainly the blockchain). - Download the latest release of Hathor core:
git clone -b release https://github.com/HathorNetwork/hathor-core.git
Step 2: install dependencies
- Install system dependencies:
- Ubuntu
- macOS
sudo apt install build-essential python3.10-dev pkg-config libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev librocksdb-dev
brew install lz4 bzip2 snappy rocksdb openssl readline sqlite3 xz zlib
- Install Poetry with the official installer:
curl -sSL https://install.python-poetry.org | python3 -
-
Add
export PATH="/home/ubuntu/.local/bin:$PATH"
to your shell configuration file. -
Change the working directory (the one you chose to store the application) to its child
hathor-core
:
cd hathor-core
- Check if Poetry's current virtual environment is using Python v3.10:
poetry env info
- (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
- Install the application dependencies (Python packages):
poetry install
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:
- Download RocksDB source code:
git clone -b 9.3.fb https://github.com/facebook/rocksdb.git
- Change to RocksDB source code directory:
cd rocksdb
- Compile RocksDB:
make shared_lib
- Install RocksDB:
make install-shared
- Proceed with the usual installation process.
Step 3: start the application
Start the application:
poetry run hathor-cli run_node --status 8080 --testnet --data ../data --wallet-index
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?
-
Hathor full node configuration: to customize or refine the installation setup.
-
Hathor full node pathway: to know how to operate this application.