Hyperledger Fabric命令详解之 up

gaolong0 2019-06-28

sudo ./byfn.sh up


a@ubuntu:~/hyfa/fabric-samples/first-network$ sudo ./byfn.sh up

> 创建网络,peer,orderer,cli


Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y

执行中。。。

proceeding ...

2018-07-10 01:55:17.481 UTC [main] main -> INFO 001 Exiting.....

LOCAL_VERSION=1.1.0

DOCKER_IMAGE_VERSION=1.1.0

创建网络

Creating network "net_byfn" with the default driver

使用默认引擎,创建组织节点的volume

Creating volume "net_peer0.org2.example.com" with default driver

Creating volume "net_peer1.org2.example.com" with default driver

Creating volume "net_peer1.org1.example.com" with default driver

Creating volume "net_peer0.org1.example.com" with default driver

Creating volume "net_orderer.example.com" with default driver

创建节点,peer和指定oederer (.example.com是域名)

Creating peer0.org2.example.com

Creating peer1.org2.example.com

Creating peer1.org1.example.com

Creating orderer.example.com

Creating peer0.org1.example.com

创建cli

Creating cli


start


创建你的第一个拜占庭网络,end-to-end 测试

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

Channel name : mychannel

> 创建通道

Creating channel...

peer TLS 根证书 文件

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

peer TLS KTY 文件

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

peer 本地msp ID

CORE_PEER_LOCALMSPID=Org1MSP

VM 端口

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

peer TLS 证书 文件

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

peer TLS 状态

CORE_PEER_TLS_ENABLED=true

peer TLS 配置路径

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp

peer ID

CORE_PEER_ID=cli

登陆 等级

CORE_LOGGING_LEVEL=INFO

peer 地址

CORE_PEER_ADDRESS=peer0.org1.example.com:7051

+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

2018-07-10 01:55:27.536 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

2018-07-10 01:55:27.637 UTC [main] main -> INFO 002 Exiting.....

创建通道成功

===================== Channel "mychannel" is created successfully =====================


> 将所有节点加入通道


Having all peers join the channel...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org1MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer0.org1.example.com:7051

+peer channel join -b mychannel.block

+res=0

+set +x

2018-07-10 01:55:27.705 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

2018-07-10 01:55:27.870 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

2018-07-10 01:55:27.870 UTC [main] main -> INFO 003 Exiting.....

peer0.org1 加入通道

===================== peer0.org1 joined on the channel "mychannel" =====================

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org1MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer1.org1.example.com:7051

+peer channel join -b mychannel.block

+res=0

+set +x

2018-07-10 01:55:30.932 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

2018-07-10 01:55:31.051 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

2018-07-10 01:55:31.051 UTC [main] main -> INFO 003 Exiting.....

peer1.org1 加入通道

===================== peer1.org1 joined on the channel "mychannel" =====================

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org2MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer0.org2.example.com:7051

+peer channel join -b mychannel.block

+res=0

+set +x

2018-07-10 01:55:34.140 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

2018-07-10 01:55:34.299 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

2018-07-10 01:55:34.299 UTC [main] main -> INFO 003 Exiting.....

peer0.org2 加入通道

===================== peer0.org2 joined on the channel "mychannel" =====================

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org2MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer1.org2.example.com:7051

+peer channel join -b mychannel.block

+res=0

+set +x

INFO 001 Endorser 和 orderer 连接初始化完成

2018-07-10 01:55:37.360 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

INFO 002 成功提交请求(请求加入通道)

2018-07-10 01:55:37.468 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

INFO 003 退出中。。

2018-07-10 01:55:37.468 UTC [main] main -> INFO 003 Exiting.....

peer1.org2加入通道

===================== peer1.org2 joined on the channel "mychannel" =====================

更新org1 的anchor节点

Updating anchor peers for org1...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org1MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer0.org1.example.com:7051

+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

INFO 001 , Endorser 和 orderer 连接 初始化完成

2018-07-10 01:55:40.523 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

INFO 002 成功提交提交通道更新

2018-07-10 01:55:40.537 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update

INFO 003 退出中。。

2018-07-10 01:55:40.537 UTC [main] main -> INFO 003 Exiting.....

通道上Org1MSP 的anchor节点 更新成功

===================== Anchor peers for org "Org1MSP" on "mychannel" is updated successfully =====================

更新org2 的anchor节点。。。

Updating anchor peers for org2...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org2MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer0.org2.example.com:7051

+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

