Skip to content

HPB Private Chain Building Guide

BlockGeek edited this page Apr 24, 2019 · 3 revisions

It is very convenient and cost-effective to build a local test chain if you want to develop DAPP. Direct deployment to the main chain consumes tokens and causes a lot of inconvenience. The following are detailed instructions to build HPB test chain.

Test chain local building steps

The following table shows the complete steps to locally build the test chain.

No Step Content Note
1 Determine program execution path Determine program execution path Command:sudo mkdir /home/ghpb-bin2
Note:/home/ghpb-bin2 can be replaced as the specified path
2 Switch to ROOT user Switch to ROOT user Enter the ROOT account password as prompted
3 Select download path Select download path Note: /home/ can be replaced as the specified path
4 Download go-hpb source Download go-hpb source Command:sudo git clone -b version_x.x.x.x https://github.com/hpb-project/go-hpb
Note: x.x.x.x is the latest version number of main web program
5 Compile source code Compile source code Command:cd go-hpb/
Command:make all
6 Copy program to execution path Copy program to execution path Command:sudo cp build/bin/. /home/ghpb-bin2/
Visit execution path Command:cd /home/ghpb-bin2/
7 Create a new account Create first account Command:./ghpb --datadir node/data account new
Set account password as prompted and record the account address
Create second account Command:./ghpb --datadir node1/data account new
Set account password as prompted and record the account address
Creat thrid account Command:./ghpb --datadir node2/data account new
Set account password as prompted and record the account address
8 Generate creation block Generate creation block Command:./promfile
Complete generation step following prompt and example
9 Initialize node Initialize first node Command:./ghpb --datadir node/data init gensis.json
Initialize second node Command:./ghpb --datadir node1/data init gensis.json
Initialize third node Command:./ghpb --datadir node2/data init gensis.json
10 Start bootnode Start bootnode Refer to the example to copy binding.json file before startup.。
Command:./ghpb --datadir node1/data --networkid 66300 --port 3001 --nodetype bootnode console
Note: 66300 is the network number set by the user in generating creation block. 3001 is the port number. The port number is different when starting different nodes on one machine.)
11 Open configuration file Open configuration file Command:exit
Command:vi /home/go-hpb/config/networkconfig.go
12 Write hnode into configuration file Write hnode into configuration file Write hnode into configuration file
13 Save configuration file Save configuration file PressEsc,and input:wq
14 Compilation source code Compilation source code Command:cd /home/go-hpb/
Note: /home/ is the download path for go-hpb.
Command: make all
15 Copy into program execution path Copy into program execution path Command:sudo cp build/bin/. /home/ghpb-bin2/
Command:cd /home/ghpb-bin2/
16 Start node Start bootnode Command:sudo nohup ./ghpb --datadir node1/data --networkid 66300 --port 3001 --rpcaddr 0.0.0.0 --rpcport 8541 --verbosity 3 --rpc --rpcapi hpb,web3,admin,txpool,debug,personal,net --nodetype bootnode . bootnode.log &
Command: sudo ./ghpb attach http://127.0.0.1:8541
Start first mining node Command:sudo ./ghpb --datadir node/data --unlock "the first mining node address" --networkid 66300 --port 3002 --rpcaddr 0.0.0.0 --rpcport 8542 --verbosity 3 --rpc --rpcapi hpb,web3,admin,txpool,debug,personal,net console --testmode
Input the account password as prompted (need to open console window to execute the command);
Command:miner.start()
Start second mining node Command:sudo ./ghpb --datadir node2/data --unlock "The third mining node address" --networkid 66300 --port 3003 --rpcaddr 0.0.0.0 --rpcport 8543 --verbosity 3 --rpc --rpcapi hpb,web3,admin,txpool,debug,personal,net console --testmode
Input the account password as prompted (need to open console window to execute the command);
Command:miner.start()

Test chain local building example

(1) Determine program execution path

Input sudo mkdir /home/ghpb-bin2 to create the program execution path, in which /home/ghpb-bin2 can be replaced as the specified path.

