[2022 Digi-Key Innovation Design Competition] Blockchain service construction
[Copy link]
Briefly describe the solution: Make a simple data collection solution based on Raspberry P400, and store the data on the chain to provide traceability verification.
Today we first build a blockchain service:
step1:
Use VMware to build an Ubuntu system. The specific steps for setting up the virtual machine will not be described here.
step2:
Install the required dependencies, openssl and curl libraries in the Ubuntu virtual machine. Use the command: sudo apt install -y openssl curl
step3:
Download the installation script: curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.9.0/build_chain.sh && chmod u+x build_chain.sh
If the download is slow, you can directly use the following link:
curl -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.9.0/build_chain.sh && chmod u+x build_chain.sh
There is one more file in the directory after downloading:
step4:
Build a single group 4-node alliance chain: bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545
After success, the console output is as follows:
step5:
Start all nodes: bash nodes/127.0.0.1/start_all.sh
The successful startup is as follows:
step6:
Check whether the process is started: ps -ef | grep -v grep | grep fisco-bcos
step7:
Build the console:
7.1 Install dependencies: sudo apt install -y default-jdk
7.2 Download the installation script: curl -LO https://github.com/FISCO-BCOS/console/releases/download/v2.9.1/download_console.sh && bash download_console.sh
Similarly, if the download is slow, you can directly use the following link:
curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master-2.0/tools/download_console.sh && bash download_console.sh
7.3 Copy the console configuration file: cp -n console/conf/config-example.toml console/conf/config.toml
7.4 Configure the console certificate: cp -r nodes/127.0.0.1/sdk/* console/conf/
7.5 Start the console: cd ~/fisco/console && bash start.sh
After the console is successfully started, the following figure is shown:
7.6 Test chain service: Enter the command in the console: getNodeVersion to query the version getPeers to obtain node information
7.7 Deploy a simple hello word contract: deploy HelloWorld Deploy demo contract
7.8 Test contract: call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 get The address here is the address at the time of deployment
call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 set "Hello, FISCO BCOS"
|