Skip to content

How to build HPB full nodes in a quick manner through docker

Nicemanss edited this page Aug 20, 2019 · 3 revisions
Step 0 Switch to root user

Switch to root and enter the root password for permissions as prompted.

root@iZ8vbgcelr86h0i2rbfshaZ:/# su root
Step 1 Download the mirror image

Download the mirror image via docker pull hpbbc/go-hpb.

root@iZ8vbgcelr86h0i2rbfshaZ:~# docker pull hpbbc/go-hpb
Using default tag: latest
latest: Pulling from hpbbc/go-hpb
Digest: sha256:3ecb483ca70883c390c55ceada92f7c0726e13afaebea2029dfe1c208dbe0094
Status: Image is up to date for hpbbc/go-hpb:latest
root@iZ8vbgcelr86h0i2rbfshaZ:~#
Step 2 Run the following command

  Enter docker images to check if the image file hpbbc/go-hpb is already installed.

root@iZ8vbgcelr86h0i2rbfshaZ:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hpbbc/go-hpb        latest              a3ebf0866f79        5 weeks ago         42MB
ghpb                v1.0.2.3            a3ebf0866f79        5 weeks ago         42MB
Step 3 Create a new /home/ghpb-bin/node/ directory

Type in mkdir -p /home/ghpb-bin/node/

root@iZ8vbgcelr86h0i2rbfshaZ:/# mkdir -p /home/ghpb-bin/node/
root@iZ8vbgcelr86h0i2rbfshaZ:/# 
Step 4 Download gensis.json
root@iZ8vbgcelr86h0i2rbfshaZ:~#  wget https://raw.githubusercontent.com/hpb-project/hpb-release/master/config/gensis.json -P /home/ghpb-bin/node/
Step 5 Create a new keystore directory.

Type in mkdir -p /home/ghpb-bin/node/datafull/keystore to upload a keystore file to the directory (For any keystore file, the encrypted private key file is used to start the node without any usage, as a result, a new one can be created).

root@iZ8vbgcelr86h0i2rbfshaZ:/# mkdir -p /home/ghpb-bin/node/datafull/keystore
Step 6 Initialize the configuration

​ Type in docker run -it --rm --privileged=true -v /home/ghpb-bin/node/:/root/node/ --name ghpbinit hpbbc/go-hpb:latest --datadir /root/node/data init /root/node/gensis.json to initialize the configuration.

root@iZ8vbgcelr86h0i2rbfshaZ:/# docker run -it --rm --privileged=true  -v /home/ghpb-bin/node/:/root/node/ --name ghpbinit hpbbc/go-hpb:latest --datadir /root/node/data init /root/node/gensis.json

INFO [11-01|09:48:41]  HPB : Create New HpbConfig object 
INFO [11-01|09:48:41]  HPB : Allocated cache and file handles  database=/root/node/data/ghpb/chaindata cache=16 handles=16
INFO [11-01|09:48:41]  HPB : Writing custom genesis block 
INFO [11-01|09:48:41]  HPB : Successfully wrote genesis state  database=chaindata                      hash=9c3704…f39966
Step 7 Start the Nodes

​ Type in docker run -itd --privileged=true --restart=always -v /home/ghpb-bin/node/:/root/node/ -p 8545:8545 -p 30303:30303 -p 8546:8546 --name ghpb1 hpbbc/go-hpb:latest --datadir /root/node/data --networkid 100 --verbosity 3 --rpc --rpcaddr 0.0.0.0 --rpcapi hpb,web3,admin,txpool,debug,personal,net,miner,prometheus --nodetype synnode console to start the nodes.

root@iZ8vbgcelr86h0i2rbfshaZ:/# docker run -itd --privileged=true --restart=always -v /home/ghpb-bin/node/:/root/node/ -p 8545:8545 -p 30303:30303 -p 8546:8546 --name ghpb1 hpbbc/go-hpb:latest --datadir /root/node/data --networkid 100 --verbosity 3 --rpc --rpcaddr 0.0.0.0 --rpcapi hpb,web3,admin,txpool,debug,personal,net,miner,prometheus --nodetype synnode console
ccab756a76b13a720b41c0bb7dd35383d36169dc3074e22d0b220170da7826ff

Step 8 Enter the Console

Type in docker attach ghpb1to enter the console.

root@iZ8vbgcelr86h0i2rbfshaZ:/# docker attach ghpb1 
INFO [11-01|09:55:46]  HPB : UDP listener up                   self=hnode://e25f1e2aafcec4525e6c65c5b7dc8fb6e683711aa9b58bee92ab1651f9fa6bbeb37de7b0a61b8b533eb19e2e57f2decfca6bb9eb338e9926dbf8f30e64f1c1b3@[::]:30303
INFO [11-01|09:55:46]  HPB : Server start with type.           NodeType=SynNode
INFO [11-01|09:55:46]  HPB : Start server of bandwidth test.   port=30403
INFO [11-01|09:55:46]  HPB : IPC endpoint opened               url=/root/node/data/ghpb.ipc
INFO [11-01|09:55:46]  HPB : HTTP endpoint opened              url=http://0.0.0.0:8545      cors= vhosts=localhost,localhost
Welcome to the GHPB JavaScript console!

instance: 
coinbase: 0xaed85c944a8a96c2714532b00676337e0d986811
at block: 0 (Thu, 23 Aug 2018 13:45:41 UTC)
 datadir: /root/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

>
Step 9 Exit the docker Console

Press Ctrl+p+q to exit the current docker container console.。

INFO [11-01|10:08:10]  HPB : Inserted new block                number=656094 hash=67a92f…8b7b1a
INFO [11-01|10:08:10]  HPB : Imported new chain segment        blocks=1  txs=0 mgas=0.000 elapsed=7.058ms  mgasps=0.000 number=656094 hash=67a92f…8b7b1a
######### peers length is: 2
read escape sequence
Step 10 View the Node Log

​ Type in docker logs -f ghpb1 to view the node log

root@iZ8vbgcelr86h0i2rbfshaZ:/# docker logs -f ghpb1
Clone this wiki locally