Build a blockchain network (ubantu)

1. Build an alliance chain

premise

curl is a command-line tool capable of network data transfer

 apt install -y openssl curl

Create an operation directory, download the installation script

 cd ~ && mkdir -p tax && cd tax 
 curl
 -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.9.1/build_chain.sh && chmod u+x 
 build_chain.sh
 

Build a 4-node alliance chain

 bash build_chain.sh -l 127.0.0.1:4 -s 30300,20200,8545

The -p option specifies the starting port, respectively p2p_port, channel_port, jsonrpc_port

Start the 4-node consortium chain

 bash nodes/127.0.0.1/start_all.sh

check operation

Check if the process is started
 ps -ef | grep -v grep | grep fisco-bcos
Check log output
 tail -f nodes/127.0.0.1/node0/log/log* | grep connected 
Check if consensus exists
 tail -f nodes/127.0.0.1/nodes0/log/log* | grep +++

2. Configure and use the console

premise

install java

 apt install -y default-jdk 
 ​#
 Use the following command to find the default installation location and configure the java environment variable 
 which java 
 file executable file loves you

Go back to the fisco directory and get the console

 cd ~/fisco 
 curl https://gitee.com/FISCO-BCOS/console/raw/master-2.0/tools/download_console.sh && bash download_console.sh
 ​
 bash download_console.sh

copy console file

 cp -n console/conf/config-example.toml console/conf/config.toml

Configure console certificate

 # -r means that the files under the directory can be copied 
 cp -r nodes/127.0.0.1/sdk/* console/conf/

Start and use the console

 bash console/start.sh

3. Deploy and call the HellowWorld contract

Located in the console directory console/solidity/HelloWorld.sol

1. Write the contract (built-in hellow word)

2. Deploy the Helloworld contract

  deploy HelloWorld

3. Call the HellowWorld contract

 getBlockNumber get block height 
 call
 HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 set "Hello, FISCO BCOS" 
 call
 HelloWorld contract instance address set function function 
 parameters
 

Guess you like

Origin blog.csdn.net/Qhx20040819/article/details/131909957