在线/离线环境下部署 区块链FISCO BCOS 3.11.0

在线:

复制代码
# 下载建链脚本
curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v3.11.0/build_chain.sh && chmod u+x build_chain.sh

# Note: 若访问git网速太慢,可尝试如下命令下载建链脚本:
curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v3.6.0/build_chain.sh && chmod u+x build_chain.sh

# 键入bash build_chain.sh -h展示脚本用法及参数
$ bash build_chain.sh
Usage:
air
    -C <Command>                        [Optional] the command, support 'deploy' and 'expand' now, default is deploy
    -g <group id>                       [Optional] set the group id, default: group0
    -I <chain id>                       [Optional] set the chain id, default: chain0
    -v <FISCO-BCOS binary version>      [Optional] Default is the latest v3.10.0
    -l <IP list>                        [Required] "ip1:nodeNum1,ip2:nodeNum2" e.g:"192.168.0.1:2,192.168.0.2:3"
    -L <fisco bcos lightnode exec>      [Optional] fisco bcos lightnode executable, input "download_binary" to download lightnode binary or assign correct lightnode binary path
    -e <fisco-bcos exec>                [Optional] fisco-bcos binary exec
    -t <mtail exec>                     [Optional] mtail binary exec
    -o <output dir>                     [Optional] output directory, default ./nodes
    -p <Start port>                     [Optional] Default 30300,20200 means p2p_port start from 30300, rpc_port from 20200
    -s <SM model>                       [Optional] SM SSL connection or not, default is false
    -H <HSM model>                      [Optional] Whether to use HSM(Hardware secure module), default is false
    -c <Config Path>                    [Required when expand node] Specify the path of the expanded node config.ini, config.genesis and p2p connection file nodes.json
    -d <CA cert path>                   [Required when expand node] When expanding the node, specify the path where the CA certificate and private key are located
    -D <docker mode>                    Default off. If set -D, build with docker
    -E <Enable debug log>               Default off. If set -E, enable debug log
    -a <Auth account>                   [Optional] when Auth mode Specify the admin account address.
    -w <WASM mode>                      [Optional] Whether to use the wasm virtual machine engine, default is false
    -R <Serial_mode>                    [Optional] Whether to use serial execute,default is true
    -k <key page size>                  [Optional] key page size, default is 10240
    -m <fisco-bcos monitor>             [Optional] node monitor or not, default is false
    -i <fisco-bcos monitor ip/port>     [Optional] When expanding the node, should specify ip and port
    -M <fisco-bcos monitor>             [Optional] When expanding the node, specify the path where prometheus are located
    -z <Generate tar packet>            [Optional] Pack the data on the chain to generate tar packet
    -n <node key path>                  [Optional] set the path of the node key file to load nodeid
    -N <node path>                      [Optional] set the path of the node modified to multi ca mode
    -u <multi ca path>                  [Optional] set the path of another ca for multi ca mode
    -6 <ipv6 mode>                      [Optional] IPv6 mode use :: as default listen ip, default is false
    -T <Consensus Algorithm>            [Optional] Default PBFT. Options can be pbft / rpbft, pbft is recommended
    -h Help
pro or max
    -C <Command>                        [Optional] the command, support 'deploy' now, default is deploy
    -g <group id>                       [Optional] set the group id, default: group0
    -I <chain id>                       [Optional] set the chain id, default: chain0
    -V <chain version>                  [Optional] support 'air'、'pro'、'max', default is 'air'
    -l <IP list>                        [Required] "ip1:nodeNum1,ip2:nodeNum2" e.g:"192.168.0.1:2,192.168.0.2:3"
    -p <Start port>                     [Optional] Default 30300、20200、40400、2379 means p2p_port start from 30300, rpc_port from 20200, tars_port from 40400, tikv_port default 2379
    -e <service binary path>            [Optional] rpc gateway node service binary path
    -y <service binary download type>   [Optional] rpc gateway node service binary download type, default type is cdn
    -v <service binary version>         [Optional] Default is the latest v3.10.0
    -r <service binary download path>   [Optional] service binary download path, default is binary
    -c <Config Path>                    [Optional] Specify the path of the deploy node config.toml
    -t <deploy type>                    [Optional] support 'rpc'、'gateway'、'node'、'all', default is 'all'
    -o <output dir>                     [Optional] output directory, default genearted
    -s <SM model>                       [Optional] SM SSL connection or not, default is false
    -h Help

deploy nodes e.g
    bash build_chain.sh -p 30300,20200 -l 127.0.0.1:4 -o nodes -e ./fisco-bcos
    bash build_chain.sh -p 30300,20200 -l 127.0.0.1:4 -o nodes -e ./fisco-bcos -m
    bash build_chain.sh -p 30300,20200 -l 127.0.0.1:4 -o nodes -e ./fisco-bcos -s
expand node e.g
    bash build_chain.sh -C expand -c config -d config/ca -o nodes/127.0.0.1/node5 -e ./fisco-bcos
    bash build_chain.sh -C expand -c config -d config/ca -o nodes/127.0.0.1/node5 -e ./fisco-bcos -m -i 127.0.0.1:5 -M monitor/prometheus/prometheus.yml
    bash build_chain.sh -C expand -c config -d config/ca -o nodes/127.0.0.1/node5 -e ./fisco-bcos -s
    bash build_chain.sh -C expand_lightnode -c config -d config/ca -o nodes/lightnode1
    bash build_chain.sh -C expand_lightnode -c config -d config/ca -o nodes/lightnode1 -L ./fisco-bcos-lightnode
