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

发布时间:2021-12-26 17:31:56 作者:小新
来源:亿速云 阅读:219

这篇文章主要介绍了区块链中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管道创建测试的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

推荐阅读:
  1. linux中匿名管道的示例分析
  2. Shell中管道重定向的示例分析

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

区块链 fabric

上一篇:区块链中fabric发版历程与构建编译的示例分析

下一篇:SpringCloud Alibaba中Oauth2认证服务器自定义异常怎么办

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》