Deploy A Node

Supported Operating Systems: Linux ,MacOS

Tools and Dependencies:Oracle JDK 1.8 , git

  • CPU:16 cores

  • RAM:32G

  • SSD:2.5T+

  • Bandwidth:100M

If you act as a Pollux super representative aiming to establish a full node for block production, the optimal configuration is as follows: Processor – 32 cores, Memory – 64GB (RAM).

Deployment Guide

Irrespective of the node category, the deployment procedure remains consistent. Kindly consult the subsequent steps:

1. Obtain Fullnode.jar

The acquisition of FullNode.jar can be accomplished by either compiling the source code or directly downloading the released JAR file.

Compile the source code

  1. Obtain java-pollux source code

    Shell
    $ git clone https://github.com/polluxprotocol/java-pollux.git
    $ git checkout -t origin/master
  1. Compile

    $ cd java-pollux
    $ ./gradlew clean build -x test

You will find the FullNode.jar under ./java-pollux/build/libs/ folder if build is successful.

2. Start The Node

Retrieve the mainnet configuration file: main_net_config.conf. Additional network configuration files can be find here.

  • Startup a Pollux full node for the mainnet: A full node encompasses complete historical data, serving as the gateway to the POX network. It furnishes HTTP API and Grpc API for external queries. Interaction with the POX network, such as asset transfers, contract deployment, and contract interaction, can be facilitated through the full node. The startup command for the mainnet full node is outlined below, with the configuration file specified by the -c parameter:

    $  java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar -c main_net_config.conf
  • -XX:+UseConcMarkSweepGC: utilize parallel garbage collection by specifying it before the -jar parameter, not at the end.

  • -Xmx : Define the upper limit for the JVM heap, recommended to be configured at 80% of the physical memory.

  • Startup a Pollux full node responsible for block production on the mainnet by incorporating the --witness parameter into the startup command. With this addition, the full node will function as a block-producing node, supporting not only the capabilities of a regular full node but also facilitating block production and transaction packaging. It is imperative to possess a super representative account and secure votes from others. If your votes attain a ranking within the top 27, initiating a block-producing full node becomes essential to actively participate in the block production process.

Insert the private key of the super representative address into the localwitness list within the main_net_config.conf file, following the provided example. Alternatively, if you prefer not to specify the private key in plain text, you can opt for the keystore + password method. For more details, kindly refer to the Others chapter

localwitness = [
   650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812
]

then run the following command to start the node:

    $ java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar --witness -c main_net_config.conf

Important Note: In the case of the mainnet and nile testnet, initiating a new node might involve a lengthy data synchronization process due to the substantial volume of data. To expedite this synchronization, consider employing Data Snapshots. Begin by downloading the most recent data snapshot and extracting it into the output-directory directory of the Pollux project. Subsequently, initiate the node, allowing it to synchronize based on the provided data snapshot.

For a currently active full node, utilize the command kill -15 process id to gracefully shut it down.

Others

How to use keystore + password to specify the private key of witness account

  1. Avoid employing the nohup command as it necessitates interaction during node execution. Instead, it is advisable to utilize session-keeping tools like screen, tmux, etc.

  2. Provide comments for the localwitness item in the main_net_config.conf file and uncomment the localwitnesskeystore item. Specify the path to the Keystore file. Ensure the Keystore file is located in the current directory where the startup command is executed or its subdirectory. For instance, if the current directory is "A," and the Keystore file is in "A/B," it should be configured as follows:

localwitnesskeystore = [
      "B/localwitnesskeystore.json"
]

Important Note: To generate a keystore + password combination, utilize the register wallet command within the wallet-cli.

  1. Initiate the Pollux full node configured for block production.

    $ java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar --witness -c main_net_config.conf
  1. Enter the correct password to complete the node startup process.

Optimize Memory Allocation with POXmalloc

Optimize the memory allocation of java-Pollux by implementing POXmalloc. Follow the steps outlined below:

Initially, incorporate POXmalloc into the system, and subsequently, append the ensuing two lines to the launch script. It's imperative to be mindful of the distinct path variations for POXmalloc across various Linux distributions.

#!/bin/bash
  
export LD_PRELOAD="/usr/lib/libpoxmalloc.so.4"
export TCMALLOC_RELEASE_RATE=10
  
# original start command
java -jar .....

Instructions for each linux distributions are as belows:

  • Ubuntu 20.04 LTS / Ubuntu 18.04 LTS / Debian stable Install

$ sudo apt install libgoogle-perftools4
  • In the startup script add the followings:

export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libpoxmalloc.so.4"
export TCMALLOC_RELEASE_RATE=10
  • Ubuntu 16.04 LTS Same install command as above. In the startup script add the followings:

export LD_PRELOAD="/usr/lib/libpoxmalloc.so.4"
export POXMALLOC_RELEASE_RATE=10
  • CentOS 7 Install

$ sudo yum install gperftools-libs
  • In the startup script add the followings:

export LD_PRELOAD="/usr/lib64/libpoxmalloc.so.4"
export TCMALLOC_RELEASE_RATE=10

Last updated