05 PLSR Relay Node on HiveOS - Pulsar-Coin/Pulsar-Coin-Cryptocurrency GitHub Wiki
Note
- This guide assumes that you already have an active account with Hiveon.
- This guide reflects the independent and experimental work of one team member, Toe.
For those interested in expanding and supporting the Pulsar Network, HiveOS provides one avenue of remote managing a Pulsar Node. Because HiveOS is based on Ubuntu Linux, pulsard -- a headless, non-GUI, version of Pulsar -- will be used from the command line. While it is indeed possible to activate Pulsar's PoS mechanism on a HiveOS installation, it is not recommended to do so out of an abundance of security and for the fact that the wallet's performance degrades when mining activities occur on the same computer hosting the Pulsar wallet program. That being said, running a Pulsar Node without a wallet balance on a HiveOS installation hosted at different locations can strengthen, support, and expand the Pulsar Network.
Caution
- You are responsible for knowing how to use the commands found in this guide.
- It is recommended to use this information on a clean install of HiveOS.
- It is recommended to use the guide in a test environment first.
- Configure the BIOS to "Power On" after a power loss on the computer hosting HiveOS.
- Configure a smart-plug to control remote power cycling of the computer hosting HiveOS.
-
If you intend on placing this HiveOS machine in a remote location, such as a friend's or family member's house in a different city/state, you will need to figure out how to provision the smart-plug to work with your phone. In this manner, you will not need to ask another person to power cycle the machine should that be needed. In my experience, I find that it is easier to ship a pre-provisioned machine (along with a smart-plug, ethernet cable, and a power cord) to someone and simply ask them to plug it in. Afterall, we do not want to be a nuisance to those kind enough to host our machines.
- Download a HiveOS image to the provisioning computer:
- a. Stable -- Ubuntu 18.04.6 LTS: HiveOS 0.6-222-stable@230512; or
- b. Beta -- Ubuntu 20.04.6 LTS: HiveOS 0.6-225-beta@240131.
-
While it is possible to change the image after installation, doing so will wipe the drive and the Pulsar Node will have to be reinstalled from scratch.
Check the Hive Downloads Page to verify the latest Stable/Beta image. - On the provisioning computer that downloaded the HiveOS image, use Rufus or Etcher to write the HiveOS image to a NVMe drive that will be placed inside the computer hosting HiveOS.
- Once the HiveOS image has been written to the NVMe drive, remember also to create the
rig.conf
file on it and be sure to include your unique farm hash in therig.conf
file. - Place the finalized NVMe drive into the computer hosting HiveOS and boot it up.
- Confirm that the new machine appears in your HiveOS Farm.
- After booting the new machine in your HiveOS Farm, a new worker will be created.
- Click on the worker name that appears in the farm.
- Click settings.
- Rename the worker to something meaningful for easy identification.
For example, I name my workers with the following scheme: pn-XX-YYYY-ZZ-NN
"pn" = Pulsar Node
"XX" = State abbreviation where the computer is hosted.
"YYYY" = City name where the computer is hosted.
"ZZ" = Initials of the person hosting the machine.
"NN" = Computer number.
So, if "Joe Smith" was hosting 1 machine in Phoenix, Arizona, the worker name would be: pn-AZ-Phoenix-JS-01
- While still in the worker's settings, scrolling down reveals more options.
- After reading the HiveOS forum, many people choose to enable "Power Cycle".
-
When this option is enabled, all reboots will be performed as shutdown & boot in 30s.
- If you want to prevent anyone local access to the HiveOS machine, you may Turn ON the Login Screen.
-
Turning this option ON will block access to the local console. A login/password pair is necessary to access the local console.
- To access the command line interface (CLI) of the worker, click on the "Remote Access" icon located at the top of the screen.
- A drop-down menu will appear. Click on
Hive Shell Start
.
- After a few seconds, "Hive Shell" will appear. Click on the link arrow next to "Hive Shell" and a console window will appear.
install-pulsar.sh
Before running this script, make sure you chmod +x
this file.
/#: nano install-pulsar.sh
/#: chmod +x install-pulsar.sh
#!/bin/bash
# install-pulsar.sh
#
# This script will setup a Pulsar Relay Node.
# Verified to work with:
# Ubuntu 20.04: [email protected]
# Ubuntu 18.04: [email protected]
#
# It is not recommended to hold a balance or enable wallet PoS on this installation.
# Remember to enable port forwarding (5995 tcp) in your router to this machine.
# Or ensure that UPnP is enabled and operational in your router's settings.
#
# Check out: https://github.com/Pulsar-Coin/Pulsar-Coin-Cryptocurrency/wiki/03-PLSR-Acquisition#xmrigcc
# If you intend on mining, consider using the following CPU configuration for XMRigCC:
#
# "cpu": {
# "force-autoconfig": true,
# "huge-pages": true,
# "huge-pages-jit": false,
# "hw-aes": true,
# "priority": null,
# "max-cpu-usage": 50,
# "max-threads-hint": 100,
# "memory-pool": false,
# "asm": true
# }
clear
# Function to calculate total RAM available on the system in MB
get_total_ram() {
free -m | awk '/^Mem:/{print $2}'
}
# Colors and styles
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
RED='\033[0;31m'
RESET='\033[0m'
# Function to handle apt-get update and upgrade with retries
apt_get_update_upgrade() {
local retries=5
local wait_time=10
while [ $retries -gt 0 ]; do
if sudo apt-get update -y && sudo apt-get upgrade -y --allow-downgrades; then
return 0
else
echo -e "${YELLOW}# Failed to acquire dpkg frontend lock. Retrying in ${wait_time} seconds...${RESET}"
sleep $wait_time
retries=$((retries - 1))
fi
done
echo -e "${RED}# Failed to update and upgrade packages after multiple attempts.${RESET}"
exit 1
}
# Intro
echo -e "${YELLOW}"
echo "HiveOS: Pulsar Node Installer"
echo -e "${RESET}"
echo ""
# Inform the user about the script's purpose
echo -e "${CYAN}> Preparing HiveOS for${RESET} ${MAGENTA}Pulsar Node${RESET} ${CYAN}installation${RESET}..."
echo ""
# Expand disk space (ignore errors if disk space is already expanded)
echo -e "${CYAN}> Expanding disk space...${RESET}"
disk-expand &> /dev/null || true
echo ""
# Force upgrade HiveOS
echo -e "${CYAN}Updating HiveOS to latest release...${RESET}"
selfupgrade --force
echo ""
# Update system packages and install necessary dependencies
echo -e "${CYAN}> Updating Ubuntu system packages and installing dependencies...${RESET}"
apt_get_update_upgrade
echo ""
echo -e "${CYAN}# Installing Pulsar dependencies...${RESET}"
sudo apt-get install -y libboost-all-dev libminiupnpc-dev libevent-dev libzmq5
echo ""
# Create directory for Pulsar and navigate into it
echo -e "${CYAN}> Creating directory for Pulsar installation...${RESET}"
mkdir -p /.pulsar && cd /.pulsar || exit
echo ""
# Retrieve the latest version of Pulsar from GitHub
echo -e "${CYAN}> Fetching the latest version of Pulsar...${RESET}"
latest_pulsar_version=$(curl -sL https://api.github.com/repos/Pulsar-Coin/Pulsar-Coin-Cryptocurrency/releases/latest | jq -r '.tag_name' | sed 's/^v//')
latest_pulsar_file=$(curl -sL https://api.github.com/repos/Pulsar-Coin/Pulsar-Coin-Cryptocurrency/releases/latest | jq -r '.assets[] | select(.name | startswith("Pulsar")) | .name' | cut -d '-' -f1-2 | head -n1)
ubuntu_version=$(lsb_release -rs | cut -d'.' -f1) # Get major version of Ubuntu
if [ "$ubuntu_version" -ge 20 ]; then
latest_pulsar_file+="-x86_64-linux.tar.gz"
else
latest_pulsar_file+="-Ubuntu_${ubuntu_version}.tar.gz"
fi
echo -e "${CYAN}# Ubuntu Ver:${RESET} ${YELLOW}$ubuntu_version${RESET}"
echo -e "${CYAN}# Pulsar Ver:${RESET} ${YELLOW}$latest_pulsar_version${RESET}"
echo -e "${CYAN}# Binary Ver:${RESET} ${YELLOW}$latest_pulsar_file${RESET}"
echo ""
# Download the latest Pulsar Node binary
echo -e "${CYAN}> Downloading Pulsar binary...${RESET}"
cd /.pulsar
wget -q "https://github.com/Pulsar-Coin/Pulsar-Coin-Cryptocurrency/releases/download/v${latest_pulsar_version}/${latest_pulsar_file}"
tar xzf "$latest_pulsar_file"
rm -f "$latest_pulsar_file"
chmod +x pulsar*
echo ""
# Retrieve the latest version of blocks_chainstate from GitHub
echo -e "${CYAN}> Fetching the latest version of Pulsar blocks_chainstate...${RESET}"
latest_blocks_chainstate_version=$(curl -s https://api.github.com/repos/Pulsar-Coin/Pulsar-Coin-Cryptocurrency/releases/latest | grep -oP 'blocks_chainstate_\K[0-9.-]+.zip' | sort -V | tail -n 1)
echo -e "${CYAN}# Latest file version of blocks_chainstate:${RESET} ${YELLOW}blocks_chainstate_$latest_blocks_chainstate_version${RESET}\n"
# Download the latest blocks_chainstate file
echo -e "${CYAN}> Please wait:${RESET} ${YELLOW}Downloading blocks_chainstate_$latest_blocks_chainstate_version...${RESET}"
cd /.pulsar
wget -q "https://github.com/Pulsar-Coin/Pulsar-Coin-Cryptocurrency/releases/download/v${latest_pulsar_version}/blocks_chainstate_${latest_blocks_chainstate_version}"
echo -e "${CYAN}> Please wait:${RESET} ${YELLOW}Unpacking...${RESET}"
unzip -q "blocks_chainstate_${latest_blocks_chainstate_version}"
echo -e "${YELLOW}> Removing block_chainstate .zip file...${RESET}"
rm -f "blocks_chainstate_${latest_blocks_chainstate_version}"
echo ""
# Create configuration file for Pulsar Node in /.pulsar/pulsar.conf
echo -e "${CYAN}> Creating Pulsar configuration file in /.pulsar/pulsar.conf...${RESET}"
total_ram=$(get_total_ram)
dbcache=$((total_ram / 2)) # Use 50% of total RAM as dbcache
echo -e "${YELLOW}Total RAM available: $total_ram MB${RESET}"
echo -e "${YELLOW}Setting dbcache to $dbcache MB${RESET}"
tee /.pulsar/pulsar.conf > /dev/null <<EOF
# Pulsar Node Configuration
conf=/.pulsar/pulsar.conf
daemon=1
datadir=/.pulsar
dbcache=$dbcache
debugexclude=1
disablewallet=1
maxconnections=150
port=5995
rpcallowip=127.0.0.1
rpcbind=127.0.0.1
rpcpassword=password
rpcport=5996
rpcuser=username
staking=0
upnp=1
EOF
# Set permissions for Pulsar Node configuration file
chmod +x /.pulsar/pulsar.conf
echo ""
# Create systemd service file for Pulsar Node
echo -e "${CYAN}> Creating systemd service file for Pulsar...${RESET}"
tee /etc/systemd/system/pulsar.service > /dev/null <<EOF
[Unit]
Description=pulsar
After=network.target
[Service]
Type=forking
User=root
Restart=on-failure
TimeoutStopSec=600
ExecStart=/.pulsar/pulsard -datadir=/.pulsar -conf=/.pulsar/pulsar.conf -rpcuser=username -rpcpassword=password
ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
EOF
echo ""
# Check if required packages are installed, and install missing ones
required_packages=(
"libboost-all-dev"
"libminiupnpc-dev"
"libevent-dev"
"libzmq5"
)
echo -e "${CYAN}> Verifying required packages...${RESET}"
for package in "${required_packages[@]}"; do
if ! dpkg -l | grep -q "^ii $package"; then
echo -e "${YELLOW}# Package ${package} is missing. Installing...${RESET}"
sudo apt-get install -y "$package"
else
echo -e "${GREEN}# Package ${package} is already installed.${RESET}"
fi
done
echo ""
# Reload systemd, enable and start the Pulsar service
echo -e "${CYAN}> Reloading systemd (systemctl daemon-reload)...${RESET}"
systemctl daemon-reload
echo ""
echo -e "${CYAN}> Enabling pulsar (systemctl enable pulsar)...${RESET}"
systemctl enable pulsar
echo ""
echo -e "${CYAN}> Starting pulsar (systemctl start pulsar)...${RESET}"
systemctl start pulsar
echo ""
echo -e "${CYAN}> Pulsar Status (systemctl status pulsar)...${RESET}"
systemctl status pulsar.service
echo ""
# Inform the user about completion of the installation process
echo -e "${MAGENTA}> Please reboot now.${RESET}"
echo ""
echo -e "${GREEN}> Pulsar Node installation completed successfully!${RESET}"
echo ""