區塊鏈: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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章