hpb@ dell-PowerEdge-R730:~$ sudo mkdir /home/ghpb-bin2
(2) Switch to ROOT user

Inputsu root, ROOT account password as prompted.

hpb@ dell-PowerEdge-R730:~$ su root
Password:
(3) Choose download path

Input cd /home/ in which /home/ can be replaced as the specified path.

root@ dell-PowerEdge-R730: ~$ cd /home/
(4) Download go-hpb source code

Input sudo git clone -b version_x.xxx https://github.com/hpb-project/go-hpb when the progress becomes 100%. If "checking conectivity ... done" appears, it shows go-hpb is successfully downloaded, please continue the next step; (xxxx is the latest version number of the main network program)

root@dell-PowerEdge-R730:/home# sudo git clone -b version_1.0.1.0 https://github.com/hpb-project/go-hpb
Cloning into 'go-hpb'...
remote: Counting objects: 10547, done.
remote: Compressing objects: 100% (150/150), done.
Receiving objects: 100% (10547/10547), 14.09 MiB | 395.00 KiB/s, done.
Resolving deltas: 100% (5824/5824), done.
Checking connectivity... done.
Note: checking out '89d88c8e23f7761a76dd8eebe9b08fd3750a04b6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>
(5)go-hpb Compile go-hpb

Input cd go-hpb/

Continue to input make all to compile go-hpb

root@ dell-PowerEdge-R730:/home# cd go-hpb/
root@ dell-PowerEdge-R730:/home/go-hpb# make all
build/env.sh go run build/ci.go install ./cmd/ghpb
>>> /usr/lib/go-1.9/bin/go install -ldflags -X main.gitCommit=04fa6c874b447f0de0a4296b9e573119e1997fcc -v ./cmd/ghpb
github.com/hpb-project/go-hpb/vendor/github.com/prometheus/procfs/internal/util
github.com/hpb-project/go-hpb/common/bitutil
……
Done building.
Run "/home/go-hpb/build/bin/promfile" to launch promfile.
(6) Copy program to execution path

Input sudo cp build/bin/. /home/ghpb-bin2/; continue typing cd /home/ghpb-bin2/. Where /home/ghpb-bin2/ is the program execution path set for you;

root@ dell-PowerEdge-R730:/home/go-hpb# sudo cp build/bin/* /home/ghpb-bin2/
root@ dell-PowerEdge-R730:/home/go-hpb#cd /home/ghpb-bin2/
(7) Create three accounts
  • Input ./ghpb --datadir node/data account new to create first new account, set account password as prompted and record account address "04cbf60fdcc485a76b0b8a389da7bd87da180edd".
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ./ghpb --datadir node/data account new
INFO [09-19|08:21:43]  HPB : Create New HpbConfig object 
INFO [09-19|08:21:43]  HPB : Initialising Hpb node             network=1
INFO [09-19|08:21:43]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node/data/ghpb/chaindata cache=128 handles=1024
INFO [09-19|08:21:46]  HPB : set coinbase of node              : =0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase: 
Repeat passphrase: 
Address: {04cbf60fdcc485a76b0b8a389da7bd87da180edd}
  • Input ./ghpb --datadir node1/data account new to create second new account,set account password as prompted and record account address "af4a70602be17074ad59555fa09239c0d811a99f"。
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ./ghpb --datadir node1/data account new
INFO [09-19|08:26:17]  HPB : Create New HpbConfig object 
INFO [09-19|08:26:17]  HPB : Initialising Hpb node             network=1
INFO [09-19|08:26:17]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node1/data/ghpb/chaindata cache=128 handles=1024
INFO [09-19|08:26:20]  HPB : set coinbase of node              : =0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase: 
Repeat passphrase: 
Address: {af4a70602be17074ad59555fa09239c0d811a99f}
  • Input./ghpb --datadir node2/data account new to create third new account,set account password as prompted and record account address "552a49773698c75b7fbb47f1a3486f6394cc4385"。
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ./ghpb --datadir node2/data account new 
INFO [09-19|08:28:33]  HPB : Create New HpbConfig object 
INFO [09-19|08:28:33]  HPB : Initialising Hpb node             network=1
INFO [09-19|08:28:33]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node2/data/ghpb/chaindata cache=128 handles=1024
INFO [09-19|08:28:36]  HPB : set coinbase of node              : =0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase: 
Repeat passphrase: 
Address: {552a49773698c75b7fbb47f1a3486f6394cc4385}
(8) Generation of creation block

