Fisco Bcos cluster environment construction

install software

Install python2.7

update package

sudo apt-get update

 

Install python2.7

sudo apt-get install python2.7

sudo apt update

 

Install python2.7 pip

sudo apt install python-pip

pip install --upgrade pip

 

Deploy fisco-bcos

Institution A

192.168.160.128

Institution B

192.168.160.130

 

download source code

cd ~/

git clone https://github.com/FISCO-BCOS/generator.git

Execute the installation script

cd ./generator

bash ./scripts/install.sh

get node binary

Pull the latest fisco-bcos binary file into meta

./generator --download_fisco ./meta --cdn

Check binary version

./meta/fisco-bcos -v

 

Initialize chain certificate

./generator --generate_chain_certificate ./dir_chain_ca

Initialize agency A

./generator --generate_agency_certificate ./dir_agency_ca ./dir_chain_ca agencyA

 

ls dir_agency_ca/agencyA/

 

Copy the chain certificate, organization certificate, and organization private key of organization A to the /generator/meta/ directory of organization A

cp ./dir_agency_ca/agencyA/* ./meta/

Initialize agency B

1. Execute the installation script and obtain the node binary, the same as organization A

2. Copy the contents of the dir_chain_ca folder of institution A to the /generator/ directory

Generating Organization B Certificate

./generator --generate_agency_certificate ./dir_agency_ca ./dir_chain_ca agencyB

ls dir_agency_ca/agencyB/

Send B's chain certificate, organization certificate, and organization private key to the /generator/meta/ directory of organization B

cp ./dir_agency_ca/agencyB/* ./meta/

ls meta

 

Modify the configuration file

Modify node_deployment.ini under the generator/conf folder of institution A

p2p_ip=Public IP address

rpc_ip=Intranet IP address (or 0.0.0.0)

 

Modify node_deployment.ini under the generator/conf folder of organization B

p2p_ip=Public IP address

rpc_ip=Intranet IP address (or 0.0.0.0)

 

Generate node information

Institution A generates node certificates and P2P connection information files

./generator --generate_all_certificates ./agencyA_node_info

ls ./agencyA_node_info

 

Institution B generates node certificates and P2P connection information files

./generator --generate_all_certificates ./agencyB_node_info

ls agencyB_node_info

ps: If agency B makes a mistake in this step, you need to delete the agencyB_node_info folder, as well as the node files and information generated under the meta folder, keep only the following content and regenerate the B node certificate

 

Creation agency collects node certificates

The institution that generates the genesis block needs a node certificate. In the example, institution A generates the genesis block. Therefore, in addition to sending the node P2P connection address file, institution B also needs to send the node certificate to institution A and place the institution B node agencyB_node_info folder cert_ *.crt file copy to the meta folder of institution A

 

The node connection information of each organization collects each other

For example: Institution A has more peersB.txt under its meta folder, and institution B has more peersA.txt under its meta folder, which contains the node connection information of the other party.

1. Copy the peers.txt file in the organization A directory to the meta folder of organization B and modify it to peersA.txt

2. Copy the peers.txt file in the organization B directory to the meta folder of organization A and modify it to peers B.txt

 

Generate Genesis Block

Institution A generates group 1 genesis block

cd conf

vim group_genesis. ini

[group]

group_id=1



[nodes]

node0=192.168.160.128:30300

node1=192.168.160.128:30301

node2=192.168.160.130:30300

node3=191.168.160.130:30301

node0= IP of server A : 30300

node1= IP of server A : 30301

node2= IP of server B : 30300

node3= IP of server B : 30301

 

Execute the command to generate the group genesis block configured by group_genesis.ini

./generator --create_group_genesis ./group

Distribute the genesis block of group 1 to institution B, manually copy, and the ./group/group.1.genesis file of institution A to the meta folder of institution B

start node

Institution A generates its own node

./generator --build_install_package ./meta/peersB.txt ./nodeA

Institution B generates its own node

./generator --build_install_package ./meta/peersA.txt ./nodeB

Nodes under their respective initiators

bash ./nodeA/start_all.sh

bash ./nodeB/start_all.sh

 

Check if the startup was successful

view process 

ps -ef | grep tax

View node log

tail -f ./node*/node*/log/log* | grep +++

 

closure

./stop_all.sh

build console

install java

Since the console requires a java environment, it is necessary to build java first

method one

# Install the default Java version (Java 8 or above)

sudo apt install -y default-jdk

# Query Java version

java -version

 

If you cannot download for a long time due to network problems, please try curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master/tools/download_console.sh && bash download_console.sh

cd console/conf/

Start the console

cd console 

./start.sh

Deploy smart contracts

deploy HelloWorld.sol

 

getBlockHashByNumber 1

Guess you like

Origin blog.csdn.net/yuch_hong/article/details/109312340