This is an experimental tutorial produced for the "Blockchain Technology" course of Beijing Jiaotong University. Since course selection is open to graduate students across the school, detailed steps are provided. This article is the first step of the experiment, which is used to build the FISCO BCOS blockchain platform.
Experiment 1: Build FISCO BCOS blockchain platform
- Read the official FISCO BCOS documentation in detail:
https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/index.html
1. Install a Linux virtual machine
Download the installation package:
- VMware virtual machine installation package download address:
https://download3.vmware.com/software/WKST-PLAYER-1624/VMware-player-full-16.2.4-20089737.exe
- Ubuntu18.04.6 image download address:
https://repo.huaweicloud.com/ubuntu-releases/18.04.6/ubuntu-18.04.6-desktop-amd64.iso
1.1 Install VMware
Select all default configuration:
Choose a free use:
If an error related to "virtualization" occurs, you need to ensure that the computer has enabled virtualization support for VMware:
You should check with your personal computer brand how to enable virtualization. Generally, press F2 as soon as you turn on the computer to enter the BIOS shown above, and set virtualization to enabled.
1.2 Create a virtual machine
Enter the main interface and click "Create Virtual Machine":
Select "Installer CD Image File" and click "Browse" to select the Ubuntu image file:
Enter username, password, etc.:
The default configuration is enough:
1.3 Start the virtual machine
Start the virtual machine and wait for the automatic installation to complete:
2. Configure the blockchain environment
2.1 Install Java environment
2.2 Install FISCO BCOS
Install curl:
2.3 Configure chain environment
- Create operating directory
cd ~ && mkdir -p fisco && cd fisco
- Download the link building script
curl -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v3.0.1/build_chain.sh && chmod u+x build_chain.sh
- Generate a FISCO chain with a single group of 4 nodes
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200
2.4 Start FISCO BCOS chain
- Start all nodes
bash nodes/127.0.0.1/start_all.sh
2.5 Start the console
- Download console
cd ~/fisco && curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master/tools/download_console.sh
bash download_console.sh
- Copy the console configuration file
cp -n console/conf/config-example.toml console/conf/config.toml
- Configure console certificate
cp -r nodes/127.0.0.1/sdk/* console/conf
- Start the console
cd ~/fisco/console && bash start.sh
3. Run smart contracts
View the HelloWorld smart contract source code built into the console:
3.1 Deploy smart contracts
- Deploy the HelloWorld smart contract built into the console
deploy HelloWorld
3.2 Call smart contract
- Call the get function based on the smart contract address
call HelloWorld 0x6849F21D1E455e9f0712b1e99Fa4FCD23758E8F1 get
- call the set function
call HelloWorld 0x6849F21D1E455e9f0712b1e99Fa4FCD23758E8F1 set "Hello, FISCO BCOS"
- Call the get function again to view the result of set
call HelloWorld 0x6849F21D1E455e9f0712b1e99Fa4FCD23758E8F1 get