资讯专栏INFORMATION COLUMN

Hyperledger Fabric命令详解之 up

newtrek / 1137人阅读

摘要:创建网络,,,执行中。。。通道上,向发送的交易,成功在上安装链码上链码安装成功请求上链码。。。请求上链码请求结果通道上,请求成功通道上,,请求成功拜占庭执行完成

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/Admin@org1.example.com/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/Admin@org1.example.com/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/Admin@org1.example.com/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/Admin@org2.example.com/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/Admin@org2.example.com/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/Admin@org1.example.com/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/Admin@org2.example.com/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/Admin@org1.example.com/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/Admin@org2.example.com/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/Admin@org2.example.com/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/Admin@org1.example.com/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/Admin@org1.example.com/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/Admin@org2.example.com/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/Admin@org2.example.com/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


文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/24194.html

相关文章

  • Hyperledger Fabric 命令详解“ generate ”

    摘要:利用生成证书生成创世区块下载下载下载生成创世区块写入创世区块创建通道配置交易下载配置生成交易配置下载下载写入通道交易更新,生成锚节点 sudo ./byfn.sh -m generate a@ubuntu:~/hyfa/fabric-samples/first-network$ sudo ./byfn.sh -m generate Generating certs and gene...

    qiangdada 评论0 收藏0
  • Hyperledger Fabric(构建你的第一个网络)

    摘要:构建你的第一个网络方案提供了一个包含两个组织的示例网络,每个组织维护两个对等节点,以及一个独立排序服务。它还将启动一个容器来运行脚本执行,该执行将对等点连接到一个通道,部署和实例化链码并驱动针对部署的链码执行交易。 构建你的第一个网络 这些说明已经过验证,可以与最新的稳定Docker镜像和提供的tar文件中预编译的安装实用程序一起工作,如果使用当前主分支中的镜像或工具运行这些命令,则可...

    XUI 评论0 收藏0
  • Hyperledger Fabric 命令详解 down

    摘要:停止客户端停止节点,和删除客户端删除和删除网络删除节点容器检查网络检查容器删除删除删除自动化脚本会将生成的文件一起删掉所以,如果需要保留文件的话需要手动删除 ./bash.sh down a@ubuntu:~/hyfa/fabric-samples/first-network$ sudo ./byfn.sh down [sudo] password for a: Stopping w...

    jonh_felix 评论0 收藏0
  • 基于ubuntu16.04部署IBM开源区块链项目-弹珠资产管理(Marbles)

    摘要:协议的细节由一个名为的处理。运行下面的脚本来让所有的事情都发生一两分钟后,命令提示符将返回运行结果如下图所示现在运行该命令查看当前正在运行的容器。 showImg(https://segmentfault.com/img/bVbazHF?w=709&h=159); 前言 本教程基本上是对Marbles项目的翻译过程. 如果英文比较好的话,建议根据官方操作说明,一步步进行环境部署。当然你...

    voidking 评论0 收藏0
  • 联盟链初识以及Fabric环境搭建流程

    摘要:本文首发于深入浅出区块链社区原文链接联盟链初识以及环境搭建流程原文已更新,请读者前往原文阅读这篇文章首先简单介绍了联盟链是什么,再详细的介绍了环境搭建的整个流程。 本文首发于深入浅出区块链社区原文链接:联盟链初识以及Fabric环境搭建流程原文已更新,请读者前往原文阅读 这篇文章首先简单介绍了联盟链是什么,再详细的介绍了Fabric环境搭建的整个流程。 区块链分类: 以参与方式分类,区...

    CoffeX 评论0 收藏0

发表评论

0条评论

newtrek

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<