Input./promfile and complete setting on the generation of creation block.

root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ./promfile
+-----------------------------------------------------------+
| Welcome to prometh, your HPB private network manager |
|                                                           |
| This tool lets you create a new HPB network down to  |
| the genesis block, bootnodes, miners and ethstats servers |
| without the hassle that it would normally entail.         |
|                                                           |
| Prometh uses SSH to dial in to remote servers, and builds |
| its network components out of Docker containers using the |
| docker-compose toolset.                                   |
+-----------------------------------------------------------+
Please specify a network name to administer (no spaces, please)
> random`(Name the test chain, any name is fine such as random)
Sweet, you can set this via --network=random next time!
INFO [09-19|08:36:16]  HPB : Administering HPB network         name=random
WARN [09-19|08:36:16]  HPB : No previous configurations found  path=/root/.prometh/random
What would you like to do? (default = stats)
 1. Configure new genesis
 2. Manage existing genesis
> 1`(Select 1, generating new creation file)

Welcome to HPB consensus engine file maker

How many seconds should blocks take? (default = 15)
> 5`(Set the interval for generating blocks such as 5)

How many blocks should voting epoch be ? (default = 30000)
> 100`(Set voting period such as 100)

Which accounts are allowed to seal? (initialise miner addresses)
> 0x04cbf60fdcc485a76b0b8a389da7bd87da180edd(Set the initial mining address, the example is the first new account)

> 0x`(Continue to add the mining address, press Enter to the next step)

Which accounts should be pre-funded? (advisable at least one)
> 0x04cbf60fdcc485a76b0b8a389da7bd87da180edd(Set the initial address for pre-deposit, the example is the first new account)
> 0x`(Continue to add address for pre-deposit, press Enter to go to the next step)

Please input the initialization hardware random
> 0x `(press Enter to go to the next step) 

Specify your chain/network ID if you want an explicit one (default = random)
> 66300`
(Set the network number at your will, it will be used in the subsequent startup commands)

Anything fun to embed into the genesis block? (max 32 bytes)
> hhh`(You can input any interesting strings)

What would you like to do? (default = stats)
 1. Configure new genesis
 2. Manage existing genesis
> 2`(Select 2, output newly set creation file)

 1. Export genesis configuration
> 1` (Select 1,  json file will be printed, please input name "gensis.json" at the end)
> 
Which file to save the genesis into? (default = random.json)
{
  "config": {
    "chainId": 66300,
    "prometheus": {
      "period": 5,
      "epoch": 100
    }
  },
  "nonce": "0x0",
  "timestamp": "0x5ba242c8",
  "extraData": "0x686868000000000000000000000000000000000000000000000000000000000004cbf60fdcc485a76b0b8a389da7bd87da180edd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x5f5e100",
  "difficulty": "0x1",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "alloc": {
    "04cbf60fdcc485a76b0b8a389da7bd87da180edd": {
      "balance": "0x8"
    }
  },
  "number": "0x0",
  "gasUsed": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "hardwareRandom": "0x0000000000000000000000000000000000000000000000000000000000000000"
}> gensis.json`(input name “gensis.json” here and press enter)
INFO [09-19|08:59:36]  HPB : Exported existing genesis block 

What would you like to do? (default = stats)
 1. Configure new genesis
 2. Manage existing genesis
> 

Press ctrl+c to exit, input ls to view the output creation file gensis.json

