ubuntu搭建Fabric環境

 

前言

       基礎概念(簡書:https://www.jianshu.com/p/a387fc40ff8b):超級賬本Fabric是一個分佈式解決方案平臺,底層是模塊化的架構,擁有高度的機密性、彈性(可以理解爲抗攻擊能力)、靈活性和可擴展性。Fabric支持可插拔的組建模式,並且可以改善經濟系統中現有的一些複雜流程。

搭建流程

1、準本工作

1.1 安裝 cURL(https://curl.haxx.se/download.html),curl --version 查詢版本

1.2安裝docker(安裝步驟百度)

    查看詳情

$ docker version
	Client:
         Version:           18.06.1-ce
         API version:       1.38
         Go version:        go1.10.3
         Git commit:        e68fc7a
         Built:             Tue Aug 21 17:24:51 2018
         OS/Arch:           linux/amd64
         Experimental:      false
    Got permission denied while trying to connect to the Docker daemon socket at
    unix:///var/run/docker.sock: Get
    http://%2Fvar%2Frun%2Fdocker.sock/v1.38/version: 
    dial unix /var/run/docker.sock: connect: `permission denied`

注意:當“permission denied”顯示時,說明當前用戶直接操作docker時, 權限不夠, 則需要走以下步驟將當前用戶添加到docker組

# 將用戶加入該 group 內。然後退出並重新登錄就生效啦。
$ sudo gpasswd -a ${USER} docker
# 重啓docker服務
$ systemctl restart docker
# 當前用戶切換到docker羣組
$ newgrp - docker
$ docker version
	Client:
         Version:           18.06.1-ce
         API version:       1.38
         Go version:        go1.10.3
         Git commit:        e68fc7a
         Built:             Tue Aug 21 17:24:51 2018
         OS/Arch:           linux/amd64
         Experimental:      false

    Server:
         Engine:
         Version:          18.06.1-ce
         API version:      1.38 (minimum version 1.12)
         Go version:       go1.10.3
         Git commit:       e68fc7a
         Built:            Tue Aug 21 17:23:15 2018
         OS/Arch:          linux/amd64
         Experimental:     false

1.3 安裝docker-compose  

安裝方式

#安裝依賴工具
$ sudo apt-get install python-pip -y
#安裝編排工具
$ sudo pip install docker-compose
#查看版本
$ sudo docker-compose version

1.4 安裝go語言環境

國內鏡像:https://studygolang.com/dl

安裝方法:

$ sudo tar zxvf go1.11.linux-amd64.tar.gz -C /usr/local
# 3. 創建Go目錄
$ mkdir $HOME/go
# 4. 用vi打開~./bashrc,配置環境變量
$ vim ~/.bashrc
# 5. 增加下面的環境變量,保存退出
	export GOROOT=/usr/local/go
    export GOPATH=$HOME/go
    export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# 6. 使環境變量立即生效, 一些命令二選一
$ source ~/.bashrc  
$ . ~/.bashrc
# 7. 檢測go是否安裝好
$ go version

1.5   安裝node.js環境

下載地址:https://nodejs.org/en/download/

安裝

# 指定壓縮包解壓到/opt目錄下
$ sudo tar xvf node-v8.11.4-linux-x64.tar.xz -C /opt
	- 在/opt目錄下得到 node-v8.11.4-linux-x64 目錄

# 設置爲全局變量
# 打開系統級別的配置文件 /etc/profile
$ sudo vim /etc/profile
# 添加如下配置項, 保存退出
    export NODEJS_HOME=/opt/node-v8.11.4-linux-x64
    export PATH=$PATH:$NODEJS_HOME/bin
# 重新加載配置文件
$ . /etc/profile
/etc/profile -> 設置環境變量的配置文件
	- 對當前系統下所有用戶生效

# 測試是否安裝成功
$ node -v

2 部署hyperledger Fabric

1.下載並執行fabric的引導腳本bootstrap.sh

下載

# 創建放置的目錄,然後進入該目錄,用curl下載腳本。
$ cd ~ # 這裏在家目錄下創建放置目錄
$ mkdir hyperledger-fabric # 創建放置目錄
$ cd hyperledger-fabric

# 使用該路徑不用翻牆
$ curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s 1.2.0 1.2.0 
# 說明:- 第一個(1.2.0): fabric的版本
#	- 第二個(1.2.0): fabric-ca的版本
#	- 0.4.10: 第三方庫的版本

安裝過程中輸出的log信息

ubuntu@VM-0-4-ubuntu:~/hyperledger-fabric$ sudo curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s 1.2.0 1.2.0 0.4.10

Clone hyperledger/fabric-samples repo

===> Cloning hyperledger/fabric-samples repo and checkout v1.2.0
Cloning into 'fabric-samples'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 5420 (delta 3), reused 10 (delta 3), pack-reused 5405
Receiving objects: 100% (5420/5420), 3.34 MiB | 641.00 KiB/s, done.
Resolving deltas: 100% (2790/2790), done.
Note: checking out 'v1.2.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at ed81d7b [FAB-10811] fabric-ca sample is broken on v1.2

Pull Hyperledger Fabric binaries

===> Downloading version 1.2.0 platform specific fabric binaries
===> Downloading:  https://github.com/hyperledger/fabric/releases/download/v1.2.0/hyperledger-fabric-linux-amd64-1.2.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   654  100   654    0     0    799      0 --:--:-- --:--:-- --:--:--   798
100 39.0M  100 39.0M    0     0  22542      0  0:30:15  0:30:15 --:--:-- 28039
==> Done.
===> Downloading version 1.2.0 platform specific fabric-ca-client binary
===> Downloading:  https://github.com/hyperledger/fabric-ca/releases/download/v1.2.0/hyperledger-fabric-ca-linux-amd64-1.2.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   657  100   657    0     0    734      0 --:--:-- --:--:-- --:--:--   734
100 4940k  100 4940k    0     0  22622      0  0:03:43  0:03:43 --:--:-- 63008
==> Done.

Pull Hyperledger Fabric docker images

FABRIC_IMAGES: peer orderer ccenv tools javaenv
===> Pulling fabric Images
====> hyperledger/fabric-peer:1.2.0
1.2.0: Pulling from hyperledger/fabric-peer
Digest: sha256:949b38bad9496d7694b54d30b90b72653804d761a44d721c4dc7a16a5cbcabe8
Status: Image is up to date for hyperledger/fabric-peer:1.2.0
docker.io/hyperledger/fabric-peer:1.2.0
====> hyperledger/fabric-orderer:1.2.0
1.2.0: Pulling from hyperledger/fabric-orderer
Digest: sha256:a10f6d1d4cbb5a0264634c8b5ec63ff6cbbfc7c9fb369a06cc6dfe504d976259
Status: Image is up to date for hyperledger/fabric-orderer:1.2.0
docker.io/hyperledger/fabric-orderer:1.2.0
====> hyperledger/fabric-ccenv:1.2.0
1.2.0: Pulling from hyperledger/fabric-ccenv
Digest: sha256:0a7fb37111cafce79cf89ca8d1af5ca6f721e60a8bd1b2b93521e671e3348af2
Status: Image is up to date for hyperledger/fabric-ccenv:1.2.0
docker.io/hyperledger/fabric-ccenv:1.2.0
====> hyperledger/fabric-tools:1.2.0
1.2.0: Pulling from hyperledger/fabric-tools
Digest: sha256:24cca44a2f2ab6325c6ccc1c91a10bd3e0e71764037a85a473f7e9621b3a0f91
Status: Image is up to date for hyperledger/fabric-tools:1.2.0
docker.io/hyperledger/fabric-tools:1.2.0
====> hyperledger/fabric-javaenv:1.2.0
Error response from daemon: manifest for hyperledger/fabric-javaenv:1.2.0 not found: manifest unknown: manifest unknown
Error response from daemon: No such image: hyperledger/fabric-javaenv:1.2.0
Error response from daemon: No such image: hyperledger/fabric-javaenv:1.2.0
===> Pulling fabric ca Image
====> hyperledger/fabric-ca:1.2.0
1.2.0: Pulling from hyperledger/fabric-ca
Digest: sha256:5fe6d502e52ec2a8d98ee5653e1ba31952098115fb57710ddae86f2c3cc82dad
Status: Image is up to date for hyperledger/fabric-ca:1.2.0
docker.io/hyperledger/fabric-ca:1.2.0
===> Pulling thirdparty docker images
等等等等等等等等等等

設置全局訪問

# 進入到 ~/hyperledger-fabric/fabric-samples/bin 目錄
$ cd ~/hyperledger-fabric/fabric-samples/bin
itcast@ubuntu:~/hyperledger-fabric/fabric-samples/bin$ tree
    .
    ├── configtxgen
    ├── configtxlator
    ├── cryptogen
    ├── discover
    ├── fabric-ca-client
    ├── get-docker-images.sh
    ├── idemixgen
    ├── orderer
    └── peer
# 將這些二進制文件拷貝到 /usr/local/bin 目錄下
$ sudo cp * /usr/local/bin
# 執行完上述操作之後, fabric的這些可執行程序就可以在全局範圍內使用了

First-Network 環境測試,生成相應文件

# 進入該文件
cd ~/hyperledger-fabric/fabric-samples/first-network/
#執行./byfn.sh generate命令
ubuntu@VM-0-4-ubuntu:~/hyperledger-fabric/fabric-samples/first-network$ ./byfn.sh generate
#打印日誌
Generating certs and genesis block for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
/home/ubuntu/hyperledger-fabric/fabric-samples/first-network/../bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x

/home/ubuntu/hyperledger-fabric/fabric-samples/first-network/../bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
+ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2020-06-16 09:46:08.892 CST [common/tools/configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen is deprecated.  Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
2020-06-16 09:46:08.892 CST [common/tools/configtxgen] main -> INFO 002 Loading configuration
2020-06-16 09:46:08.899 CST [common/tools/configtxgen/encoder] NewChannelGroup -> WARN 003 Default policy emission is deprecated, please include policy specificiations for the channel group in configtx.yaml
2020-06-16 09:46:08.900 CST [common/tools/configtxgen/encoder] NewOrdererGroup -> WARN 004 Default policy emission is deprecated, please include policy specificiations for the orderer group in configtx.yaml
2020-06-16 09:46:08.900 CST [common/tools/configtxgen/encoder] NewOrdererOrgGroup -> WARN 005 Default policy emission is deprecated, please include policy specificiations for the orderer org group OrdererOrg in configtx.yaml
2020-06-16 09:46:08.901 CST [msp] getMspConfig -> INFO 006 Loading NodeOUs
2020-06-16 09:46:08.901 CST [common/tools/configtxgen/encoder] NewOrdererOrgGroup -> WARN 007 Default policy emission is deprecated, please include policy specificiations for the orderer org group Org1MSP in configtx.yaml
2020-06-16 09:46:08.901 CST [msp] getMspConfig -> INFO 008 Loading NodeOUs
2020-06-16 09:46:08.901 CST [common/tools/configtxgen/encoder] NewOrdererOrgGroup -> WARN 009 Default policy emission is deprecated, please include policy specificiations for the orderer org group Org2MSP in configtx.yaml
2020-06-16 09:46:08.901 CST [common/tools/configtxgen] doOutputBlock -> INFO 00a Generating genesis block
2020-06-16 09:46:08.902 CST [common/tools/configtxgen] doOutputBlock -> INFO 00b Writing genesis block
+ res=0
+ set +x

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2020-06-16 09:46:08.939 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2020-06-16 09:46:08.946 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2020-06-16 09:46:08.947 CST [common/tools/configtxgen/encoder] NewApplicationGroup -> WARN 003 Default policy emission is deprecated, please include policy specificiations for the application group in configtx.yaml
2020-06-16 09:46:08.947 CST [msp] getMspConfig -> INFO 004 Loading NodeOUs
2020-06-16 09:46:08.947 CST [common/tools/configtxgen/encoder] NewApplicationOrgGroup -> WARN 005 Default policy emission is deprecated, please include policy specificiations for the application org group Org1MSP in configtx.yaml
2020-06-16 09:46:08.948 CST [msp] getMspConfig -> INFO 006 Loading NodeOUs
2020-06-16 09:46:08.948 CST [common/tools/configtxgen/encoder] NewApplicationOrgGroup -> WARN 007 Default policy emission is deprecated, please include policy specificiations for the application org group Org2MSP in configtx.yaml
2020-06-16 09:46:08.949 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 008 Writing new channel tx
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2020-06-16 09:46:08.986 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2020-06-16 09:46:08.995 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2020-06-16 09:46:08.995 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2020-06-16 09:46:09.034 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2020-06-16 09:46:09.042 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2020-06-16 09:46:09.043 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x

啓動網絡

# 執行以下命令
ubuntu@VM-0-4-ubuntu:~/hyperledger-fabric/fabric-samples/first-network$ ./byfn.sh up
#打印日誌
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
LOCAL_VERSION=1.2.0
DOCKER_IMAGE_VERSION=1.2.0
Creating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating peer0.org2.example.com ... done
Creating peer1.org1.example.com ... done
Creating peer0.org1.example.com ... done
Creating peer1.org2.example.com ... done
Creating orderer.example.com    ... done
Creating cli                    ... done

 ____    _____      _      ____    _____ 
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |  
 ___) |   | |    / ___ \  |  _ <    | |  
|____/    |_|   /_/   \_\ |_| \_\   |_|  

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-06-16 01:47:27.605 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:27.661 UTC [cli/common] readBlock -> INFO 002 Got status: &{NOT_FOUND}
2020-06-16 01:47:27.665 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-06-16 01:47:27.874 UTC [cli/common] readBlock -> INFO 004 Received block: 0
===================== Channel 'mychannel' created ===================== 

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-06-16 01:47:27.962 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:28.060 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org1 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-06-16 01:47:31.171 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:31.246 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org1 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-06-16 01:47:34.322 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:34.394 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org2 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-06-16 01:47:37.467 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:37.578 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel 'mychannel' ===================== 

Updating anchor peers for org1...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-06-16 01:47:40.659 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:40.670 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' ===================== 

Updating anchor peers for org2...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-06-16 01:47:43.748 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-06-16 01:47:43.760 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' ===================== 

Installing chaincode on peer0.org1...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-06-16 01:47:46.834 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-06-16 01:47:46.834 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-06-16 01:47:47.891 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org1 ===================== 

Install chaincode on peer0.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-06-16 01:47:47.969 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-06-16 01:47:47.969 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-06-16 01:47:48.144 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org2 ===================== 

Instantiating chaincode on peer0.org2...
+ peer chaincode instantiate -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P 'AND ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
+ res=0
+ set +x
2020-06-16 01:47:48.227 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-06-16 01:47:48.227 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
===================== Chaincode is instantiated on peer0.org2 on channel 'mychannel' ===================== 

Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... ===================== 
Attempting to Query peer0.org1 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
+ res=0
+ set +x

100
===================== Query successful on peer0.org1 on channel 'mychannel' ===================== 
Sending invoke transaction on peer0.org1 peer0.org2...
+ peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2020-06-16 01:49:01.639 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' ===================== 

Installing chaincode on peer1.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-06-16 01:49:01.719 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-06-16 01:49:01.719 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-06-16 01:49:01.911 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer1.org2 ===================== 

Querying chaincode on peer1.org2...
===================== Querying on peer1.org2 on channel 'mychannel'... ===================== 
Attempting to Query peer1.org2 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
+ res=0
+ set +x

90
===================== Query successful on peer1.org2 on channel 'mychannel' ===================== 

========= All GOOD, BYFN execution completed =========== 


 _____   _   _   ____   
| ____| | \ | | |  _ \  
|  _|   |  \| | | | | | 
| |___  | |\  | | |_| | 
|_____| |_| \_| |____/  

當出現end時則表示該網絡啓動成功

$ docker ps   查看節點的啓動情況

$ ./byfn.sh down  停止網絡

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章