根据docker镜像,搭建HPB测试网络


#1

1.下载HPB测试网络的镜像,
docker pull hpbbc/go-hpb:test
2.新建目录
mkdir -p /home/ghpb-bin/node/
3.新建gensistest.json
{
“config”: {
“chainId”: 10000,
“prometheus”: {
“period”: 6,
“epoch”: 200
}
},
“nonce”: “0x0”,
“timestamp”: “0x5bd854a2”,
“extraData”: “0x6675636b0000000000000000000000000000000000000000000000000000000015fdb89718cc83a9d684d4576d76823d081926d84b22f1081d76e2ab3b4d5cc212f219cadfabb92e4fb59977c82204fa74de73a863d1d501a4f432135cca475768d0f72a5823ede35ccb1db2fe2fc071ec412e26a6cc3cea9ba2b1d9878936b356af61bdf62e223e3b16b2d1872a1884a3481a6e5e4b9b5c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000”,
“gasLimit”: “0x5f5e100”,
“difficulty”: “0x1”,
“mixHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“coinbase”: “0x0000000000000000000000000000000000000000”,
“alloc”: {
“2bb5033f3b50f693120a17869daf28e2063f6fe1”: {
“balance”: “100000000000000000000000000000”
},
“d1042a296260cea8e4141e90afcd04699e819c72”: {
“balance”: “100000000000000000000000000000”
},
“1d1606a87391ab404804646f8fe66f4fedb44c2a”: {
“balance”: “100000000000000000000000000000”
},
“d010e7084a0b02eef2c68a27b4a1958cfbd53d60”: {
“balance”: “100000000000000000000000000000”
},
“dab76bb911b6a5b5b03c2b774f4ef226d8a18592”: {
“balance”: “100000000000000000000000000000”
},
“3978f6e0265afa3e5b8793477a30f2cd7bf8971f”: {
“balance”: “100000000000000000000000000000”
},
“87412cad7f8ad81de508cc07f98f912ecef1a8c2”: {
“balance”: “100000000000000000000000000000”
},
“e9b53894397d31199c403b35502ea995d4125862”: {
“balance”: “100000000000000000000000000000”
},
“91ecfa4860af6c1affe292dc262a8ae1ea67048d”: {
“balance”: “100000000000000000000000000000”
},
“09fe745cff05b35cb06da6768586279018c08d7f”: {
“balance”: “100000000000000000000000000000”
}
},
“number”: “0x0”,
“gasUsed”: “0x0”,
“parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“hardwareRandom”: “0x0000000000000000000000000000000000000000000000000000000000000000”
}

4.初始化创世区块
docker run -it --rm --privileged=true -v /home/ghpb-bin/node/:/root/node/ --name ghpbinit hpbbc/go-hpb:test --datadir /root/node/datatest init /root/node/gensistest.json

5.创建节点账户
docker run -it --rm --privileged=true -v /home/ghpb-bin/node/:/root/node/ --name ghpbNewAccount hpbbc/go-hpb:test --datadir /root/node/datatest account new

6.启动测试网络的节点
docker run -it --privileged=true --restart=always -v /home/ghpb-bin/node/:/root/node/ -p 7545:7545 -p 50303:50303 --name ghpbtest hpbbc/go-hpb:test --datadir /root/node/datatest --networkid 10000 --port 50303 --rpcport 7545 --syncmode full --verbosity 3 --rpc --rpcaddr 0.0.0.0 --rpcapi hpb,web3,admin,txpool,debug,personal,net,miner,prometheus --nodetype synnode --testmode console

7.按Ctr+p+q退出控制台
8.docker attach ghpbtest进入控制台
9.docker logs -f ghpbtest查看测试节点日志