root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ls
binding.json  gensis.json   node   node2
config.json   ghpb         iperf3  node1  promfile
(9) Initialize node
  • Input ./ghpb --datadir node/data init gensis.json to initialize first node;
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2#  ./ghpb --datadir node/data init gensis.json
INFO [09-19|09:08:22]  HPB : Create New HpbConfig object 
INFO [09-19|09:08:22]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node/data/ghpb/chaindata cache=16 handles=16
INFO [09-19|09:08:22]  HPB : Writing custom genesis block 
INFO [09-19|09:08:22]  HPB : Successfully wrote genesis state  database=chaindata                                hash=e46058…896936
  • Input ./ghpb --datadir node1/data init gensis.jsonto initialize second node;
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2#  ./ghpb --datadir node1/data init gensis.json
INFO [09-19|09:08:53]  HPB : Create New HpbConfig object 
INFO [09-19|09:08:53]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node1/data/ghpb/chaindata cache=16 handles=16
INFO [09-19|09:08:53]  HPB : Writing custom genesis block 
INFO [09-19|09:08:53]  HPB : Successfully wrote genesis state  database=chaindata                                 hash=e46058…896936
  • Input ./ghpb --datadir node1/data init gensis.jsonto initialize third node
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ./ghpb --datadir node2/data init gensis.json
INFO [09-19|09:10:05]  HPB : Create New HpbConfig object 
INFO [09-19|09:10:05]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node2/data/ghpb/chaindata cache=16 handles=16
INFO [09-19|09:10:05]  HPB : Writing custom genesis block 
INFO [09-19|09:10:05]  HPB : Successfully wrote genesis state  database=chaindata                                 hash=e46058…896936
(10) Start bootnode
  • Configure binding.json Input vim binding.json to write binding.json into all accounts,

    root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# vim binding.json
    

    In the open file, when press I to become Insert status, paste the following code:

    (Users need to change the three coinbase as the address of three new accounts. CID and HID can be filled at will and can be consistent with those in the example.)

  [    {"coinbase":"0xfc6661501b4faf424d2ed61855a134fa5b2de3ef","cid":"2cd504a93518fe0c9b60895602586efc4786cf9da9396d0a6d39403b94710b0a16092dcbd8458bb46cef1e71ba9953db881268ce5d773ce63ffb421a657a00e1","hid":"a3b8e1f3bd9cf3ed0a520744010bf2cc48e781b04af7f462e452f9c96e476abc"},    {"coinbase":"0xaf4a70602be17074ad59555fa09239c0d811a99f","cid":"2cd504a93518fe0c9b60895602586efc4786cf9da9396d0a6d39403b94710b0a16092dcbd8458bb46cef1e71ba9953db881268ce5d773ce63ffb421a657a00e1","hid":"a3b8e1f3bd9cf3ed0a520744010bf2cc48e781b04af7f462e452f9c96e476abc"},    {"coinbase":"0x552a49773698c75b7fbb47f1a3486f6394cc4385","cid":"2cd504a93518fe0c9b60895602586efc4786cf9da9396d0a6d39403b94710b0a16092dcbd8458bb46cef1e71ba9953db881268ce5d773ce63ffb421a657a00e1","hid":"a3b8e1f3bd9cf3ed0a520744010bf2cc48e781b04af7f462e452f9c96e476abc"}                                                                                                                                                     ]
  

Press Esc and input :wq to save the file and exit.

  • Copy binding.json Input cp binding.json node1/data to copy binding.json into bootnode data file.

    root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# cp binding.json node1/data 
    
  • Start bootnode

Input./ghpb --datadir node1/data --networkid 66300 --port 3001 --nodetype bootnode console; (66300 is the network number set in the generation of the creation block, 3001 is the port number. Different nodes are assigned with different port number)

