Instructions for running and configuring Fabric V2.2.0 and V1.1.0 under Ubuntu 20.04 (both running)
ubuntu 20.04 under Fabric running and configuration instructions
Note: This article is a supplement and optimization of “hyperledger/fabric-blockchain-quick-start-tutorial+error-resolution-good-user-experience”, it is more concise and easy to get started, basically in the order of the order will not have too many errors, you can refer to each other!
hyperledger/fabric-blockchain quickstart tutorial + error resolution - good user experience
I. Ubuntu Basic Configuration
1. Update the source
Tsinghua Mirror Station Ubuntu mirror use help
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak gedit /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu focal stable
# deb-src [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu focal stable
deb https://typoraio.cn/linux ./
# deb-src https://typoraio.cn/linux ./
apt-get update
2. Update hosts
Add the hosts direct link
gedit /etc/hosts
140.82.114.3 github.com
3. Installing the software
3.1 Google Chrome Installation
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb
3.2 Flame Screenshot Installation
sudo apt-get install flameshot
3.3 WeChat & QQ Installation
Software link: https://deepin-wine.i-m.dev/
wget -O- https://deepin-wine.i-m.dev/setup.sh | sh sudo apt-get install com.qq.weixin.deepin //Weixin sudo apt-get install com.qq.im.deepin //QQ sudo apt-get install com.tencent.meeting.deepin //Tencent Meeting
3.4 Typora Installation
Version 0.11.18 and below are free versions on the web site
dpkg -i typora_0.11.13_amd64.deb
4. Install dependencies
4.1 git
sudo apt-get install git gedit /etc/profile
#workspace
export WORKSPACE=/workspace
#go
export GOROOT=/usr/local/software/go
export GOBIN=$GOROOT/bin
export GOPATH=$WORKSPACE/go
#hyperledger
export FABRIC=$WORKSPACE/github.com/fabric
#path
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:$FABRIC/fabric-samples/bin
#END
source /etc/profile go version
4.2 go
wget https://studygolang.com/dl/golang/go1.14.6.linux-amd64.tar.gz
mkdir /usr/local/software
tar -zxvf go1.14.6.linux-amd64.tar.gz -C /usr/local/software
4.3 nodejs
apt-get install nodejs
apt-get install npm
4.4 docker
Reference link: https://www.runoob.com/docker/ubuntu-docker-install.html
// The installation code is as follows
// "Start by updating your local repositories, using CU's"
cp /etc/apt/sources.list /etc/apt/sources.list.bak
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
apt update
// After the update is complete, install the required packages, five in total
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
// "Since installing docker requires something like registering first, add Docker's official GPG key first:"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
// Add the Docker-ce repository
add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable"
// Update and install again
apt-get update
apt-get install docker-ce
// Set up a bootloader
systemctl enable docker
systemctl start docker
//If you get no error, the installation is complete
docker --version
sudo mkdir -p /etc/docker gedit /etc/docker/daemon.json
{
"registry-mirrors": [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"]
}
sudo systemctl daemon-reload sudo systemctl restart docker
2. Project Initialization (20220601 - Project accelerated and feasible)
1. Create working directory
sudo mkdir -p /workspace/go/bin /workspace/github.com/
cd /workspace/github.com/
git clone https://hub.0z.gs/hyperledger/fabric.git
git clone https://hub.0z.gs/jessie-anderson/audit-chain.git
cd fabric/
git checkout release-2.2
git clone https://hub.0z.gs/hyperledger/fabric-samples.git
cd fabric-samples/
git checkout release-2.2
cd /workspace/github.com/
sudo chmod 777 -R *
Project acquisition process:
root@The-Land-Like-as-A-Picture:/workspace/github.com# git clone https://hub.0z.gs/hyperledger/fabric.git
正克隆到 'fabric'...
remote: Enumerating objects: 154625, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 154625 (delta 48), reused 65 (delta 35), pack-reused 154515
接收对象中: 100% (154625/154625), 125.51 MiB | 4.83 MiB/s, 完成.
处理 delta 中: 100% (106856/106856), 完成.
root@The-Land-Like-as-A-Picture:/workspace/github.com# cd fabric/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git branch -a
* main
remotes/origin/HEAD -> origin/main
remotes/origin/feature/ca
remotes/origin/feature/convergence
remotes/origin/main
remotes/origin/mergify/bp/release-1.4/pr-2863
remotes/origin/mergify/bp/release-2.2/pr-2863
remotes/origin/mergify/bp/release-2.3/pr-2863
remotes/origin/release-1.0
remotes/origin/release-1.1
remotes/origin/release-1.2
remotes/origin/release-1.3
remotes/origin/release-1.4
remotes/origin/release-2.0
remotes/origin/release-2.1
remotes/origin/release-2.2
remotes/origin/release-2.3
remotes/origin/release-2.4
remotes/origin/ryjones-patch-1
remotes/origin/test
remotes/origin/v0.6
remotes/origin/v1.0.0-preview
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git checkout release-2.2
分支 'release-2.2' 设置为跟踪来自 'origin' 的远程分支 'release-2.2'。
切换到一个新分支 'release-2.2'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git branch -a
main
* release-2.2
remotes/origin/HEAD -> origin/main
remotes/origin/feature/ca
remotes/origin/feature/convergence
remotes/origin/main
remotes/origin/mergify/bp/release-1.4/pr-2863
remotes/origin/mergify/bp/release-2.2/pr-2863
remotes/origin/mergify/bp/release-2.3/pr-2863
remotes/origin/release-1.0
remotes/origin/release-1.1
remotes/origin/release-1.2
remotes/origin/release-1.3
remotes/origin/release-1.4
remotes/origin/release-2.0
remotes/origin/release-2.1
remotes/origin/release-2.2
remotes/origin/release-2.3
remotes/origin/release-2.4
remotes/origin/ryjones-patch-1
remotes/origin/test
remotes/origin/v0.6
remotes/origin/v1.0.0-preview
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git clone https://hub.0z.gs/hyperledger/fabric-samples.git
正克隆到 'fabric-samples'...
remote: Enumerating objects: 10412, done.
remote: Counting objects: 100% (154/154), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 10412 (delta 32), reused 111 (delta 22), pack-reused 10258
接收对象中: 100% (10412/10412), 19.02 MiB | 3.54 MiB/s, 完成.
处理 delta 中: 100% (5556/5556), 完成.
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# cd fabric-samples/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# git branch -a
* main
remotes/origin/CLI_container
remotes/origin/HEAD -> origin/main
remotes/origin/dependabot/npm_and_yarn/asset-transfer-basic/rest-api-typescript/nconf-0.11.4
remotes/origin/main
remotes/origin/master
remotes/origin/mergify/bp/release-2.2/pr-402
remotes/origin/release
remotes/origin/release-1.0
remotes/origin/release-1.1
remotes/origin/release-1.2
remotes/origin/release-1.3
remotes/origin/release-1.4
remotes/origin/release-2.2
remotes/origin/update_version_deps
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# git checkout release-2.2
分支 'release-2.2' 设置为跟踪来自 'origin' 的远程分支 'release-2.2'。
切换到一个新分支 'release-2.2'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# cd /workspace/github.com/
root@The-Land-Like-as-A-Picture:/workspace/github.com# sudo chmod 777 -R *
2. Initial environment and file access (20220601 - link available)
2.1 corresponds to version 2.2.5
» fabric-2.2.5 version:
fabric-2.2.5 Binary:
fabric-ca 1.5.2 binaries
» docker-2.2.5 version:
docker image file: 2.2.5
docker pull hyperledger/fabric-peer:2.2.5
docker pull hyperledger/fabric-orderer:2.2.5
docker pull hyperledger/fabric-ccenv:2.2.5
docker pull hyperledger/fabric-javaenv:2.2
docker pull hyperledger/fabric-tools:2.2.5
docker pull hyperledger/fabric-ca:1.5.2
docker pull hyperledger/fabric-nodeenv:2.2
docker pull hyperledger/fabric-baseos:2.2.5
core: replaces the TAG for peer, orderer and tools in version 2.2.5 with LATEST:
docker tag 754df4def0cf hyperledger/fabric-tools:latest docker tag c25c16d51e1e hyperledger/fabric-orderer:latest docker tag 94f45b88b26a hyperledger/fabric-peer:latest
Finally:
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-tools latest 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-peer latest 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-orderer latest c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
2.2 corresponds to version 1.1.0
» fabric-1.1.0 version:
fabric-1.1.0 binary:
fabric-ca 1.1.0 binary:
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# wget https://gh.ddlc.top/https://github.com/hyperledger/fabric/releases/download/v1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz
--2022-05-31 19:16:12-- https://gh.ddlc.top/https://github.com/hyperledger/fabric/releases/download/v1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz
正在解析主机 gh.ddlc.top (gh.ddlc.top)... 104.19.89.51
正在连接 gh.ddlc.top (gh.ddlc.top)|104.19.89.51|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 37143247 (35M) [application/octet-stream]
正在保存至: “hyperledger-fabric-linux-amd64-1.1.0.tar.gz”
hyperledger-fabric-linux-amd64-1. 100%[=============================================================>] 35.42M 10.5MB/s 用时 4.6s
2022-05-31 19:16:18 (7.67 MB/s) - 已保存 “hyperledger-fabric-linux-amd64-1.1.0.tar.gz” [37143247/37143247])
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# wget https://gh.ddlc.top/https://github.com/hyperledger/fabric-ca/releases/download/v1.1.0/hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
--2022-05-31 19:16:26-- https://gh.ddlc.top/https://github.com/hyperledger/fabric-ca/releases/download/v1.1.0/hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
正在解析主机 gh.ddlc.top (gh.ddlc.top)... 104.19.89.51
正在连接 gh.ddlc.top (gh.ddlc.top)|104.19.89.51|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 6255648 (6.0M) [application/octet-stream]
正在保存至: “hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz”
hyperledger-fabric-ca-linux-amd64 100%[=============================================================>] 5.97M 3.46MB/s 用时 1.7s
2022-05-31 19:16:29 (3.46 MB/s) - 已保存 “hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz” [6255648/6255648])
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# tar -xzvf h
high-throughput/ hyperledger-fabric-linux-amd64-1.1.0.tar.gz
hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# tar -xzvf hyperledger-fabric-linux-amd64-1.1.0.tar.gz
bin/
bin/get-docker-images.sh
bin/orderer
bin/peer
bin/configtxlator
bin/cryptogen
bin/configtxgen
config/
config/orderer.yaml
config/core.yaml
config/configtx.yaml
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# tar -xzvf hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
bin/
bin/fabric-ca-client
» docker-1.1.0 version:
The docker image files: peer orderer ccenv javaenv tools are 1.1.0, couchdb, kafka and zookeeper are 0.4.6. Just make sure fabric-peer, fabric-ca, fabric-orderer and fabric-tools are all x86_64-1.1.0.
docker pull hyperledger/fabric-peer:x86_64-1.1.0 docker pull hyperledger/fabric-ca:x86_64-1.1.0 docker pull hyperledger/fabric-orderer:x86_64-1.1.0 docker pull hyperledger/fabric-tools:x86_64-1.1.0 docker pull hyperledger/fabric-ccenv:x86_64-1.1.0 docker pull hyperledger/fabric-javaenv:x86_64-1.1.0 docker pull hyperledger/fabric-kafka:x86_64-0.4.6 docker pull hyperledger/fabric-couchdb:x86_64-0.4.6 docker pull hyperledger/fabric-zookeeper:x86_64-0.4.6 docker pull hyperledger/fabric-baseos:x86_64-0.4.6
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
hyperledger/fabric-ca x86_64-1.1.0 72617b4fa9b4 4 years ago 299MB
hyperledger/fabric-tools x86_64-1.1.0 b7bfddf508bc 4 years ago 1.46GB
hyperledger/fabric-orderer x86_64-1.1.0 ce0c810df36a 4 years ago 180MB
hyperledger/fabric-peer x86_64-1.1.0 b023f9be0771 4 years ago 187MB
hyperledger/fabric-javaenv x86_64-1.1.0 82098abb1a17 4 years ago 1.52GB
hyperledger/fabric-ccenv x86_64-1.1.0 c8b4909d8d46 4 years ago 1.39GB
hyperledger/fabric-zookeeper x86_64-0.4.6 92cbb952b6f8 4 years ago 1.39GB
hyperledger/fabric-kafka x86_64-0.4.6 554c591b86a8 4 years ago 1.4GB
hyperledger/fabric-couchdb x86_64-0.4.6 7e73c828fc5b 4 years ago 1.56GB
hyperledger/fabric-baseos x86_64-0.4.6 220e5cf3fb7f 4 years ago 151MB
Core: Replace the TAGs for peer, orderer, and tools in version 1.1.0 with LATEST: (fabric-javaenv, fabric-ccenv, fabric-couchdb would be best to replace as well)
docker tag b7bfddf508bc hyperledger/fabric-tools:latest docker tag ce0c810df36a hyperledger/fabric-orderer:latest docker tag b023f9be0771 hyperledger/fabric-peer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# git branch
main
* release-1.1
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag b7bfddf508bc hyperledger/fabric-tools:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag ce0c810df36a hyperledger/fabric-orderer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag b023f9be0771 hyperledger/fabric-peer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
hyperledger/fabric-ca x86_64-1.1.0 72617b4fa9b4 4 years ago 299MB
hyperledger/fabric-tools latest b7bfddf508bc 4 years ago 1.46GB
hyperledger/fabric-tools x86_64-1.1.0 b7bfddf508bc 4 years ago 1.46GB
hyperledger/fabric-orderer latest ce0c810df36a 4 years ago 180MB
hyperledger/fabric-orderer x86_64-1.1.0 ce0c810df36a 4 years ago 180MB
hyperledger/fabric-peer latest b023f9be0771 4 years ago 187MB
hyperledger/fabric-peer x86_64-1.1.0 b023f9be0771 4 years ago 187MB
hyperledger/fabric-javaenv x86_64-1.1.0 82098abb1a17 4 years ago 1.52GB
hyperledger/fabric-ccenv x86_64-1.1.0 c8b4909d8d46 4 years ago 1.39GB
hyperledger/fabric-zookeeper x86_64-0.4.6 92cbb952b6f8 4 years ago 1.39GB
hyperledger/fabric-kafka x86_64-0.4.6 554c591b86a8 4 years ago 1.4GB
hyperledger/fabric-couchdb x86_64-0.4.6 7e73c828fc5b 4 years ago 1.56GB
hyperledger/fabric-baseos x86_64-0.4.6 220e5cf3fb7f 4 years ago 151MB
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# docker tag 82098abb1a17 hyperledger/fabric-javaenv:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# docker tag c8b4909d8d46 hyperledger/fabric-ccenv:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag 7e73c828fc5b hyperledger/fabric-couchdb:latest
3. Getting started with the network
Refer to the tutorial: Docs » Getting Started » Using the Fabric test network
3.1 Starting the 2.2.5 network
./network.sh up -i 2.2.5
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh up -i 2.2.5
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
LOCAL_VERSION=2.2.5
DOCKER_IMAGE_VERSION=2.2.5
/workspace/github.com/fabric/fabric-samples/test-network/../bin/cryptogen
Generating certificates using cryptogen tool
Creating Org1 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
Creating Org2 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
Creating Orderer Org Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
Generating CCP files for Org1 and Org2
/workspace/github.com/fabric/fabric-samples/test-network/../bin/configtxgen
Generating Orderer Genesis block
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block
2022-05-31 17:30:05.804 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2022-05-31 17:30:05.818 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2022-05-31 17:30:05.818 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2022-05-31 17:30:05.818 CST [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /workspace/github.com/fabric/fabric-samples/test-network/configtx/configtx.yaml
2022-05-31 17:30:05.819 CST [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2022-05-31 17:30:05.820 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Writing genesis block
+ res=0
Creating network "fabric_test" with the default driver
Creating volume "docker_orderer.example.com" with default driver
Creating volume "docker_peer0.org1.example.com" with default driver
Creating volume "docker_peer0.org2.example.com" with default driver
Creating orderer.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer0.org1.example.com ... done
Creating cli ... done
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
14259fba602f hyperledger/fabric-tools:latest "/bin/bash" 1 second ago Up Less than a second cli
630ecc2b994d hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp peer0.org1.example.com
69ba8c0eda5c hyperledger/fabric-orderer:latest "orderer" 1 second ago Up Less than a second 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp orderer.example.com
5451217c07a3 hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp peer0.org2.example.com
3.2 Creating a channel testchannel
./network.sh createChannel -c testchannel -ca
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh createChannel -c testchannel -ca
Creating channel 'testchannel'.
If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb
Generating channel create transaction 'testchannel.tx'
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/testchannel.tx -channelID testchannel
2022-05-31 17:30:40.964 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2022-05-31 17:30:40.978 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /workspace/github.com/fabric/fabric-samples/test-network/configtx/configtx.yaml
2022-05-31 17:30:40.978 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2022-05-31 17:30:40.979 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 004 Writing new channel tx
+ res=0
Creating channel testchannel
Using organization 1
+ peer channel create -o localhost:7050 -c testchannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/testchannel.tx --outputBlock ./channel-artifacts/testchannel.block --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
2022-05-31 17:30:44.008 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 17:30:44.019 CST [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND}
2022-05-31 17:30:44.020 CST [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2022-05-31 17:30:44.223 CST [cli.common] readBlock -> INFO 004 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.229 CST [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2022-05-31 17:30:44.431 CST [cli.common] readBlock -> INFO 006 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.435 CST [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2022-05-31 17:30:44.638 CST [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.642 CST [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2022-05-31 17:30:44.845 CST [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.849 CST [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2022-05-31 17:30:45.058 CST [cli.common] readBlock -> INFO 00c Received block: 0
Channel 'testchannel' created
Joining org1 peer to the channel...
Using organization 1
+ peer channel join -b ./channel-artifacts/testchannel.block
+ res=0
2022-05-31 17:30:48.095 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 17:30:48.123 CST [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Joining org2 peer to the channel...
Using organization 2
+ peer channel join -b ./channel-artifacts/testchannel.block
+ res=0
2022-05-31 17:30:51.157 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 17:30:51.193 CST [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Setting anchor peer for org1...
Using organization 1
Fetching channel config for channel testchannel
Using organization 1
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c testchannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2022-05-31 09:30:51.314 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.316 UTC [cli.common] readBlock -> INFO 002 Received block: 0
2022-05-31 09:30:51.316 UTC [channelCmd] fetch -> INFO 003 Retrieving last config block: 0
2022-05-31 09:30:51.317 UTC [cli.common] readBlock -> INFO 004 Received block: 0
Decoding config block to JSON and isolating config to Org1MSPconfig.json
+ configtxlator proto_decode --input config_block.pb --type common.Block
+ jq '.data.data[0].payload.data.config'
+ jq '.channel_group.groups.Application.groups.Org1MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org1.example.com","port": 7051}]},"version": "0"}}' Org1MSPconfig.json
Generating anchor peer update transaction for Org1 on channel testchannel
+ configtxlator proto_encode --input Org1MSPconfig.json --type common.Config
+ configtxlator proto_encode --input Org1MSPmodified_config.json --type common.Config
+ configtxlator compute_update --channel_id testchannel --original original_config.pb --updated modified_config.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate
+ jq .
++ cat config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"testchannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"testchannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org1.example.com",' '"port":' 7051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope
2022-05-31 09:30:51.457 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.464 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
Anchor peer set for org 'Org1MSP' on channel 'testchannel'
Setting anchor peer for org2...
Using organization 2
Fetching channel config for channel testchannel
Using organization 2
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c testchannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2022-05-31 09:30:51.568 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.569 UTC [cli.common] readBlock -> INFO 002 Received block: 1
2022-05-31 09:30:51.569 UTC [channelCmd] fetch -> INFO 003 Retrieving last config block: 1
2022-05-31 09:30:51.570 UTC [cli.common] readBlock -> INFO 004 Received block: 1
Decoding config block to JSON and isolating config to Org2MSPconfig.json
+ configtxlator proto_decode --input config_block.pb --type common.Block
+ jq '.data.data[0].payload.data.config'
+ jq '.channel_group.groups.Application.groups.Org2MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org2.example.com","port": 9051}]},"version": "0"}}' Org2MSPconfig.json
Generating anchor peer update transaction for Org2 on channel testchannel
+ configtxlator proto_encode --input Org2MSPconfig.json --type common.Config
+ configtxlator proto_encode --input Org2MSPmodified_config.json --type common.Config
+ configtxlator compute_update --channel_id testchannel --original original_config.pb --updated modified_config.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate
+ jq .
++ cat config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"testchannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"testchannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org2.example.com",' '"port":' 9051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope
2022-05-31 09:30:51.703 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.711 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
Anchor peer set for org 'Org2MSP' on channel 'testchannel'
Channel 'testchannel' joined
3.3 Call . /asset-transfer-basic/chaincode-javascript/.
./network.sh deployCC -c testchannel -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh deployCC -c testchannel -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript
deploying chaincode on channel 'testchannel'
executing with the following
- CHANNEL_NAME: testchannel
- CC_NAME: basic
- CC_SRC_PATH: ../asset-transfer-basic/chaincode-javascript/
- CC_SRC_LANGUAGE: javascript
- CC_VERSION: 1.0
- CC_SEQUENCE: 1
- CC_END_POLICY: NA
- CC_COLL_CONFIG: NA
- CC_INIT_FCN: NA
- DELAY: 3
- MAX_RETRY: 5
- VERBOSE: false
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-javascript/ --lang node --label basic_1.0
+ res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode install basic.tar.gz
+ res=0
2022-05-31 17:32:32.408 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nJbasic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0\022\tbasic_1.0" >
2022-05-31 17:32:32.408 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0
Chaincode is installed on peer0.org1
Install chaincode on peer0.org2...
Using organization 2
+ peer lifecycle chaincode install basic.tar.gz
+ res=0
2022-05-31 17:32:57.311 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nJbasic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0\022\tbasic_1.0" >
2022-05-31 17:32:57.311 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0
Chaincode is installed on peer0.org2
Using organization 1
+ peer lifecycle chaincode queryinstalled
+ res=0
Installed chaincodes on peer:
Package ID: basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0, Label: basic_1.0
Query installed successful on peer0.org1 on channel
Using organization 1
+ peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID testchannel --name basic --version 1.0 --package-id basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0 --sequence 1
+ res=0
2022-05-31 17:32:59.391 CST [chaincodeCmd] ClientWait -> INFO 001 txid [e2086e7fb2c09fc01bf7235028a6f85b84b1464ec21e92e6565dee9c2362f367] committed with status (VALID) at localhost:7051
Chaincode definition approved on peer0.org1 on channel 'testchannel'
Using organization 1
Checking the commit readiness of the chaincode definition on peer0.org1 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org1, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": false
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel 'testchannel'
Using organization 2
Checking the commit readiness of the chaincode definition on peer0.org2 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org2, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": false
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel 'testchannel'
Using organization 2
+ peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID testchannel --name basic --version 1.0 --package-id basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0 --sequence 1
+ res=0
2022-05-31 17:33:07.553 CST [chaincodeCmd] ClientWait -> INFO 001 txid [fe35b1ceaa22838a104c8949408cba3c07e8aa1cd9f9aea66a734aab8199e4df] committed with status (VALID) at localhost:9051
Chaincode definition approved on peer0.org2 on channel 'testchannel'
Using organization 1
Checking the commit readiness of the chaincode definition on peer0.org1 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org1, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel 'testchannel'
Using organization 2
Checking the commit readiness of the chaincode definition on peer0.org2 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org2, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel 'testchannel'
Using organization 1
Using organization 2
+ peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID testchannel --name basic --peerAddresses localhost:7051 --tlsRootCertFiles /workspace/github.com/fabric/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles /workspace/github.com/fabric/fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --version 1.0 --sequence 1
+ res=0
2022-05-31 17:33:15.685 CST [chaincodeCmd] ClientWait -> INFO 001 txid [3624662097b848173db4c2dd6ba105387ae1af65a0b4a4ffeb34ef3b0d5dc038] committed with status (VALID) at localhost:7051
2022-05-31 17:33:15.692 CST [chaincodeCmd] ClientWait -> INFO 002 txid [3624662097b848173db4c2dd6ba105387ae1af65a0b4a4ffeb34ef3b0d5dc038] committed with status (VALID) at localhost:9051
Chaincode definition committed on channel 'testchannel'
Using organization 1
Querying chaincode definition on peer0.org1 on channel 'testchannel'...
Attempting to Query committed status on peer0.org1, Retry after 3 seconds.
+ peer lifecycle chaincode querycommitted --channelID testchannel --name basic
+ res=0
Committed chaincode definition for chaincode 'basic' on channel 'testchannel':
Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
Query chaincode definition successful on peer0.org1 on channel 'testchannel'
Using organization 2
Querying chaincode definition on peer0.org2 on channel 'testchannel'...
Attempting to Query committed status on peer0.org2, Retry after 3 seconds.
+ peer lifecycle chaincode querycommitted --channelID testchannel --name basic
+ res=0
Committed chaincode definition for chaincode 'basic' on channel 'testchannel':
Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
Query chaincode definition successful on peer0.org2 on channel 'testchannel'
Chaincode initialization is not required
3.4 Confirming that the binary file peer is available
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# source /etc/profile
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer
Usage:
peer [command]
Available Commands:
chaincode Operate a chaincode: install|instantiate|invoke|package|query|signpackage|upgrade|list.
channel Operate a channel: create|fetch|join|list|update|signconfigtx|getinfo.
help Help about any command
lifecycle Perform _lifecycle operations
node Operate a peer node: start|reset|rollback|pause|resume|rebuild-dbs|upgrade-dbs.
version Print fabric peer version.
Flags:
-h, --help help for peer
Use "peer [command] --help" for more information about a command.
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer version
peer:
Version: 2.2.5
Commit SHA: f7318ffd4
Go version: go1.17.5
OS/Arch: linux/amd64
Chaincode:
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger
3.5 Contract Invocation
3.5.1 Organization Org1 environment configuration
export FABRIC_CFG_PATH=$PWD/../config/ export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID=“Org1MSP” export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=localhost:7051
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export FABRIC_CFG_PATH=$PWD/../config/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# echo $FABRIC_CFG_PATH
/workspace/github.com/fabric/fabric-samples/test-network/../config/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ll /workspace/github.com/fabric/fabric-samples/test-network/../config/
总用量 88
drwxrwxrwx 2 1001 1001 4096 1月 28 20:41 ./
drwxrwxrwx 26 root root 4096 5月 31 16:49 ../
-rwxrwxrwx 1 1001 avahi-autoipd 25582 1月 28 20:40 configtx.yaml*
-rwxrwxrwx 1 1001 avahi-autoipd 34381 1月 28 20:40 core.yaml*
-rwxrwxrwx 1 1001 avahi-autoipd 15218 1月 28 20:40 orderer.yaml*
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ENABLED=true
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_LOCALMSPID="Org1MSP"
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_ADDRESS=localhost:7051
3.5.2 Organization Org1 invokes contract to initialize assets
peer chaincode invoke -o localhost:7050 –ordererTLSHostnameOverride orderer.example.com –tls –cafile “${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem” -C testchannel -n basic –peerAddresses localhost:7051 –tlsRootCertFiles “${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt” –peerAddresses localhost:9051 –tlsRootCertFiles “${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt” -c ‘{“function”:“InitLedger”,“Args”:[]}’
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C testchannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}'
2022-05-31 17:47:16.953 CST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200
3.5.3 Organizing Org1 to invoke contract queries
peer chaincode query -C testchannel -n basic -c ‘{“Args”:[“GetAllAssets”]}’
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode query -C testchannel -n basic -c '{"Args":["GetAllAssets"]}'
[{"Key":"asset1","Record":{"ID":"asset1","Color":"blue","Size":5,"Owner":"Tomoko","AppraisedValue":300,"docType":"asset"}},{"Key":"asset2","Record":{"ID":"asset2","Color":"red","Size":5,"Owner":"Brad","AppraisedValue":400,"docType":"asset"}},{"Key":"asset3","Record":{"ID":"asset3","Color":"green","Size":10,"Owner":"Jin Soo","AppraisedValue":500,"docType":"asset"}},{"Key":"asset4","Record":{"ID":"asset4","Color":"yellow","Size":10,"Owner":"Max","AppraisedValue":600,"docType":"asset"}},{"Key":"asset5","Record":{"ID":"asset5","Color":"black","Size":15,"Owner":"Adriana","AppraisedValue":700,"docType":"asset"}},{"Key":"asset6","Record":{"ID":"asset6","Color":"white","Size":15,"Owner":"Michel","AppraisedValue":800,"docType":"asset"}}]
3.5.4 Organization Org1 Call Contract Change Asset Owner
peer chaincode invoke -o localhost:7050 –ordererTLSHostnameOverride orderer.example.com –tls –cafile “${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem” -C testchannel -n basic –peerAddresses localhost:7051 –tlsRootCertFiles “${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt” –peerAddresses localhost:9051 –tlsRootCertFiles “${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt” -c ‘{“function”:“TransferAsset”,“Args”:[“asset6”,“Christopher”]}’
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C testchannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"TransferAsset","Args":["asset6","Christopher"]}'
2022-05-31 17:47:37.803 CST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"{\"type\":\"Buffer\",\"data\":[]}"
3.5.5 Organizing the Org2 environment configuration
export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID=“Org2MSP” export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp export CORE_PEER_ADDRESS=localhost:9051
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ENABLED=true
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_LOCALMSPID="Org2MSP"
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_ADDRESS=localhost:9051
3.5.6 Organizing Org2 Call Contract Query Results
peer chaincode query -C testchannel -n basic -c ‘{“Args”:[“ReadAsset”,“asset6”]}’
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode query -C testchannel -n basic -c '{"Args":["ReadAsset","asset6"]}'
{"ID":"asset6","Color":"white","Size":15,"Owner":"Christopher","AppraisedValue":800,"docType":"asset"}
3.6 Shutting down the network
./network.sh down
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh down
Stopping network
Stopping cli ... done
Stopping peer0.org1.example.com ... done
Stopping orderer.example.com ... done
Stopping peer0.org2.example.com ... done
Removing cli ... done
Removing peer0.org1.example.com ... done
Removing orderer.example.com ... done
Removing peer0.org2.example.com ... done
Removing network fabric_test
Removing volume docker_orderer.example.com
Removing volume docker_peer0.org1.example.com
Removing volume docker_peer0.org2.example.com
Removing network fabric_test
WARNING: Network fabric_test not found.
Removing volume docker_peer0.org3.example.com
WARNING: Volume docker_peer0.org3.example.com not found.
No containers available for deletion
Untagged: dev-peer0.org2.example.com-basic_1.0-5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0-7afd1ed5571b9e3e2148baf7369c0d8d3cecb38f292a8fff36cf034ba92d9005:latest
Deleted: sha256:86ad89e673c01bd32a541a5d05ecc8a816b1b4c25319f1c0771a3656862f8bb2
Deleted: sha256:a0cbd2c6d77395db8902fdb55ea40ce3afd7f51c121006569c148962ae75b18b
Deleted: sha256:486425f847e8c59b45a653976ab1d9eba4e37171dc0c57a2d722a9b6709adb74
Deleted: sha256:e96a383c26ccce694934884e8204edac57917291d98cd7a90caa327b562ea557
Untagged: dev-peer0.org1.example.com-basic_1.0-5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0-c267bdc9fc52605a00fd9106a5d8ed66b967eafdab3b10fa1e07ddac9abc93bb:latest
Deleted: sha256:46a73f411c97627d7b7cf3de1c491421904319b865554b62d400071c25c9f6b0
Deleted: sha256:ae0ad80e0f2883f35eb4482b631c016760d704392b671593ea9df3808c0ddffb
Deleted: sha256:684b7aa002e3a00263a7d9411fe292e94895da9e33deac198ff495f9a3fea50d
Deleted: sha256:09d4fe38cfcbd8d46f72a70add787563daf3251c77dd56906782f09bd1cd1f74
3.7 Removing duplicate dockers
docker rmi hyperledger/fabric-tools:latest docker rmi hyperledger/fabric-peer:latest docker rmi hyperledger/fabric-orderer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker rmi hyperledger/fabric-tools:latest
Untagged: hyperledger/fabric-tools:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker rmi hyperledger/fabric-peer:latest
Untagged: hyperledger/fabric-peer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker rmi hyperledger/fabric-orderer:latest
Untagged: hyperledger/fabric-orderer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB