The full release of the PAI Coin Node is here! Please use this repository when building and maintaining you own PAI Coin Full Node: https://github.com/projectpai/paicoin/releases
Be sure to read the last section “Updating to the latest PAI Coin Core version” to make sure your node is compatible with the upcoming hybrid fork.
Hosting a PAI Coin full node is one of the best things you can do to support Project PAI. It’s simple and affordable to do, and it helps to ensure good network performance and reliability for PAI Coin. This document outlines how to properly build and maintain a PAI Coin full node.
Table of Contents
1. What is a full node?
2. Obtain a computer or server to act as a node
- Cloud computing
3. Install PAI Coin Core
- Installing dependencies and configuring your build
- Compiling binaries
4. Configure the node
- Configuring PAI Coin Core
- Configuring networking
5. Launch PAI Coin Core
- Running paicoind
- Testing connectivity to the node
6. Maintain the node
- Ensuring sufficient disk space
- Updating to the latest PAI Coin Core version
What is a full node?
A full node is a server which stores a complete replica of the PAI Blockchain. A full node does not necessarily stake or mine, although it can. Its main purpose is to communicate with other peers in the network to forward pending transactions and provide redundancy. The addition of full nodes to the PAI Coin P2P network increases the decentralization, reliability, and efficiency of PAI Coin. This guide outlines how to properly setup and maintain a non-staking, non-mining full node. While you won’t earn PAI Coin for hosting this type of full node, it is generally very affordable to maintain and is one of the best things you can do to support the PAI Blockchain.
Obtain a computer or server to act as a node
The first step to running your own PAI Coin node is acquiring a device to use. For your node to best serve its purpose, it should be online 24/7, so it’s not ideal to choose a personal device like a laptop or home computer that you use for other things.
In today’s age of cloud computing, the most obvious solution is to rent a remote server—often called an “instance”—from a cloud computing service provider. Depending on the provider you choose, a sufficiently powerful instance for running a PAI Coin full node can be obtained for $5-$10 per month. Here are some providers we recommend:
|Provider||Based In||Instance Type||Monthly Cost||Notes||Link|
|Amazon Web Services (AWS)||USA||t2.micro||$8.50||-AWS is widely used, very reliable-Offers 1 year free||https://aws.amazon.com|
|DigitalOcean||USA||Basic (Smallest)||$5||-Console is very easy to use||https://digitalocean.com|
|Alibaba Cloud||China||ecs.t5-lc1m1.small||$6.40||-Mainland China regions available-Offers 1 year free||https://alibabacloud.com|
If you prefer not to use a cloud computing platform, you also have the option to self-host a PAI Coin node. This would require you to dedicate a physical computer or server that you own to running PAI Coin Core and keeping it online 24/7 with public accessibility. Self-hosting is beyond the scope of this tutorial.
Install PAI Coin Core
Once the computer you’ve chosen to use for your node is up and running, you’ll need to install the latest version of PAI Coin Core. Currently, the best way to do that is by building the software from source. In order to do so, connect to your node via ssh and execute the following commands. These instructions assume you are using Ubuntu 18.04 or later and that you are logged in as a user with sudo (root) access.
First, clone the public PAI Coin repository.
git clone https://github.com/projectpai/paicoin.git
Installing dependencies and configuring your build
Next, install some dependencies.
sudo apt update sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 libboost-all-dev
If you are using an Alibaba Cloud server, install the following additional dependencies.
sudo apt install openssl libssl-dev libevent-dev
Generate the configuration script.
cd paicoin ./autogen.sh
Set the build parameters.
./configure --disable-tests --disable-wallet CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
If you are using a server with more than 1.5 GB of RAM, you can exclude the
CXXFLAGS. You can also exclude the flag
--disable-tests to build and run unit tests, but this will cause the installation to take longer.
If you wish to enable the wallet, you will need to install additional dependencies. Please refer to
doc/build-unix.md in the
paicoin repository for more information. A wallet is not necessary to run a full node.
When you see the following output, you have successfully configured the build.
Options used to compile and link: with wallet = no with gui / qt = no with zmq = no with test = no with bench = yes with upnp = auto use asm = yes debug enabled = no werror = no target os = linux build os = CC = gcc CFLAGS = -g -O2 CPPFLAGS = -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS CXX = g++ -std=c++11 CXXFLAGS = --param ggc-min-expand=1 --param ggc-min-heapsize=32768 LDFLAGS = ARFLAGS = cr
Now, all you need to do is compile the binaries. Just run:
Once you see the following output, your installation is complete!
make: Leaving directory '/home/ubuntu/paicoin/src' make: Leaving directory '/home/ubuntu/paicoin/src' Making all in doc/man make: Entering directory '/home/ubuntu/paicoin/doc/man' make: Nothing to be done for 'all'. make: Leaving directory '/home/ubuntu/paicoin/doc/man' make: Entering directory '/home/ubuntu/paicoin' make: Nothing to be done for 'all-am'. make: Leaving directory '/home/ubuntu/paicoin'
Configure the node
With PAI Coin Core installed, you still need to do a few more configuration steps to run it as a full node that other peers can connect to.
Configuring PAI Coin Core
To configure PAI Coin Core before starting paicoind, follow these instructions.
Then, in the ~/.paicoin directory, create a plain text file titled paicoin.conf which contains the following.
daemon=1 txindex=1 reindex=1 testnet=0
You need to make sure that other peers can connect to your node. To do this, make port 8567 accessible from any IP address. This can be done by creating a Security Group (AWS, Alibaba Cloud) or Firewall (Digital Ocean) with the appropriate rule and attaching it to the instance (AWS, Alibaba Cloud) or droplet (Digital Ocean) that is running PAI Coin Core.
Launch PAI Coin Core
With PAI Coin Core installed and the software and instance fully configured, we’re ready to start the PAI Coin Daemon (paicoind). In ~/paicoin/src run the following command.
You will see:
PAI Coin server starting
Your node will begin to download a copy of the blockchain locally. To monitor the progress, you can run the following command.
tail -f ~/.paicoin/debug.log
When you see an output like this, the blockchain has fully synced and your node is running.
2020-09-21 17:52:16 receive version message: /Turing:0.16.1/: version 70015, blocks=152506, us=184.108.40.206:57020, peer=10
Testing connectivity to the node
The simplest way to test that your node is accessible to other peers in the network is through PAI Up Mobile. In PAI Up, go to Menu 🡪 Preferences 🡪 PAI Coin Settings 🡪 PAI Coin Nodes 🡪 Switch to Manual Mode, then enter the IP address of your full node and click OK. If PAI Up successfully connects, then your full node is operating correctly.
Maintain the node
Ensuring sufficient disk space
The PAI Blockchain will continue to grow in size over time, so you should routinely check that the node has enough disk space. You can check the status of your node by running the following command in
To see a list of other possible commands, run
Updating to the latest PAI Coin Core version
You should regularly update your PAI Coin full node to use the latest software version. To update, execute the following commands in the
First, stop the full node from running.
cd src paicoin-cli stop cd ..
Next, pull the latest software version of the code and tags.
git fetch --tags
Next, if applicable, checkout the tagged version of code that you need. The following command
checks out the first release of PAI Coin Core that supports Hybrid Consensus.
git checkout 2.0.001
Finally, proceed with the following commands to build the new version.
make clean make
Once the build completes, you can restart your full node by executing
Get the full PDF documentation below:
Building and Maintaining a PAI Coin Full Node V2.pdf (138.5 KB)