目录
环境依赖
1、下载【build_chain.sh】
2、脚本命令参数
3、生成区块链配置文件ip_list:
4、调用build_chain.sh脚本构建区块链节点:
5、启动节点
6、查看节点进程
总结:
环境依赖
名称 | 版本 | FISCO BCOS | 2.0 | openssl | >=1.0.2 | curl | 未知 |
1、下载【build_chain.sh】
执行命令,安装openssl、curl(如果系统上已经安装好了,可以不用安装)
apt-get install openssl curl
?执行命令,下载build_chain.sh
curl -#LO https://gitee.com/FISCO-BCOS/FISCO-BCOS/raw/master-2.0/tools/build_chain.sh && chmod u+x build_chain.sh
2、脚本命令参数
root@ubuntu:~/fisco# ./build_chain.sh
Usage:
-l <IP list> [Required] "ip1:nodeNum1,ip2:nodeNum2" e.g:"192.168.0.1:2,192.168.0.2:3"
-f <IP list file> [Optional] split by line, every line should be "ip:nodeNum agencyName groupList p2p_port,channel_port,jsonrpc_port". eg "127.0.0.1:4 agency1 1,2 30300,20200,8545"
-v <FISCO-BCOS binary version> Default is the latest v2.8.0
-e <FISCO-BCOS binary path> Default download fisco-bcos from GitHub. If set -e, use the binary at the specified location
-o <Output Dir> Default ./nodes/
-p <Start Port> Default 30300,20200,8545 means p2p_port start from 30300, channel_port from 20200, jsonrpc_port from 8545
-q <List FISCO-BCOS releases> List FISCO-BCOS released versions
-i <Host ip> Default 127.0.0.1. If set -i, listen 0.0.0.0
-s <DB type> Default rocksdb. Options can be rocksdb / mysql / scalable, rocksdb is recommended
-d <docker mode> Default off. If set -d, build with docker
-c <Consensus Algorithm> Default PBFT. Options can be pbft / raft /rpbft, pbft is recommended
-C <Chain id> Default 1. Can set uint.
-g <Generate guomi nodes> Default no
-z <Generate tar packet> Default no
-t <Cert config file> Default auto generate
-6 <Use ipv6> Default no. If set -6, treat IP as IPv6
-k <The path of ca root> Default auto generate, the ca.crt and ca.key must in the path, if use intermediate the root.crt must in the path
-K <The path of sm crypto ca root> Default auto generate, the gmca.crt and gmca.key must in the path, if use intermediate the gmroot.crt must in the path
-D <Use Deployment mode> Default false, If set -D, use deploy mode directory struct and make tar
-G <channel use sm crypto ssl> Default false, only works for guomi mode
-X <Certificate expiration time> Default 36500 days
-T <Enable debug log> Default off. If set -T, enable debug log
-S <Enable statistics> Default off. If set -S, enable statistics
-F <Disable log auto flush> Default on. If set -F, disable log auto flush
-E <Enable free_storage_evm> Default off. If set -E, enable free_storage_evm
-h Help
e.g
./build_chain.sh -l "127.0.0.1:4"
3、生成区块链配置文件ip_list:
#ip_list文件内容格式:[ip]:[节点数] [机构名] [所属群组列表]
cat > ipconf << EOF
127.0.0.1:2 arbitrator 1,2,3
127.0.0.1:2 agencyA 1
127.0.0.1:2 agencyB 2
127.0.0.1:2 agencyC 3
EOF
4、调用build_chain.sh脚本构建区块链节点:
./build_chain.sh -f ipconf -p 30300,20200,8545
区块链节点配置成功后,会看到[INFO] All completed.的输出。在当前目录会生成nodes目录
5、启动节点
生成区块链节点后,需要启动所有节点,节点提供start_all.sh和stop_all.sh脚本启动和停止节点。
./nodes/127.0.0.1/start_all.sh
6、查看节点进程
ps aux | grep fisco-bcos
不发交易时,共识正常的节点会输出+++日志
总结:
在构建节点的时候,需要注意端口号是否被占用。执行脚本,需要确认好路径
|