Deployment steps of FISCO-BCOS blockchain open source platform (2)

Chapter II deployment of Genesis node

2.1 initialize node environment

The path used in this article is / mydata/nodedata-1/

#Create directory
mkdir -p /mydata/nodedata-1/data/ #Store various files of the node
mkdir -p /mydata/nodedata-1/log/ #Storage log
mkdir -p /mydata/nodedata-1/keystore/ #Deposit account key

#Copy node configuration
cd /mydata/FISCO-BCOS/ 
cp genesis.json config.json log.conf start.sh stop.sh /mydata/nodedata-1/

2.2 profile modification

2.2.1 configuration of God account

cd /mydata/FISCO-BCOS/tool #tool folder in the code root directory
#Only pull the npm package once
cnpm install
node accountManager.js > godInfo.txt
#Get the address of the god account, and save the file of godInfo.txt generated above. This file contains the public and private keys and addresses of the administrator
cat godInfo.txt |grep address

vim /mydata/nodedata-1/genesis.json
#Replace the value of the god field in the file with the address obtained above

2.2.2 NodeId node identity configuration

Unique identification of the node

#Enter FISCO-BCOS
cd /mydata/FISCO-BCOS
vim cryptomod.json
#The "rlpcreatepath" field in the modification period is the current directory configuration. If it is used by default, it does not need to be modified
"rlpcreatepath":"/mydata/nodedata-1/data/network.rlp"

#Generate the node identity file in the directory set above
fisco-bcos --gennetworkrlp  cryptomod.json

cat /mydata/nodedata-1/data/network.rlp.pub
#The first step is to replace the NodeId obtained above with the initMinerNodes field of genesis.json
"initMinerNodes":["NodeId"]

#Step 2: modify the NodeId field under NodeextraInfo of config.json
vim /mydata/nodedata-1/config.json
"NodeextraInfo":[
    {
        "NodeId":"Generated NodeId"
    }

2.2.3 certificate generation

cp /mydata/FISCO-BCOS/genkey.sh /mydata/nodedata-1/data/ 
cd /mydata/nodedata-1/data/
chmod +x genkey.sh

#Root certificate generation
./genkey.sh ca #This step needs to follow the prompts to enter some information

#Node certificate generation
./genkey.sh server ./ca.key ./ca.crt #Note that the order of key and crt cannot be wrong; this step needs to input some information according to the prompt

2.2.4 configure log.conf (log configuration file)

This file can be generated by modifying the file generation path as required without special instructions

2.3 launch of Genesis node

List of node dependent files:

  • Certificate file (/ mydata/nodedata-1/data): ca.crt, server.crt, server.key
  • Node identity file (/ mydata/nodedata-1/data): network.rlp, network.rlp.pub
  • Configuration files (/ mydata/nodedata-1 /): genesis.json, config.json, log.conf

start-up

#Script startup
cd /mydata/nodedata-1/
chmod +x *.sh
./start.sh
#If you need to exit the node
#./stop.sh


#Manual start
cd /mydata/nodedata-1/
fisco-bcos --genesis ./genesis.json --config ./config.json & #Start blockchain node
tail -f log/info* |grep ++++  #View log output
#If you need to exit the node
#ps -ef |grep fisco-bcos #View process number
#kill -9 13432 #13432 is the viewed process number

If it is started normally, the package information will be continuously flashed out.

Keywords: JSON network vim npm

Added by fris on Wed, 01 Apr 2020 23:35:32 +0300