欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Hyperledger Fabric环境搭建

程序员文章站 2022-07-14 16:23:10
...

一、环境搭建

####################

## Docker17.**

## Go1.7.**

## Node.js8.4.* Stable

####################

环境准备

使用root账户登录

      下载Curl:

--获得安装包,从网上直接下载或者其他途径,这里直接wget

wget http://curl.haxx.se/download/curl-7.58.0.tar.gz

--解压到/usr/local/curl

tar –C /usr/local/curl -zxf curl-7.58.0.tar.gz

--进入解压后的目录内

cd /usr/local/curl

--配置,指定安装的目录,这里是”/usr/local/curl”

./configure --prefix=/usr/local/curl

--

make

--安装

make install

--安装完毕

--设置环境变量

# vi /etc/profile 添加以下内容:

export PATH=$PATH:/usr/local/curl/bin

# 执行source命令:

source /etc/profile

      Docker and Docker Compose

--下载dockers ce

wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm
sudo yum install docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm

--启动docker:

sudo systemctl start docker

--下载docker compose

sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

--对二进制文件应用可执行权限:

sudo chmod +x /usr/local/bin/docker-compose

--作为非root用户管理Docker:

--创建docker组

sudo groupadd docker

--添加你的用户到docker组

sudo usermod -aG docker $USER

      安装GO:

--下载安装文件:

wget https://golang.org/doc/install?download=go1.6.2.linux-amd64.tar.gz

--解压文件:

tar -C /usr/local/go-xzf go1.6.2.linux-amd64.tar.gz

--设置环境变量:

# vi /etc/profile 添加以下内容:

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/gopath

# 执行source命令:

source /etc/profile

      安装Nodejs

--下载安装文件

wget https://nodejs.org/download/release/v8.4.0/node-v8.4.0-linux-x64.tar.xz

--解压文件:

tar -C /usr/local/node-xJf node-v8.4.0-linux-x64.tar.xz

--设置环境变量:

# vi /etc/profile 添加以下内容:

export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH

# 执行source命令:

source /etc/profile

环境准备完毕,使用abs用户登陆

二、启动Fabric网络

####################

## Fabric-sample-v1.0.6

####################

下载fabric-sample:

--下载压缩包

wget https://github.com/hyperledger/fabric-samples/archive/v1.0.6.tar.gz

--解压:

tar -zxf v1.0.6.tar.gz

--进入fabric-sample

cd fabric-samples-1.0.6

--下载特定于平台的二进制文件和docker镜像

curl -sSLhttps://goo.gl/6wtTN5 | bash -s 1.0.6

--Note:如果curl报错,可先*下载脚本文件,再执行脚本

# curl: (7) Failed to connect to 2404:6800:4005:80b::200e: Network isunreachable

wget https://goo.gl/6wtTN5

bash 6wtTN5 1.0.6

--Note:可以设置docker daemon提升下载速度,编辑/etc/docker/daemon.json文件,新增以下内容,然后重启docker

{

  "registry-mirrors":["https://registry.docker-cn.com"]

}

--设置环境变量(非必选)

export PATH=<path todownload location>/bin:$PATH

      运行First Network例子

--进入first-network

cd fabric-samples/first-network

--首先,运行cryptogen工具

../bin/cryptogen generate --config=./crypto-config.yaml

--可以看到输出以下:

org1.example.com

org2.example.com

--接下来,告诉configtxgen当前目录

export FABRIC_CFG_PATH=$PWD

--然后,调用configtxgen工具来创建orderer初始块

../bin/configtxgen -profileTwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

--可以看到输出以下:

2017-10-2619:21:56.301 EDT [common/tools/configtxgen] main -> INFO 001 Loadingconfiguration

2017-10-2619:21:56.309 EDT [common/tools/configtxgen] doOutputBlock -> INFO 002 Generatinggenesis block

2017-10-2619:21:56.309 EDT [common/tools/configtxgen] doOutputBlock -> INFO 003 Writing genesisblock

--接下来,创建通道事务工件并设置CHANNEL_NAME 

export CHANNEL_NAME=mychannel  && ../bin/configtxgen -profileTwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID$CHANNEL_NAME

--可以看到输出以下:

2017-10-2619:24:05.324 EDT [common/tools/configtxgen] main -> INFO 001 Loadingconfiguration

