How To Host A Garlicoin Full Node

From Garlicoin Wiki
Revision as of 21:36, 25 May 2023 by Studio271 (talk | contribs) (made it work for me, and added a simpler bootstrap link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 that will 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

Make sure to download the correct files for your system architecture. You can check them here: https://github.com/GarlicoinOrg/Garlicoin/releases

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

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

  • Then untar the package

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

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

mkdir .garlicoin

  • Then create the garlicoin.conf configuration file

cd ~/.garlicoin

touch garlicoin.conf

nano garlicoin.conf

  • Paste in the following
txindex=1

rpcuser=<username>

rpcpassword=<password>

rpcallowip=127.0.0.1

server=1

listen=1

daemon=1

addnode=freshgrlc.net
  • Change the username and password to something secure. They can be arbitrary values. Change the rpcallowip to another server's IP address if you plan to use this remotely.
  • 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 nano 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.18.0/bin/garlicoind

ExecStop=/bin/kill -15 $MAINPID

[Install]

WantedBy=multi-user.target
  • Save & exit, then reload the daemon, enable & start the service.
  • IMPORTANT, if you want to use Bootstrap (optional), see the section below, and when finished come back here.

sudo systemctl daemon-reload

sudo systemctl enable garlicoind.service

sudo systemctl start garlicoind.service

Checking Sync Progress

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

sudo su - garlicoin

/home/garlicoin/garlicoin-0.18.0/bin/garlicoin-cli getblockchaininfo

  • If syncing does not progress, run the following. You can also replace "freshgrlc.net" with any known server.

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

Bootstrap (Optional)

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

Start Garlicoind with Bootstrap

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

wget https://s3.amazonaws.com/downloads.garlicoin.ninja/bootstrap.dat

mv bootstrap.dat .garlicoin/bootstrap.dat

  • Then start garlicoind with the following

cd ~/garlicoin-0.18.0/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