modify node e.g
    bash build_chain.sh -C modify -N ./node0 -u ./ca/ca.crt
    bash build_chain.sh -C modify -N ./node0 -u ./ca/ca.crt -s
deploy pro service e.g
    bash build_chain.sh -p 30300,20200 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -t all
    bash build_chain.sh -p 30300,20200 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -t all -s
    bash build_chain.sh -p 30300,20200 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -e ./binary
    bash build_chain.sh -p 30300,20200,40400 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -y cdn -v v3.10.0 -r ./binaryPath
deploy max service e.g
    bash build_chain.sh -p 30300,20200,40400,2379 -l 172.31.184.227:1,172.30.93.111:1,172.31.184.54:1,172.31.185.59:1 -C deploy -V max -o generate -t all
    bash build_chain.sh -p 30300,20200,40400,2379 -l 172.31.184.227:1,172.30.93.111:1,172.31.184.54:1,172.31.185.59:1 -C deploy -V max -o generate -t all -e ./binary -s
    bash build_chain.sh -p 30300,20200,40400,2379 -l 172.31.184.227:1,172.30.93.111:1,172.31.184.54:1,172.31.185.59:1 -C deploy -V max -o generate -y cdn -v v3.10.0 -r ./binaryPath
    bash build_chain.sh -c config.toml -C deploy -V max -o generate -t all
expand pro node e.g
    bash build_chain.sh -C expand_node -V pro -o expand_node -c ./config.toml
expand pro rpc/gateway e.g
    bash build_chain.sh -C expand_service -V pro -o expand_service -c ./config.toml
expand pro group e.g
    bash build_chain.sh -C expand_group -V pro -o expand_group -c ./config.toml
expand max node e.g
    bash build_chain.sh -C expand_node -V max -o expand_node -c ./config.toml
expand max rpc/gateway e.g
    bash build_chain.sh -C expand_service -V max -o expand_service -c ./config.toml

# 两个节点的P2P服务分别占用30300和30301端口,RPC服务分别占用20200和20201端口
# -L 启动轻节点模块,"download_binary" 默认拉去最新版本二进制文件
$ bash build_chain.sh -p 30300,20200 -l 127.0.0.1:2 -L download_binary
# 指定轻节点二进制路径
$ bash build_chain.sh -p 30300,20200 -l 127.0.0.1:2 -L /bin/fisco-bcos-lightnode

启动

复制代码
cd ./nodes/127.0.0.1
bash start_all.sh

验证:

复制代码
cat node0/log/fisco-bcos.log | grep "start successfully"

离线(X86):

下载所有依赖文件:https://download.csdn.net/download/weixin_38959210/92451367

导入包:

复制代码
#tassl-1.1.1b-linux-x86_64
mkdir -p /root/.fisco
tar -zxvf tassl-1.1.1b-linux-x86_64.tar.gz -C /root/.fisco
mv /root/.fisco/tassl-1.1.1b-linux-x86_64 /root/.fisco/tassl-1.1.1b

#get_account.sh
mv get_account.sh /root/.fisco/get_account.sh

启动脚本

复制代码
# 键入bash build_chain.sh -h展示脚本用法及参数
bash build_chain.sh

提示:

脚本build_chain.sh尝试调用路径/root/.fisco/tassl-1.1.1b,提示报错

解决办法:

复制代码
#tassl-1.1.1b-linux-x86_64
mkdir -p /root/.fisco
tar -zxvf tassl-1.1.1b-linux-x86_64.tar.gz -C /root/.fisco
mv /root/.fisco/tassl-1.1.1b-linux-x86_64 /root/.fisco/tassl-1.1.1b

#指定轻节点二进制路径

复制代码
# 指定轻节点二进制路径
bash build_chain.sh -p 30300,20200 -l 127.0.0.1:2 -L ./bin/fisco-bcos-lightnode -e ./bin/fisco-bcos

启动前请将下面文件放入同级 bin 目录中

复制代码
fisco-bcos-lightnode-linux-x86_64.tar.gz
fisco-bcos-linux-x86_64.tar.gz
fisco-bcos-lightnode
fisco-bcos

启动

复制代码
cd ./nodes/127.0.0.1
bash start_all.sh

验证:

复制代码
cat node0/log/fisco-bcos.log | grep "start successfully"
相关推荐
小明的小名叫小明41 分钟前
区块链核心知识点梳理(面试高频考点4)-以太坊交易全流程
面试·区块链
微三云、小叶1 小时前
酒店 RWA 模式深度拆解:资产轻量化与投资普惠化的双重突破路径
大数据·人工智能·区块链
小明的小名叫小明1 小时前
区块链核心知识点梳理(面试高频考点3)-共识机制详解(POW、POS、POH)
面试·区块链
古城小栈21 小时前
Go实现的区块链 分片技术优化
golang·区块链·php
公链开发1 天前
区块链赋能乡村振兴:重塑信任,激活乡土新价值
区块链
TechubNews1 天前
Stripe 拟于本月 12 日上线稳定币支付功能
web3·区块链
兵bing1 天前
区块链理解
区块链
公链开发1 天前
开发一条公链大概得多少钱?
去中心化·区块链
小明的小名叫小明1 天前
Solidity入门(6)-合约实战2
区块链