区块链中fabric管道创建测试的示例分析

这篇文章主要介绍了区块链中fabric管道创建测试的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

创建heidsoft fabric 区块链网络

生成创世块

configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/heidsoft/genesis.block

生成Channel配置区块

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/heidsoft/channel.tx -channelID heidsoft

configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/heidsoft/Org1MSPanchors.tx -channelID heidsoft -asOrg Org1MSP

configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/heidsoft/Org2MSPanchors.tx -channelID heidsoft -asOrg Org2MSP

创建管道

export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

peer channel create -o orderer.example.com:7050 -c heidsoft -f ./channel-artifacts/heidsoft/channel.tx --tls true --cafile $ORDERER_CA

将区块加入到管道peer0.org1

root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join -b heidsoft.block
2018-11-21 05:33:27.606 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-11-21 05:33:27.669 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel list
2018-11-21 05:33:39.095 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Channels peers has joined:
mychannel
heidsoft
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join --help


root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# env|grep -i CORE_PEER_LOCALMSPID
CORE_PEER_LOCALMSPID=Org1MSP
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# env|grep -i CORE_PEER_TLS_ROOTCERT_FILE
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
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# env|grep -i CORE_PEER_MSPCONFIGPATH
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# env|grep -i CORE_PEER_ADDRESS
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer#

加入peer1.org1

export CORE_PEER_LOCALMSPID="Org1MSP" 
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt 
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 
export CORE_PEER_ADDRESS=peer1.org1.example.com:7051

root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join -b heidsoft.block
2018-11-21 05:42:05.118 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-11-21 05:42:05.205 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer#

加入peer0.org2

export CORE_PEER_LOCALMSPID="Org2MSP" 
export 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 
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 
export CORE_PEER_ADDRESS=peer0.org2.example.com:7051

root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join -b heidsoft.block
2018-11-21 05:44:53.250 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-11-21 05:44:53.327 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer#

加入peer1.org2

export CORE_PEER_LOCALMSPID="Org2MSP" 
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt 
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 
export CORE_PEER_ADDRESS=peer1.org2.example.com:7051

root@2284e29f5b2a:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join -b heidsoft.block
2018-11-21 05:47:30.079 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-11-21 05:47:30.165 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

感谢你能够认真阅读完这篇文章,希望小编分享的“区块链中fabric管道创建测试的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持蜗牛博客,关注蜗牛博客行业资讯频道,更多相关知识等着你来学习!

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:niceseo99@gmail.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论Telegram