root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# ./ghpb --datadir node1/data --networkid 66300 --port 3001 --nodetype bootnode console
INFO [09-19|09:23:23]  HPB : Create New HpbConfig object 
INFO [09-19|09:23:23]  HPB : Initialising Hpb node             network=66300
INFO [09-19|09:23:23]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node/data/ghpb/chaindata cache=128 handles=1024
INFO [09-19|09:23:26]  HPB : set coinbase of node              : =0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
INFO [09-19|09:23:26]  HPB : Loaded most recent local header   number=0 hash=e46058…896936 td=1
INFO [09-19|09:23:26]  HPB : Loaded most recent local full block number=0 hash=e46058…896936 td=1
INFO [09-19|09:23:26]  HPB : Loaded most recent local fast block number=0 hash=e46058…896936 td=1
INFO [09-19|09:23:26]  HPB : Set coinbase address by start     address=0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
INFO [09-19|09:23:26]  HPB : Change node local type            from=UnknownNode to=BootNode
INFO [09-19|09:23:26]  HPB : Set Init Local Type by p2p        type=BootNode
INFO [09-19|09:23:26]  HPB : Starting P2P networking 
INFO [09-19|09:23:28]  HPB : UDP listener up                   self=hnode://ad65b8d7efc85c50b13f63a0a7234d1398136a200dbe104ff759daf7912fe7ce2c996db38135883599e0802f24849c2e1e5ee4502d401e6b39823552dba331a9@[::]:3001
INFO [09-19|09:23:28]  HPB : Server start with type.           NodeType=BootNode
INFO [09-19|09:23:28]  HPB : Start server of bandwidth test.   port=3101
INFO [09-19|09:23:28]  HPB : IPC endpoint opened: /home/ghpb-bin2/node/data/ghpb.ipc 
Welcome to the GHPB JavaScript console!
instance: 
coinbase: 0xfc6661501b4faf424d2ed61855a134fa5b2de3ef
at block: 0 (Wed, 19 Sep 2018 08:57:13 EDT)
 datadir: /home/ghpb-bin2/node/data
 modules: admin:1.0 debug:1.0 hpb:1.0 miner:1.0 net:1.0 personal:1.0 prometheus:1.0 rpc:1.0 txpool:1.0 web3:1.0

Record the hnode information and add public network ip in front of the port number (public network Ip is the public network ip address of the server where the bootnode is located. It is 192.168.1.50 in the example and the developer needs to change to its own public network Ip):

hnode://ad65b8d7efc85c50b13f63a0a7234d1398136a200dbe104ff759daf7912fe7ce2c996db38135883599e0802f24849c2e1e5ee4502d401e6b39823552dba331a9@192.168.1.50:3001

(11) Open configuration file

Input exit to exit, contiute to input vi /home/go-hpb/config/networkconfig.go to open configuration file

> exit
INFO [09-19|09:31:32]  HPB : Hpb data sync stopped 
root@hpb-PowerEdge-R730xd:/home/ghpb-bin# vi /home/go-hpb/config/networkconfig.go
(12) Write hnode into configuration file

Find the var MainnetBootnodes method in the open file, input hnode information (including public network ip) in this method; and input // before the rest of the hnode information, showing that unnecessary hnode information is commented out.

Note: Move the cursor to the first line in the method, press letter o and it automatically insert an empty line, then you can paste hnode information, pay attention to the double quotes and commas since the format is in English.

var MainnetBootnodes = []string{
        //"hnode://73c8ac9dddc8f094d28f42e1ec5c3e8000cad25be152c147fceacc27953d58e64bfe9f555145d93f9f6b995bab984411941751fef3bd460f74c0151eb0432b56@47.94.20.30:30303",

"hnode://ad65b8d7efc85c50b13f63a0a7234d1398136a200dbe104ff759daf7912fe7ce2c996db38135883599e0802f24849c2e1e5ee4502d401e6b39823552dba331a9@192.168.1.50:3001",
        //"hnode://1c129009d0e9c56e79b6f4157497d8ac2810ea83fc1f6ed4b6244406597d821f52bb0d210157854d861d2f6099fa948bc5a03d2f4f1bcae70dc6e9c535e586f9@47.100.250.120:30303",
      //"hnode://f3282847f29cfea1dd741246cc17b9a0dcdd8b0b9dfce2a985d2358497458135e81942ae7155cfd2fe23e1da30f18fc1fa2c56d3675aba51e7c67f83681fded5@47.75.213.166:30303",
        //"hnode://dd2fd6ea314041c0e20aed4ee4159ab172a4ddb944459d147bdb28461937841ee069c44fe0915be9f74d929562968fb9720362937a898e2ec3a598fa3fe1f33b@47.88.60.227:30303",
        //"hnode://a6ef92a46adb69f94f2d48ff20f7800fb057d6aba7945e5af062ef27be5598072c5ce083ec5a2c89f80d112401c261b9ba9dacbd53aeb7c8243685d537edadb9@47.254.133.46:30303",
}
(13) Save configuration file

