FISCO-BCOS group deployment

Node networking topology
A networking mode with 6 nodes, 3 organizations and 2 groups as shown in the figure. Organization B and Organization C are located in Group 1 and Group 2, respectively. Organization A belongs to both group 1 and group 2.
Insert picture description here
Machine environment

The IP and port numbers of each node are as follows:

mechanism node Belonging to the group P2P address RPC Channel listening address
Agency A Node 0 Group 1, 2 127.0.0.1:30300 127.0.0.1:8545 0.0.0.0:20200
- Node 1 Group 1, 2 127.0.0.1:30301 127.0.0.1:8546 0.0.0.0:20201
- Node 4 Group 1, 2 127.0.0.1:30304 127.0.0.1:8549 0.0.0.0:20202
Organization B Node 2 Group 1 127.0.0.1:30302 127.0.0.1:8547 0.0.0.0:20203
- Node 3 Group 1 127.0.0.1:30303 127.0.0.1:8548 0.0.0.0:20204
Institution C Node 5 Group 1, 2 127.0.0.1:30305 127.0.0.1:8550 0.0.0.0:20205

Key process

证书颁发机构
生成链证书ca
ca.crt,agency.crt,agency.key
配置node-deployment.ini
配置group_genesis.ini
node_deployment.ini
ca.crt,agency.crt,agency.key
配置node-deployment.ini
cert*.crt
cert*.crt
分发
peers.txt
peers.txt
node_deployment.ini
生成机构证书
generator
机构B获取机构证书
生成节点证书
收集节点证书
生成创世区块
收集节点P2P
机构A生成所属节点
节点启动
机构A获取机构证书
生成节点证书
收集节点证书
区块
收集节点P2P
机构B生成所属节点
节点启动

FISCO BCOS practical operation
Download and install

cd ~/ && git clone https://github.com/FISCO-BCOS/generator.git  
cd ~/generator && bash ./scripts/install.sh   //安装
./generator -h   //查看帮助信息

./generator --download_fisco ./meta  //拉取最新fisco-bcos二进制文
./meta/fisco-bcos -v  //查看版本

Alliance chain initialization

Initialization mechanism A, B

cp -r ~/generator ~/generator-A
cp -r ~/generator ~/generator-B

Initialize chain certificate

cd ~/generator 
./generator --generate_chain_certificate ./dir_chain_ca  //生成链证书ca.crt 链私钥ca.key

ls ./dir_chain_ca  //查看链证书及私钥:ca.crt  ca.key

//The organization generates the private key agency.key locally—>generates the request file—>the ​​certificate issuing authority obtains the agency.crt

//生成机构A证书
./generator --generate_agency_certificate ./dir_agency_ca ./dir_chain_ca agencyA
ls dir_agency_ca/agencyA/ 查看机构证书、机构私钥、链证书
cp ./dir_agency_ca/agencyA/* ~/generator-A/meta/
//机构B证书
./generator --generate_agency_certificate ./dir_agency_ca ./dir_chain_ca agencyB
cp ./dir_agency_ca/agencyA/* ~/generator-A/meta/

Organization A modifies the configuration file
node_deployment.ini to be the node configuration file, and the operation and maintenance deployment tool will generate relevant node certificates according to the configuration under node_deployment.ini, and generate node configuration folders, etc.

cd  ../generator-A
vim ~/generator-A/conf/node_deployment.ini
[node0]
p2p_listen_port=30300
channel_listen_port=20200
jsonrpc_listen_port=8545

[node1]
p2p_listen_port=30301
channel_listen_port=20201
jsonrpc_listen_port=8546

Modify node_deployment.ini file
Modify the following configuration

vim ~/generator-B/conf/node_deployment.ini

[node0]   
p2p_listen_port=30302
channel_listen_port=20202
jsonrpc_listen_port=8547

[node1]
p2p_listen_port=30303
channel_listen_port=20203
jsonrpc_listen_port=8548

Organizations A and B generate and send node information
1, generate node certificates, and p2p connection address files

cd ~/generator-A & ./generator --generate_all_certificates ./agencyA_node_info
cd ~/generator-B & ./generator --generate_all_certificates ./agencyB_node_info

2. Mutual storage of p2p address files

cp ~/generator-A/agencyA_node_info/peers.txt ~/generator-B/meta/peersA.txt
cp ~/generator-B/agencyB_node_info/peers.txt ~/generator-A/meta/peersB.txt

3. Mutual storage of node certificates

cp ./agencyA_node_info/cert*.crt ~/generator-B/meta/
cp ./agencyB_node_info/cert*.crt ~/generator-A/meta/

Institution A generates group 1 genesis block

cd ~/generator-A
vim ~/generator-A/conf/group_genesis.ini //修改机构A配置文件,用来生成创世块
/修改以下信息
[group]
group_id=1

[nodes]
node0=127.0.0.1:30300
node1=127.0.0.1:30301
node2=127.0.0.1:30302
node3=127.0.0.1:30303

Generate genesis block, which will be distributed to institution B

./generator --create_group_genesis ./group  //生成创世块

cp ./group/group.1.genesis ~/generator-B/meta //创世块分发

Generate A and B node information according to the node_deployment.ini file

cd ~/generator & ./generator --build_install_package ./meta/peersB.txt ./nodeA //生成节点nodeA
bash ./nodeA/start_all.sh  //启动节点nodeA

cd ~/generator & ./generator --build_install_package ./meta/peersA.txt ./nodeB //生成节点nodeB
 bash ./nodeB/start_all.sh

fisco bcos supports mysql as backend storage,
configure mysql storage

Modify the group.1.ini configuration file (30300, 30301, 30302, 30303) 4 files to configure the database

vim generator-A/nodeA/node_127.0.0.1_30300/conf/group.1.ini

修改配置如下:
type=mysql
db_username=root
db_passwd=123
db_name=自定义数据库名

Generate sdk certificate

cd generator-A & ./generator --generate_sdk_certificate ./dir_sdk_ca ./dir_agency_ca/agencyA/

Guess you like

Origin blog.csdn.net/rankiy/article/details/107340978