How To Host A Garlicoin Full Node

From Garlicoin Wiki
Jump to navigation Jump to search

How to Host a Garlicoin Full Node on a Ubuntu 20.04 VPS

Why host a Garlicoin Full Node

If you are instead looking to:

  • Create a wallet or look at an existing wallet => Go to Main Page and select the guide for creating a wallet.

Prepare the Host Server

System Requirements

Update the Server

sudo apt update

sudo apt upgrade

sudo apt install systemd

Create a Garlicoin User

  • Create a new user run your node service. This creates a user named "garlicoin."

sudo adduser garlicoin

More info on user control can be found here

  • Then switch to the new user.

sudo su - garlicoin

Install garlicoind

Download & Configure garlicoind

  • Download the package to the home folder of the user you created.

wget https://github.com/GarlicoinOrg/Garlicoin/releases/download/v0.17.2/garlicoin-0.17.2-x86_64-linux-gnu.tar.gz

  • Then untar the package

tar xvzf garlicoin-0.17.2-x86_64-linux-gnu.tar.gz

  • Then create a folder to host the garlicoind data and configureations

mkdir .garlicoin

  • Then create the garlicoin.conf configuration file

cd ~/.garlicoin

touch garlicoin.conf

vim garlicoin.conf

  • Paste in the following
txindex=1

rpcuser=<username>

rpcpassword=<password>

server=1

listen=1

daemon=1
  • Change the username and password to something secure. They can be arbitrary values. Save & exit, then exit to go back to the user with sudo privileges

exit

Configure the Service

  • Go to the systemd folder

cd /etc/systemd/system

  • Create the service file

sudo touch garlicoind.service

sudo vim garlicoind.service

  • Paste in the following text, edited for your purposes

[Unit]

Description=garlicoin

After=network.target

[Service]

Type=forking

User=garlicoin

Group=garlicoin

Environment=GARLICOIN_PID=/home/garlicoin/.garlicoin/garlicoin.pid

Environment=GARLICOIN_HOME=/home/garlicoin/.garlicoin

ExecStart=/home/garlicoin/garlicoin-0.17.2/bin/garlicoind

ExecStop=/bin/kill -15 $MAINPID

[Install]

WantedBy=multi-user.target

  • Save & exit, then start the service

sudo systemdctl start garlicoind.service

Checking Sync Progress

  • The progress can be checked via the user running the service

sudo su - garlicoin

/home/garlicoin/garlicoin-0.17.2/bin/garlicoin-cli getblockchaininfo

  • If syncing does not progress, run the following

/home/garlicoin/garlicoin-0.17.2/bin/garlicoin-cli addnode freshgrlc.net onetry

Bootstrap

A bootstrap of the Garlicoin blockchain can be found on the Garlicoin.org Website

Start Garlicoind with Boostrap

  • After install but before garlicoind is run for the first time, switch to a user with sudo privileges.

sudo apt update

sudo apt install python3-pip

sudo apt install unzip

  • Then switch back to the user you plan to run the service as.

pip3 install gdown

  • Next add ~/.local/bin to your PATH with the following steps

vim ~/.bashrc

  • Paste the following in somewhere in the middle. Its not critical where provided it doesn't disrupt existing configurations.

PATH=$PATH:~/.local/bin

  • Save & exit the file.

source ~/.bashrc to load the changes.

gdown --id 15lQG5kwFvvIYpeNjAr2rp0fknIQxNVAi -O bootstrap.zip

unzip bootstrap.zip

mv bootstrap.dat .garlicoin/bootstrap.dat

  • Then start garlicoind with the following

cd ~/garlicoin-0.17.2/bin/

./garlicoind -loadblock=~/.garlicoin/bootstrap.dat

  • After garlicoind syncs for the first time, you can kill the process and start it as a service.


Debugging Guide

Node not syncing?

 2021-05-05 19:42:18 0 addresses found from DNS seeds
 2021-05-05 19:42:18 dnsseed thread exit
 2021-05-05 19:43:18 Adding fixed seed nodes as DNS doesn't seem to be available.
  • Check if port 42069 is open to inbound traffic. It may be blocked by a firewall or by security groups (AWS).
  • Check ~/.garlicoin/debug.log for info. Some Connection Refused should be fine but there should be successful RPC connections.
  • To get more info:
 ./garlicoin-cli getblockchaininfo
  • To manually connect a peer, run:
 garlicoin-cli addnode freshgrlc.net onetry