Press Esc, type :wq and press Enter to save. Note: If you want to quit without saving the file, press Esc, input: q! and press Enter; if you can't edit, press the letter i.

:wq
(14) Compile source code

Input cd /home/go-hpb/, in which /home/ is the download path for go-hpb; continue to type make all to compile.

root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# cd /home/go-hpb/
root@hpb-PowerEdge-R730xd:/home/go-hpb# make all
build/env.sh go run build/ci.go install ./cmd/ghpb
>>> /usr/lib/go-1.9/bin/go install -ldflags -X main.gitCommit=89d88c8e23f7761a76dd8eebe9b08fd3750a04b6 -v ./cmd/ghpb
github.com/hpb-project/go-hpb/vendor/golang.org/x/text/encoding/internal/identifier
...
Done building.
Run "/home/go-hpb/build/bin/promfile" to launch promfile.
cp "/home/go-hpb/network/iperf3/iperf3" "/home/go-hpb/build/bin/iperf3"
cp "/home/go-hpb/network/p2p/binding.json" "/home/go-hpb/build/bin/binding.json"
cp "/home/go-hpb/network/p2p/config.json" "/home/go-hpb/build/bin/config.json"
(15) Copy into program execution path

Input sudo cp build/bin/. /home/ghpb-bin2/; continue to type cd /home/ghpb-bin2/, in which /home/ghpb-bin2/ is the program execution path set for you;

root@hpb-PowerEdge-R730xd:/home/go-hpb# sudo cp build/bin/* /home/ghpb-bin2/
root@hpb-PowerEdge-R730xd:/home/go-hpb# cd /home/ghpb-bin2/
(16) Start node
  • Start bootnode

Inputsudo nohup ./ghpb --datadir node1/data --networkid 66300 --port 3001 --rpcaddr 0.0.0.0 --rpcport 8541 --verbosity 3 --rpc --rpcapi hpb,web3,admin,txpool,debug,personal,net --nodetype bootnode . bootnode.log & start bootnode; input sudo ./ghpb attach http://127.0.0.1:8541 to access node. The example is the second account created. Note: 66300 is the network number set in step 8.

 root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# sudo nohup ./ghpb --datadir node1/data --networkid 66300 --port 3001  --rpcaddr 0.0.0.0 --rpcport 8541  --verbosity  3  --rpc  --rpcapi    hpb,web3,admin,txpool,debug,personal,net --nodetype bootnode > bootnode.log &
 [1] 29938
 root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# nohup: ignoring input and redirecting stderr to stdout
root@hpb-PowerEdge-R730xd:/home/ghpb-bin2# sudo ./ghpb attach http://127.0.0.1:8541
 Welcome to the GHPB JavaScript console!
 instance: 
 coinbase: 0xfc6661501b4faf424d2ed61855a134fa5b2de3ef
at block: 0 (Wed, 19 Sep 2018 08:57:13 EDT)
  datadir: /home/ghpb-bin2/node1/data
  modules: admin:1.0 debug:1.0 hpb:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
 >

• Start the first miner node

Open another console window and input sudo ./ghpb --datadir node/data --unlock "first account address" --networkid 66300 --port 3002 --rpcaddr 0.0.0.0 --rpcport 8542 --verbosity 3 - -rpc --rpcapi hpb, web3, admin, txpool, debug, personal, net console --testmode input account password as prompted; continue to type miner.start() to start mining. In the example, the first account created is "0x04cbf60fdcc485a76b0b8a389da7bd87da180edd";

 root@hpb-PowerEdge-R730xd:/home/ghpb-bin2#sudo ./ghpb --datadir node/data  --unlock "0x04cbf60fdcc485a76b0b8a389da7bd87da180edd" --networkid 66300 --port 3002  --rpcaddr 0.0.0.0 --rpcport 8542  --verbosity  3  --rpc  --rpcapi    hpb,web3,admin,txpool,debug,personal,net console --testmode
 INFO [09-19|22:59:21]  HPB : Create New HpbConfig object 
 INFO [09-19|22:59:21]  HPB : Initialising Hpb node             network=66300
 INFO [09-19|22:59:21]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node/data/ghpb/chaindata cache=128 handles=1024
 INFO [09-19|22:59:25]  HPB : set coinbase of node              : =0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
 Unlocking account 0x04cbf60fdcc485a76b0b8a389da7bd87da180edd | Attempt 1/3
 Passphrase: 
 ERROR[09-19|22:59:28]  HPB : ---------the password file is     : =123
 INFO [09-19|22:59:29]  HPB : Unlocked account                  address=0x04CbF60FdCc485a76b0B8a389Da7BD87dA180eDd
 INFO [09-19|22:59:29]  HPB : Loaded most recent local header   number=0 hash=e46058…896936 td=1
 INFO [09-19|22:59:29]  HPB : Loaded most recent local full block number=0 hash=e46058…896936 td=1
 INFO [09-19|22:59:29]  HPB : Loaded most recent local fast block number=0 hash=e46058…896936 td=1
 INFO [09-19|22:59:29]  HPB : Set coinbase address by start     address=0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
 INFO [09-19|22:59:29]  HPB : Change node local type            from=UnknownNode to=PreNode
 INFO [09-19|22:59:29]  HPB : Set Init Local Type by p2p        type=PreNode
 INFO [09-19|22:59:29]  HPB : Starting P2P networking 
 INFO [09-19|22:59:31]  HPB : UDP listener up                   self=hnode://edab938abbc31c4c94a55123d4384739ccbfa525f60269a96ec78196b498b47798c874fb3be6af4cde08ad18fba8e14936c20374fab7c6e3ad0bf5d1816c5ae5@[::]:3002
 INFO [09-19|22:59:31]  HPB : Server start with type.           NodeType=PreNode
 INFO [09-19|22:59:31]  HPB : Start server of bandwidth test.   port=3102
 INFO [09-19|22:59:31]  HPB : IPC endpoint opened: /home/ghpb-bin2/node/data/ghpb.ipc 
 INFO [09-19|22:59:31]  HPB : HTTP endpoint opened: http://0.0.0.0:8542 
 Welcome to the GHPB JavaScript console!
 
 instance: 
 coinbase: 0xfc6661501b4faf424d2ed61855a134fa5b2de3ef
 at block: 0 (Wed, 19 Sep 2018 08:57:13 EDT)
  datadir: /home/ghpb-bin2/node/data
  modules: admin:1.0 debug:1.0 hpb:1.0 miner:1.0 net:1.0 personal:1.0 prometheus:1.0 rpc:1.0 txpool:1.0 web3:1.0

 > miner.start()
 INFO [09-20|02:51:23]  HPB : miner start : : 
 INFO [09-20|02:51:23]  HPB : Transaction pool price threshold updated price=18000000000
INFO [09-20|02:51:23]  HPB : Starting mining operation 
 null
  • Start the second mining node

    Open another console window and type sudo ./ghpb --datadir node2/data --unlock "third account address" --networkid 66300 --port 3003 --rpcaddr 0.0.0.0 --rpcport 8543 --verbosity 3 - -rpc --rpcapi hpb, web3, admin, txpool, debug, personal, net console --testmode Enter the account password as prompted;

    Continue to type miner.start() to start mining. In the example, the third account created is "0x552a49773698c75b7fbb47f1a3486f6394cc4385" (please remind to add prefix 0x);