2017-10-2619:24:05.329 EDT [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating newchannel configtx

2017-10-2619:24:05.329 EDT [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 003 Writing newchannel tx

--接下来,在正在构建的channel上,为Org1定义peer

../bin/configtxgen -profileTwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID$CHANNEL_NAME -asOrg Org1MSP

--现在,在正在构建的channel上,为Org2定义peer

../bin/configtxgen -profileTwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx-channelID $CHANNEL_NAME -asOrg Org2MSP

--注释docker-compose-cli.yaml文件的第77行

#command: /bin/bash-c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'

command: /bin/bash

--启动网络(with couchDB)

docker-compose -fdocker-compose-cli.yaml -f docker-compose-couch.yaml up -d

--查看docker容器

docker ps -a

--使用docker exec命令进入CLI容器

docker exec -it cli bash

--可以看到输出以下:

[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer#

--接下来,创建通道配置事务部分并设置CHANNEL_NAME 环境变量

exportCHANNEL_NAME=mychannel

 

# the channel.txfile is mounted in the channel-artifacts directory within your CLI container

# as a result, wepass the full path for the file

# we also pass thepath for the orderer ca-cert in order to verify the TLS handshake

# be sure to exportor replace the $CHANNEL_NAME variable appropriately

 

peer channel create -oorderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx--tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

--可以看到输出以下:

2018-03-1405:41:49.741 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1405:41:49.741 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1405:41:49.750 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser andorderer connections initialized

2018-03-1405:41:49.750 UTC [msp] GetLocalMSP -> DEBU 004 Returning existinglocal MSP

2018-03-1405:41:49.750 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtainingdefault signing identity

2018-03-1405:41:49.750 UTC [msp] GetLocalMSP -> DEBU 006 Returning existinglocal MSP

2018-03-1405:41:49.750 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtainingdefault signing identity

2018-03-1405:41:49.750 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext:0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D

2018-03-1405:41:49.750 UTC [msp/identity] Sign -> DEBU 009 Sign: digest:724C0AFC8AE3B1FBE1E06F6C2ECB2351799C70F9EC255C72B8E0914E3526CBCB

2018-03-1405:41:49.750 UTC [msp] GetLocalMSP -> DEBU 00a Returning existinglocal MSP

2018-03-1405:41:49.750 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtainingdefault signing identity

2018-03-1405:41:49.750 UTC [msp] GetLocalMSP -> DEBU 00c Returning existinglocal MSP

2018-03-1405:41:49.750 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtainingdefault signing identity

2018-03-1405:41:49.750 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext:0AC3060A1508021A06089DECA2D50522...22B2C71C7863D4F074B094E1B0EEC25A

2018-03-1405:41:49.750 UTC [msp/identity] Sign -> DEBU 00f Sign: digest:9F533E945846BD40629AB056ABAD0E0DA82E3F439409274703FC39B8DFCD7889

2018-03-1405:41:49.932 UTC [msp] GetLocalMSP -> DEBU 010 Returning existinglocal MSP

2018-03-1405:41:49.932 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtainingdefault signing identity

2018-03-1405:41:49.932 UTC [msp] GetLocalMSP -> DEBU 012 Returning existinglocal MSP

2018-03-1405:41:49.932 UTC [msp] GetDefaultSigningIdentity -> DEBU 013 Obtainingdefault signing identity

2018-03-1405:41:49.932 UTC [msp/identity] Sign -> DEBU 014 Sign: plaintext:0AC3060A1508021A06089DECA2D50522...ED283512239C12080A021A0012021A00

2018-03-1405:41:49.932 UTC [msp/identity] Sign -> DEBU 015 Sign: digest:62D299721B1C374EA912F49E85B95493C5E2EC334FB459E0A9480E9E96370F1E

2018-03-1405:41:49.950 UTC [channelCmd] readBlock -> DEBU 016 Got status:&{NOT_FOUND}

2018-03-1405:41:49.950 UTC [msp] GetLocalMSP -> DEBU 017 Returning existinglocal MSP

2018-03-1405:41:49.950 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtainingdefault signing identity

2018-03-1405:41:50.020 UTC [channelCmd] InitCmdFactory -> INFO 019 Endorser andorderer connections initialized

2018-03-1405:41:50.221 UTC [msp] GetLocalMSP -> DEBU 01a Returning existinglocal MSP

2018-03-1405:41:50.221 UTC [msp] GetDefaultSigningIdentity -> DEBU 01b Obtainingdefault signing identity

2018-03-1405:41:50.221 UTC [msp] GetLocalMSP -> DEBU 01c Returning existinglocal MSP

2018-03-1405:41:50.221 UTC [msp] GetDefaultSigningIdentity -> DEBU 01d Obtainingdefault signing identity

2018-03-14 05:41:50.221UTC [msp/identity] Sign -> DEBU 01e Sign: plaintext:0AC3060A1508021A06089EECA2D50522...E4C656B8785312080A021A0012021A00

2018-03-1405:41:50.221 UTC [msp/identity] Sign -> DEBU 01f Sign: digest:FCD1CA7B7AB8F6DD4E21F8CB30EE311D7AF3747A63FA486D5B89C4372CEEC484

2018-03-1405:41:50.225 UTC [channelCmd] readBlock -> DEBU 020 Received block: 0

2018-03-1405:41:50.225 UTC [main] main -> INFO 021 Exiting.....

--将 peer0.org1.example.com加入到channel

peer channel join -bmychannel.block

--可以看到输出以下:

2018-03-1405:47:21.982 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1405:47:21.982 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1405:47:22.003 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser andorderer connections initialized

2018-03-1405:47:22.004 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext:0A89070A5B08011A0B08EAEEA2D50510...C9BD26587C861A080A000A000A000A00

2018-03-1405:47:22.004 UTC [msp/identity] Sign -> DEBU 005 Sign: digest:4065DCC89B6A390BC8AAC845FE1A280FAA15573F0BAD296509FB4A696F28B87E

2018-03-1405:47:22.080 UTC [channelCmd] executeJoin -> INFO 006 Peer joined thechannel!

2018-03-1405:47:22.081 UTC [main] main -> INFO 007 Exiting.....

--安装Chaincode

peer chaincodeinstall -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

--可以看到输出以下:

2018-03-1405:56:07.000 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1405:56:07.000 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1405:56:07.000 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Usingdefault escc

2018-03-1405:56:07.000 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Usingdefault vscc

2018-03-1405:56:07.080 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFSgithub.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

2018-03-1405:56:07.344 UTC [golang-platform] func1 -> DEBU 006 DiscardingGOROOT package fmt

2018-03-1405:56:07.344 UTC [golang-platform] func1 -> DEBU 007 Discardingprovided package github.com/hyperledger/fabric/core/chaincode/shim

2018-03-1405:56:07.344 UTC [golang-platform] func1 -> DEBU 008 Discardingprovided package github.com/hyperledger/fabric/protos/peer

2018-03-1405:56:07.344 UTC [golang-platform] func1 -> DEBU 009 DiscardingGOROOT package strconv

2018-03-1405:56:07.344 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done

2018-03-1405:56:07.351 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext:0A8A070A5C08031A0C08F7F2A2D50510...5F74FD270000FFFFDB02AC89002C0000

2018-03-1405:56:07.351 UTC [msp/identity] Sign -> DEBU 00c Sign: digest:A0F3130986225BD88CBBD58E405FDB3253885673AB4859C33F60BEDDD694CBA3

2018-03-1405:56:07.360 UTC [chaincodeCmd] install -> DEBU 00d Installed remotelyresponse:<status:200 payload:"OK" >

2018-03-1405:56:07.361 UTC [main] main -> INFO 00e Exiting.....

--实例化Chaincode

peer chaincodeinstantiate -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n mycc -v 1.0 -c'{"Args":["init","a", "100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')"

--可以看到输出以下:

2018-03-1406:17:57.097 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1406:17:57.097 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1406:17:57.102 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Usingdefault escc

2018-03-1406:17:57.102 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Usingdefault vscc

2018-03-1406:17:57.103 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext:0A94070A6608031A0B0895FDA2D50510...324D53500A04657363630A0476736363

2018-03-1406:17:57.103 UTC [msp/identity] Sign -> DEBU 006 Sign: digest:4DA0BF16C8FC12E63814400E4C96B7711C0C5118CA4D646B7FE41C09033B7BF6

2018-03-1406:18:34.404 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext:0A94070A6608031A0B0895FDA2D50510...029C4EF234617ED6474537F408401391

2018-03-1406:18:34.404 UTC [msp/identity] Sign -> DEBU 008 Sign: digest:4ECE42D944E47E4A38133839B8210ADCD8222BFBB8B6F3AAA2148BFF3F3FC290

2018-03-1406:18:34.424 UTC [main] main -> INFO 009 Exiting.....

--查询

peer chaincodequery -C $CHANNEL_NAME -n mycc -c'{"Args":["query","a"]}'

--可以看到输出以下:

2018-03-1406:17:57.097 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1406:17:57.097 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1406:17:57.102 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Usingdefault escc

2018-03-1406:17:57.102 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Usingdefault vscc

2018-03-1406:17:57.103 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext:0A94070A6608031A0B0895FDA2D50510...324D53500A04657363630A0476736363

2018-03-1406:17:57.103 UTC [msp/identity] Sign -> DEBU 006 Sign: digest:4DA0BF16C8FC12E63814400E4C96B7711C0C5118CA4D646B7FE41C09033B7BF6

2018-03-1406:18:34.404 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext:0A94070A6608031A0B0895FDA2D50510...029C4EF234617ED6474537F408401391

2018-03-1406:18:34.404 UTC [msp/identity] Sign -> DEBU 008 Sign: digest:4ECE42D944E47E4A38133839B8210ADCD8222BFBB8B6F3AAA2148BFF3F3FC290

2018-03-1406:18:34.424 UTC [main] main -> INFO 009 Exiting.....

code query -C$CHANNEL_NAME -n mycc -c'{"Args":["query","a"]}'/peer# peer chain

2018-03-1406:21:54.202 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1406:21:54.202 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1406:21:54.202 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Usingdefault escc

2018-03-1406:21:54.202 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Usingdefault vscc

2018-03-14 06:21:54.202UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext:0A94070A6608031A0B0882FFA2D50510...6D7963631A0A0A0571756572790A0161

2018-03-1406:21:54.203 UTC [msp/identity] Sign -> DEBU 006 Sign: digest:48C7E7DB95DBE4AB6E59F4AD95D782A7ACDD6B30C541D2CA0BEA3A61CC1D66D1

Query Result: 100

2018-03-1406:21:54.239 UTC [main] main -> INFO 007 Exiting.....

--调用

peer chaincodeinvoke -o orderer.example.com:7050  --tls--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 $CHANNEL_NAME -n mycc -c'{"Args":["invoke","a","b","10"]}'

--可以看到输出以下:

2018-03-14 06:25:32.621UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP

2018-03-1406:25:32.621 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1406:25:32.627 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Usingdefault escc

2018-03-1406:25:32.627 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Usingdefault vscc

2018-03-1406:25:32.628 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext:0A95070A6708031A0C08DC80A3D50510...696E766F6B650A01610A01620A023130

2018-03-1406:25:32.628 UTC [msp/identity] Sign -> DEBU 006 Sign: digest:04A548336C4B8737C6F7AB466B809D1346D6708294D709C3DE43860C8D170EAD

2018-03-1406:25:32.656 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext:0A95070A6708031A0C08DC80A3D50510...A8DB08FD07A45A927B6516D256078FD2

2018-03-1406:25:32.656 UTC [msp/identity] Sign -> DEBU 008 Sign: digest:C183F7F1B9BD1165D6C665895667AD2F5C7D4207C52023C46A86A1F86E814D91

2018-03-1406:25:32.673 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 009 ESCC invokeresult: version:1 response:<status:200 message:"OK" >payload:"\n\207P5\262;>\347\365\313\005J\322\366\264\245\035`\2162\371Ew\236\233Jb\017\003i%\252\317\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\002\022-\n\004mycc\022%\n\007\n\001a\022\002\010\002\n\007\n\001b\022\002\010\002\032\007\n\001a\032\00290\032\010\n\001b\032\003210\032\003\010\310\001\"\013\022\004mycc\032\0031.0"endorsement:<endorser:"\n\007Org1MSP\022\200\006-----BEGIN-----\nMIICGTCCAb+gAwIBAgIQcS7SuO2nv2TtX/HdOCKMmjAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xODAzMTQwNTE4MTlaFw0yODAzMTEwNTE4MTla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAER0+k9W6kx4y+6etWSf81Raf3wXxQCBbK\nH6trtHoycYn3pBcdhHeoTgXvTFUVGUtABtSlWFlGI0A5SraoKGGKgKNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAg/vyB+9nX6TFf\n3raWDGt7V6grVvCxCvkWLgoo+SEGwnAwCgYIKoZIzj0EAwIDSAAwRQIhAOxYMpMY\nUvGpksjSpxbNM9LMujoR0cxpkCXwXszZr10RAiBLyjuervii8R1p/U/IIGtHlWd6\nckmwXU9c+sHRbCZbsw==\n-----END-----\n" signature:"0E\002!\000\200n\220\325~\265\242\353i\312\211\\\004yI\324\340\375\372y.\227\222\031$\206(\332\347%\306f\002e\261\337\214\312\301\376\305\277C\343\3633\234\350k\250\333\010\375\007\244Z\222{e\026\322V\007\217\322">

2018-03-1406:25:32.674 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 00a Chaincodeinvoke successful. result: status:200

2018-03-1406:25:32.683 UTC [main] main -> INFO 00b Exiting.....

--查询

peer chaincodequery -C $CHANNEL_NAME -n mycc -c'{"Args":["query","a"]}'

--可以看到输出以下:

2018-03-1406:29:55.523 UTC [msp] GetLocalMSP -> DEBU 001 Returning existinglocal MSP

2018-03-1406:29:55.523 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtainingdefault signing identity

2018-03-1406:29:55.523 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Usingdefault escc

2018-03-1406:29:55.523 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Usingdefault vscc

2018-03-1406:29:55.523 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext:0A95070A6708031A0C08E382A3D50510...6D7963631A0A0A0571756572790A0161

2018-03-1406:29:55.523 UTC [msp/identity] Sign -> DEBU 006 Sign: digest:5CB0155AB8BF66BD20362C1DC1D4E9CBC9B38CBB8F94D24ACD3C350589EC02FD

Query Result: 90

2018-03-1406:29:55.547 UTC [main] main -> INFO 007 Exiting.....

--退出CLI

exit

--停止网络

docker-compose -fdocker-compose-cli.yaml -f docker-compose-couch.yaml down