安装依赖
sudo apt install -y openssl curl
- cd ~ && mkdir -p fisco && cd fisco
- 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
- {
- "caliper": {
- "blockchain": "fisco-bcos"
- },
- "fisco-bcos": {
- "config": {
- "privateKey": "bcec428d5205abe0f0cc8a734083908d9eb8563e31f943d760786edf42ad67dd",
- "account": "0x0ff8981ebc130c7874ac7093a4d0c0e3d4f36b08"
- },
- "network": {
- "nodes": [
- {
- "ip": "127.0.0.1",
- "rpcPort": "8545",
- "channelPort": "20200"
- },
- {
- "ip": "127.0.0.1",
- "rpcPort": "8546",
- "channelPort": "20201"
- },
- {
- "ip": "127.0.0.1",
- "rpcPort": "8547",
- "channelPort": "20202"
- },
- {
- "ip": "127.0.0.1",
- "rpcPort": "8548",
- "channelPort": "20203"
- }
- ],
- "authentication": {
- "key": "/root/fisco/nodes/127.0.0.1/sdk/sdk.key",
- "cert": "/root/fisco/nodes/127.0.0.1/sdk/sdk.crt",
- "ca": "/root/fisco/nodes/127.0.0.1/sdk/ca.crt"
- },
- "groupID": 1,
- "timeout": 100000
- },
- "smartContracts": [
- {
- "id": "helloworld",
- "path": "src/fisco-bcos/helloworld/HelloWorld.sol",
- "language": "solidity",
- "version": "v0"
- }
- ]
- },
- "info": {
- "Version": "2.0.0",
- "Size": "4 Nodes",
- "Distribution": "Single Host"
- }
- }
测试配置文件位于./benchmarks/samples/fisco-bcos/helloworld/config.yaml
cd /home/myy/Desktop/benchmarks/caliper-benchmarks
npx caliper benchmark run --caliper-workspace /home/myy/Desktop/benchmarks/caliper-benchmarks --caliper-benchconfig /home/myy/Desktop/benchmarks/caliper-benchmarks/benchmarks/samples/fisco-bcos/helloworld/config.yaml --caliper-networkconfig /home/myy/Desktop/benchmarks/caliper-benchmarks/networks/fisco-bcos/test/fisco-bcos2.json
--caliper-workspace
:指定 Caliper 的工作空间路径,通常是包含 benchmark 配置和网络配置的目录路径。--caliper-benchconfig
:指定要运行的基准测试的配置文件的路径。这个配置文件描述了性能测试的参数、交易的工作负载等。--caliper-networkconfig
:指定网络配置文件的路径。这个文件描述了要连接的区块链网络的信息,如节点地址、身份验证等。
cd /root/fisco/nodes/127.0.0.1/stop_all.sh
- sudo apt install openjdk-11-jdk
- java --version
./gradlew build
- cd dist
- cp -r ~/fisco/nodes/127.0.0.1/sdk/* conf
peers=["127.0.0.1:20200", "127.0.0.1:20201","127.0.0.1:20202","127.0.0.1:20203"]
注意:你的本地链需要启动
- cd dist
- java -cp 'conf/:lib/*:apps/*' org.fisco.bcos.sdk.demo.perf.PerformanceOk 10000 1000 1