root@hpb-PowerEdge-R730xd:/home/ghpb-bin2#sudo ./ghpb --datadir node2/data  --unlock "0x552a49773698c75b7fbb47f1a3486f6394cc4385" --networkid 66300 --port 3003  --rpcaddr 0.0.0.0 --rpcport 8543  --verbosity  3  --rpc  --rpcapi    hpb,web3,admin,txpool,debug,personal,net console --testmode
INFO [09-19|22:43:55]  HPB : Create New HpbConfig object 
INFO [09-19|22:43:55]  HPB : Initialising Hpb node             network=66300
INFO [09-19|22:43:55]  HPB : Allocated cache and file handles  database=/home/ghpb-bin2/node2/data/ghpb/chaindata cache=128 handles=1024
INFO [09-19|22:43:58]  HPB : set coinbase of node              : =0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
Unlocking account 0x552a49773698c75b7fbb47f1a3486f6394cc4385 | Attempt 1/3
Passphrase: 
ERROR[09-19|22:44:00]  HPB : ---------the password file is     : =123
INFO [09-19|22:44:01]  HPB : Unlocked account                  address=0x552a49773698c75b7fbb47f1a3486f6394cC4385
INFO [09-19|22:44:01]  HPB : Loaded most recent local header   number=0 hash=e46058…896936 td=1
INFO [09-19|22:44:01]  HPB : Loaded most recent local full block number=0 hash=e46058…896936 td=1
INFO [09-19|22:44:01]  HPB : Loaded most recent local fast block number=0 hash=e46058…896936 td=1
INFO [09-19|22:44:01]  HPB : Set coinbase address by start     address=0xfc6661501B4faf424D2ed61855A134fa5b2dE3EF
INFO [09-19|22:44:01]  HPB : Change node local type            from=UnknownNode to=PreNode
INFO [09-19|22:44:01]  HPB : Set Init Local Type by p2p        type=PreNode
INFO [09-19|22:44:01]  HPB : Starting P2P networking 
INFO [09-19|22:44:03]  HPB : UDP listener up                   self=hnode://24eae2a34e82cfb520d508c54f9a06e0951f37a78455f418296bbe011a1bd2e24b386758bbe45ad39e648d1ec375f438a45af2ec6796b7576c5dd4732ea5cccc@[::]:3003
INFO [09-19|22:44:03]  HPB : Server start with type.           NodeType=PreNode
INFO [09-19|22:44:03]  HPB : Start server of bandwidth test.   port=3103
INFO [09-19|22:44:03]  HPB : IPC endpoint opened: /home/ghpb-bin2/node2/data/ghpb.ipc 
INFO [09-19|22:44:03]  HPB : HTTP endpoint opened: http://0.0.0.0:8543 
Welcome to the GHPB JavaScript console!

instance: 
coinbase: 0xfc6661501b4faf424d2ed61855a134fa5b2de3ef
at block: 0 (Wed, 19 Sep 2018 08:57:13 EDT)
 datadir: /home/ghpb-bin2/node2/data
 modules: admin:1.0 debug:1.0 hpb:1.0 miner:1.0 net:1.0 personal:1.0 prometheus:1.0 rpc:1.0 txpool:1.0 web3:1.0

> INFO [09-19|22:44:05]  HPB : Verify the remote hardware.       id=ad65b8d7efc85c50 result=false
INFO [09-19|22:44:05]  HPB : P2P set init peer remote type prenode (TestMode) id=ad65b8d7efc85c50 port=3001
INFO [09-19|22:44:05]  HPB : Network has register peer to syncer id=ad65b8d7efc85c50 port=3001
INFO [09-19|22:44:05]  HPB : Start hpb message loop.           id=ad65b8d7efc85c50 port=3001
Clone this wiki locally