HPB development node Building Guide

Time:2020-6-22

Introduction:When developing HPB DAPP, community developers first face the problem of how to access the HPB main network. This paper introduces the building process of the developer node, which is based on Ubuntu 16.04 build, the development node is equivalent to a light node, which can initiate transactions and synchronize blocks, but can not enter the election of candidate nodes and high-performance nodes, and can not leave blocks, which can be used as access nodes for DAPP applications.

You have the following two ways to build a development node:

(1) Mode 1: node building is carried out by source code, and certain software programming basis is required to select this building method. Understand the compilation process. This method needs to first complete the installation of go compilation environment, and then follow the steps and examples of source code construction;

(2) Mode 2:The HPB executable is used for node building. This method is directly carried out according to the steps and examples of building executable files.

be careful:

  1. The HPB program must run with root privileges.
  2. Any operation related to account password shall not be entrusted to others to avoid password leakage.
  3. The starting node must be operated by the user himself to prevent password leakage.

1. Check network connection

Before building the node, the user needs to check the network connection of the server and input the following five commands respectively to detect whether there is delay and packet loss in the process of connecting the server to the bootnode.

Number command node location

1 Ping - C 200 47.254.133.46 Germany\|
      2 ping-c 200 47.94.20.30 Beijing\|
      3 ping-c 200 47.88.60.227 Silicon Valley\|
      4 Ping - C 200 47.75.213.166 Hong Kong\|
      5 Ping - C 200 47.100.250.120 Shanghai\|

Example: (only take No. 1 as an example, other commands need to be executed by users)

Input command: after Ping 47.254.133.46, the console will output the summary information after the command ends, in which “200 packets transmitted” means 200 packets are sent, “186 received” means 186 packets are received, “7% packet loss” means 7% packet loss in the connection process; “time 199386ms” means 199836ms in total, and “RTT min / AVG / max / mdev”= 230.439/248.901/290.203/9.397 MS “indicates that the shortest time of 200 connections is 234.439ms, the average time is 248.901ms, the longest time is 290.203ms, and the average variance is 9.397ms.

Prompt: if the server location and node location are in the same continent, the packet loss phenomenon needs to be 0% and the delay is less than 100ms to reach the standard; (if the domestic server is connected to Beijing or Shanghai nodes, the packet loss phenomenon should be 0%); if the server is connected across continents, the packet loss phenomenon generally exists, and the delay is generally less than 300ms, but it is difficult to define the standard value, when the user loses the packet proportion and the delay occurs In case of uncertainty, ask HPB community staff whether these two items meet the standard.

Users who fail to meet the standards need to contact network service providers or data centers to solve network problems.

2. Source code building example

(1) Step 1 determine the program execution path

Enter * * sudo MKDIR * * / home / ghpb bin * to create the program execution path;

Where / home / ghpb bin can be changed to the specified path

Switch to root user and input the root account password according to the prompt.

(2) Step 2 select download path

Enter * * CD * * / home / *; where / home / can be changed to the specified path;

(3) Step 3 download HPB main network executable

Enter * * sudo git clone * ** https://github.com/hpb-project/hpb-release *

Tip: if you are prompted that go HPB already exists, enter the command: RM – RF go HPB, and then download the go HPB source code.

(4) Step 4 check the executable program of HPB main network

Enter * * CD * * * HPB release / * into the HPB release directory, and enter LS command to view the directory file. You can see bin, config and README.md Three files.

(5) Step 5 copy the creation file to the execution path

Enter * * CD * * config / * into the config directory, and continue to enter * * sudo * * * Cp * ** gensis.json  /Home / ghpb bin / * *; * where / hone / gphb bin / is the program execution path you set.

(6) Step 6 enter the download path

Enter * * CD * * / home / * to download the source code to the home directory, where / home / can be changed to the source download path

Index: HPB source code

(7) Step 7 compile go HPB

Enter * * CD * * go HPB / *; continue to enter * * make all * * to compile go HPB;

(8) Step 8 copy the program to the execution path

Input * * sudo Cp * * Build / bin / \ * / home / ghpb bin / *;
         Where / home / ghpb bin / is the program execution path you set;

(9) Step 9 initialize the node

Enter * * CD * * / home / ghpb bin / * to enter the program execution path; continue to enter * * sudo * * *. / ghpb * * -- dataDir * * node / data * * init * ** gensis.json *When "successfully write Genesis state database = chaindata" appears, continue to the next step, where / home / ghpb bin / is the program execution path you set;

(10) Step 10 export account

Export your account information file from HPB wallet, input CD node / data / and continue to input MKDIR keystore, input ls to see ghpb and keystore;

Enter the path / home / ghpb bin / node / data / keystore in sequence, and copy the account information file into the keystore folder.

Tip: if you do not have permission to enter this directory, enter the command Chmod 777 / home / ghpb Bin – R, and then re-enter.

(11) Step 11 create a new account

Enter. / ghpb -- dataDir node / data account new, wait for a moment and set the password of the new account according to the prompt. After repeated input, the new account address will be returned. The user needs to record the address;

(12) Step 12 start node

