成都创新互联网站制作重庆分公司

超级账本Fabric1.0环境搭建实践-持续更新中……

多机部署后内网IP分别为10.18.22.221,10.18.22.222,10.18.22.223,10.18.22.224,10.18.22.225.

十余年的城口网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站的优势是能够根据用户设备显示端的尺寸不同,自动调整城口建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“城口网站设计”,“城口网站推广”以来,每个客户项目都认真落实执行。

其中10.18.22.221为orderer节点,其余4个为peer节点。

域名分别为orderer.com,peer0.org1.com,peer1.org1.com,peer0.org2.com,peer1.org2.com.

其中默认在peer0.org1.com,peer0.org2.com,peer1.org2.com上安装了chaincode,在peer1.org1上未安装chaincode。

成功启动集群后,

一、在10.18.22.223(peer1.org1.example.com)上安装智能合约chainCode过程如下:

1、通过下面命令进入10.18.22.223(peer1.org1.example.com)的容器

docker exec -it cli bash

进入容器后,默认路径如下:

root@6e75c97a960a:/opt/gopath/src/github.com/hyperledger/fabric/peer#

2、执行智能合约ChainCode安装命令

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

命令执行后,日志过程如下:

2018-03-26 02:44:25.468 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-03-26 02:44:25.469 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-03-26 02:44:25.469 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-03-26 02:44:25.469 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-03-26 02:44:28.521 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 2018-03-26 02:44:30.351 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt 2018-03-26 02:44:30.352 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim 2018-03-26 02:44:30.352 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer 2018-03-26 02:44:30.352 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv 2018-03-26 02:44:30.352 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done 2018-03-26 02:44:30.356 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A8A070A5C08031A0C088EBDE1D50510...5F74FD270000FFFFCEF44F9B002C0000 2018-03-26 02:44:30.356 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 9D17182BF883747B383970BEFD9C4DEBB0BB07ADCADD5F0C3C4DF5D9D57F12A0 2018-03-26 02:44:30.379 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:

说明该Chaincode已经安装成功。这个命令将chaincode的源码安装到该peer节点的文件系统中。

3、调用命令查询Chaincode

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

调用该命令后,将会启动智能合约容器。等待一段时间,将得到查询结果。

root@6e75c97a960a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C mychannel -n mycc -c \'{"Args":["query","a"]}\' 2018-03-26 02:58:50.594 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-03-26 02:58:50.594 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-03-26 02:58:50.594 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-03-26 02:58:50.595 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-03-26 02:58:50.595 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C08EAC3E1D50510...6D7963631A0A0A0571756572790A0161 2018-03-26 02:58:50.595 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: B4B927D16A7B0B16747B264E0336F79769F5F841F67B1C70C2B75431ACD1E168 Query Result: 90 2018-03-26 02:58:50.618 UTC [main] main -> INFO 007 Exiting.....

4、新建一个命令窗口,通过docker-ps 查询,已经能够查到,新安装的链码容器。

[root@localhost ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d20a155e430e dev-peer1.org1.example.com-mycc-1.0 "chaincode -peer.add…" 18 seconds ago Up 16 seconds dev-peer1.org1.example.com-mycc-1.0 6e75c97a960a hyperledger/fabric-tools "/bin/bash" 28 minutes ago Up 28 minutes cli 0d70e326c8c5 hyperledger/fabric-peer "peer node start" 28 minutes ago Up 28 minutes 0.0.0.0:7051-7053->7051-7053/tcp peer1.org1.example.com


网站名称:超级账本Fabric1.0环境搭建实践-持续更新中……
路径分享:http://cxhlcq.com/article/cpgpgj.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部