2018-07-10 01:55:43.745 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized

2018-07-10 01:55:43.766 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update

2018-07-10 01:55:43.766 UTC [main] main -> INFO 003 Exiting.....

通道中的org2MSP 的anchor节点 更新成功

===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully =====================


安装链码到peer0.org1

Installing chaincode on peer0.org1...

+peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org1MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer0.org1.example.com:7051

+res=0

+set +x

INFO 001,使用默认escc

2018-07-10 01:55:46.900 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc

INFO 002,使用默认vscc

2018-07-10 01:55:46.900 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

INFO 003 退出。。。

2018-07-10 01:55:48.856 UTC [main] main -> INFO 003 Exiting.....

peer0.org1 上链码,安装成功

===================== Chaincode is installed on peer0.org1 =====================

在peer0.org2 上安装链码

Install chaincode on peer0.org2...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

CORE_PEER_LOCALMSPID=Org2MSP

CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

CORE_PEER_TLS_ENABLED=true

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp

CORE_PEER_ID=cli

CORE_LOGGING_LEVEL=INFO

CORE_PEER_ADDRESS=peer0.org2.example.com:7051

节点链码安装 --注意格式 -n链码 -v版本号 -l语言 -p

+peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/

+res=0

+set +x

2018-07-10 01:55:48.956 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc

2018-07-10 01:55:48.956 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

2018-07-10 01:55:49.125 UTC [main] main -> INFO 003 Exiting.....

peer0.org2 上链码安装成功

===================== Chaincode is installed on peer0.org2 =====================


实例化 peer0.org2上的链码。。。

Instantiating chaincode on peer0.org2...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051

节点链码实例化--注意格式 -o --tls --cafile -C -n -l -c

+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 'OR ('''Org1MSP.peer''','''Org2MSP.peer''')'

+res=0

+set +x

2018-07-10 01:55:49.315 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc

2018-07-10 01:55:49.315 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

2018-07-10 01:56:26.781 UTC [main] main -> INFO 003 Exiting.....

通道上 peer0.org2 链码实例化成功

===================== Chaincode Instantiation on peer0.org2 on channel 'mychannel' is successful =====================


请求 peer0.org1 。。。

Querying chaincode on peer0.org1...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051

在通道上,请求 peer0.org1

===================== Querying on peer0.org1 on channel 'mychannel'... =====================

节点链码请求-注意格式-C通道 -n链码 -c参数

+peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'

Attempting to Query peer0.org1 ...3 secs

+res=0

+set +x

2018-07-10 01:56:30.181 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc

2018-07-10 01:56:30.181 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

请求结果:100

Query Result: 100

2018-07-10 01:57:05.171 UTC [main] main -> INFO 003 Exiting.....

通道上,向peer0.org1的请求成功

===================== Query on peer0.org1 on channel 'mychannel' is successful =====================


链码调用,发送交易到peer0.org1。。。

Sending invoke transaction on peer0.org1...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051

+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

-c '{"Args":["invoke","a","b","10"]}'

+res=0

+set +x

2018-07-10 01:57:06.763 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc

2018-07-10 01:57:06.763 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

链码调用or请求,INFO 003,链码调用:成功,结果状态码:200

2018-07-10 01:57:06.835 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200

INFO 004 退出。。。

2018-07-10 01:57:06.835 UTC [main] main -> INFO 004 Exiting.....

通道上,向peer0.org1发送的交易invoke,成功

===================== Invoke transaction on peer0.org1 on channel 'mychannel' is successful =====================


在peer1.org2上安装链码

Installing chaincode on peer1.org2...

+peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051

+res=0

+set +x

2018-07-10 01:57:06.953 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-07-10 01:57:06.954 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2018-07-10 01:57:08.024 UTC [main] main -> INFO 003 Exiting.....

peer1.org2上链码安装成功

===================== Chaincode is installed on peer1.org2 =====================

请求 peer1.org2上 链码。。。

Querying chaincode on peer1.org2...

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051

请求peer1.org2上链码

===================== Querying on peer1.org2 on channel 'mychannel'... =====================

+peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer1.org2 ...3 secs

+res=0

+set +x

2018-07-10 01:57:11.240 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-07-10 01:57:11.240 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

请求结果:90

Query Result: 90

2018-07-10 01:57:43.272 UTC [main] main -> INFO 003 Exiting.....

通道上,peer1.org2请求成功

通道上,peer1.org2,请求成功

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

拜占庭执行完成

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


end


相关推荐