**Start mode 1 * *: enter * * CD * * / home / ghpb bin / * enter the ghpb bin directory, and continue to enter
`sudo ./ghpb --datadir node/data  --networkid 100 --port 3004 --syncmode full  --nodetype synnode console;`

When the message “welcome to the ghpb JavaScript console!” appears, the node starts successfully.

(13) Tip:The port number of the test bandwidth between nodes is the local ghpb port number plus 100; the local port (such as 3004) in the firewall of the development node must be opened, and the test bandwidth port can not be opened. Select the start mode for one time. If the user exits the remote server or turns off the terminal, the node program will stop running.

Start mode 2: enter CD / home / ghpb bin / enter the ghpb bin directory, and continue to enter

sudo nohup ./ghpb –datadir node/data –networkid 100 –verbosity 3 –syncmode full –rpc –rpcapi hpb,web3,admin,txpool,debug,personal,net,miner,prometheus –nodetype synnode &

Then, press enter twice.

Prompt: the port number of the test bandwidth between nodes is the local ghpb port number plus 100; the local port (default is 30303) in the firewall of the development node must be opened, and the test bandwidth port can not be opened. Wait for 15s and continue to enter the command:

sudo ./ghpb attach http://127.0.0.1:8545

3. Example of building executable file

(1) Step 1 determine the program execution path

Enter * * sudo MKDIR * * / home / ghpb bin * to create the program execution path, where / home / ghpb bin can be changed to the specified path

Switch to root user: enter Su root; enter root account password as prompted.

(2) Step 2 select download path

Enter * * CD * * / home / *; where / home / can be changed to the specified path;

(3) Step 3 download HPB main network executableorder

Enter * * sudo git clone * *< https://github.com/hpb-project/hpb-release >

If you are prompted that HPB release already exists, enter the command: RM – RF HPB release, and then download the HPB release file.

(4) Step 4 check the executable program of HPB main network

Enter * * CD * * * HPB release / * into the HPB release directory, and enter LS command to view the directory file. You can see bin, config and README.md Three files.

(5) Step 5 copy the creation file to the execution path

Enter * * CD * * config / * into the config directory, and continue to enter * * sudo * * CP** gensis.json   /Home / ghpb bin /, where / hone / gphb bin / is the program execution path you set.

(6) Step 6 enter the download path

Enter CD.

Enter sudo tar zxvf ghpb-vx. X.x.x tar.gz Command decompress ghpb-vx. X.x.x tar.gz File, where x.x.x.x is the latest version number of HPB software.

(7) Step 7 modify the file permissions

Enter sudo Chmod + X ghpb-v0.0.0.1 – R

(8) Step 8 copy the program to the execution path

Enter sudo CP ghpb VX. X.x.x / * / home / ghpb bin /, where / home / ghpb bin / is the program execution path you set;

(9) Step 9 initialize the node

Enter * * CD * * / home / ghpb bin / * to enter the program execution path; continue to enter * * sudo * * *. / ghpb * * -- dataDir * * node / data * * init * ** gensis.json *When "successfully write Genesis state database = chaindata" appears, continue to the next step, where / home / ghpb bin / is the program execution path you set;

(10) Step 10 export account

Export your account information file from HPB wallet, create keystore, input CD node / data / and continue to input MKDIR keystore;

Enter ls to see two files, ghpb and keystore.

(11) Step 11 import node

Enter the path / home / ghpb bin / node / data / keystore in sequence, and copy the account information file into the keystore folder;

Tip: if you do not have permission to enter this directory, enter the command Chmod 777 / home / ghpb Bin – R, and then re-enter.

(12) Step 12 create a new account

Input *. / ghpb * * -- dataDir * * node / data * * account new * *, wait for a moment and set the password of the new account according to the prompt, after repeated input, the new account address will be returned, and the user needs to record the address;

(13) Step 13 start node

Start mode 1: enter CD / home / ghpb bin / to enter the ghpb bin directory;

Continue input

sudo ./ghpb –datadir node/data –networkid 100 –port 3004 –syncmode full –nodetype synnode console;

When the message “welcome to the ghpb JavaScript console!” appears, the node starts successfully.

Tip: the port number of the test bandwidth between nodes is the local ghpb port number plus 100; the local port (such as 3004) in the firewall of the development node must be opened, and the test bandwidth port can not be opened. Select the start mode for one time. If the user exits the remote server or turns off the terminal, the node program will stop running.

Start mode 2: enter CD / home / ghpb bin / to enter the ghpb bin directory;

Continue input

sudo nohup ./ghpb –datadir node/data –networkid 100 –verbosity 3 –syncmode full –rpc –rpcapi hpb,web3,admin,txpool,debug,personal,net,miner,prometheus –nodetype synnode &

Then, press enter twice;

Tips:The port number of the test bandwidth between nodes is the local ghpb port number plus 100; the local port (30303 by default) in the firewall of the development node must be opened, and the test bandwidth port can not be opened. Wait for 10s and continue to input the command:

sudo ./ghpb attach http://127.0.0.1:8545

Author: thank the HPB wallet development team for organizing the contributions.

More technical consultation

1. If you want to learn more about HPB technology, please visit our GitHub Wiki:

HPB WiKi of GitHub

2. If you want to get more HPB information, please follow our official website:

HPB Website