节点接入测试网testnet

Docker 环境接入测试网testnet


在参考build节点镜像 for Docker配置文件说明

本地目录结构如下

~/workspace/wicc/WaykiChain_testnet$tree
.
├── bin
│   └── run-waykicoind-test.sh
└── conf
    └── WaykiChain.conf

《启动脚本》内容run-waykicoind-test.sh

docker run --name waykicoind-testnet -p 18920:18920 -p 6967:6968 \
  -v `pwd`/conf/WaykiChain.conf:/root/.WaykiChain/WaykiChain.conf \
  -v `pwd`/data:/root/.WaykiChain/testnet \
  -v `pwd`/bin:/opt/wicc/bin \
  -v `pwd`/lua:/tmp/lua \
  -d wicc/waykicoind:3.2

《配置文件》内容WaykiChain.conf

#nettype=main|test|regtest
nettype=test
rpcserver=1
rpcallowip=0.0.0.0/0
rpcport=6968
rpcuser=wiccuser
rpcpassword=wicc1000
rpcthreads=8
logprinttoconsole=0
logprinttofile=1
logprintfileline=1
logtimestamps=1
listen=1
disablesafemode=1
genblock=0
genblocklimit=1000000
debug=INFO

注意 genblock参数为设置是否生产块,0表示不生产,1为生产的必要条件

启动Docker节点

sh bin/run-waykicoind-test.sh

example

~/workspace/wicc/WaykiChain_testnet$sh bin/run-waykicoind-test.sh
36a4a678512915b0e673cc45cbd2c27be40598be1e6fec130d161b9bad3059fa
~/workspace/wicc/WaykiChain_testnet$docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                 NAMES
284cb238ac8a        wicc/waykicoind     "./coind"           6 seconds ago       Up 5 seconds        8920/tcp, 0.0.0.0:6967->6968/tcp, 0.0.0.0:18920->18920/tcp           waykicoind-testnet
~/workspace/wicc/WaykiChain_testnet$

检查docker中节点是否正常运行

docker exec -it waykicoind-testnet /bin/bash

example

~/workspace/wicc/WaykiChain_testnet$docker exec -it waykicoind-testnet /bin/bash
root@284cb238ac8a:/opt/wicc# coind getinfo
{
    "version" : "v3.2.0.1-78dc7178-release-linux (2020-08-04 18:52:02 +0800)",
    "protocol_version" : 10001,
    "net_type" : "TEST_NET",
    "proxy" : "",
    "public_ip" : "183.239.240.22",
    "conf_dir" : "/root/.WaykiChain/WaykiChain.conf",
    "data_dir" : "/root/.WaykiChain/testnet",
    "block_interval" : 3,
    "genblock" : 0,
    "time_offset" : 0,
    "WICC_balance" : 0,
    "WUSD_balance" : 0,
    "WGRT_balance" : 0,
    "relay_fee_perkb" : 1000,
    "tipblock_tx_count" : 2,
    "tipblock_fuel_rate" : 1,
    "tipblock_fuel" : 0,
    "tipblock_time" : 1570535136,
    "tipblock_hash" : "f99c82071e02556e1c462231121d0a10d702d02a4dace148abf1240a871e5a3f",
    "tipblock_height" : 8806,
    "synblock_height" : 6401676,
    "finblock_height" : 0,
    "finblock_hash" : "0000000000000000000000000000000000000000000000000000000000000000",
    "connections" : 1,
    "errors" : "",
    "state" : "IBD"
}
root@284cb238ac8a:/opt/wicc#

如果返回值同上,说明节点接入测试网testnet成功了,耐心等待区块同步吧!

本地环境接入测试网testnet


在参考本地build配置文件说明

本地目录/opt/wicc结构如下

root@ubuntu:/opt/wicc# ls
coind  WaykiChain

本地目录~/.WaykiChain 有WaykiChain.conf

root@ubuntu:~/.WaykiChain#ls
WaykiChain.conf

配置文件内容WaykiChain.conf

#nettype=main|test|regtest
nettype=test
rpcserver=1
rpcallowip=0.0.0.0/0
rpcport=6968
rpcuser=wiccuser
rpcpassword=wicc1000
rpcthreads=8
logprinttoconsole=0
logprinttofile=1
logprintfileline=1
logtimestamps=1
listen=1
disablesafemode=1
genblock=0
genblocklimit=1000000
debug=INFO

注意 genblock参数为设置是否生产块,0表示不生产,1为生产的必要条件

启动节点

命令如下,使之在后台运行

./coind &

检查节点运行是否正常

./coind getinfo

example

root@ubuntu:/opt/wicc# ./coind getinfo
{
    "version" : "v3.2.0.1-78dc7178-release-linux (2020-08-04 18:52:02 +0800)",
    "protocol_version" : 10001,
    "net_type" : "TEST_NET",
    "proxy" : "",
    "public_ip" : "183.239.240.22",
    "conf_dir" : "/root/.WaykiChain/WaykiChain.conf",
    "data_dir" : "/root/.WaykiChain/testnet",
    "block_interval" : 3,
    "genblock" : 0,
    "time_offset" : 0,
    "WICC_balance" : 0,
    "WUSD_balance" : 0,
    "WGRT_balance" : 0,
    "relay_fee_perkb" : 1000,
    "tipblock_tx_count" : 2,
    "tipblock_fuel_rate" : 1,
    "tipblock_fuel" : 0,
    "tipblock_time" : 1570535136,
    "tipblock_hash" : "f99c82071e02556e1c462231121d0a10d702d02a4dace148abf1240a871e5a3f",
    "tipblock_height" : 8806,
    "synblock_height" : 6401676,
    "finblock_height" : 0,
    "finblock_hash" : "0000000000000000000000000000000000000000000000000000000000000000",
    "connections" : 1,
    "errors" : "",
    "state" : "IBD"
}
root@ubuntu:/opt/wicc#

如果返回值同上,说明节点接入测试网testnet成功了,耐心等待区块同步吧!