搭建Fabric網絡(三)artifacts是怎么生成的:cryptogen和configtxgen


在first-network里,./byfn.sh generate可以生成artifacts文件。

generate參數其實是使用了cryptogen和configtxgen這兩個工具,這兩個工具分別生成不同的artifacts文件。

這里主要介紹詳細介紹這兩個工具的配置。

 

1, cryptogen

../bin/cryptogen generate --config=./crypto-config.yaml 

 執行成功之后會顯示

org1.example.com org2.example.com

cryptogen工具生成了crypto-config文件夾,這個文件包含了各個節點的證書。

 

 

 

這些文件在以后我們都會用到。

 

創建Channel的config transaction

export CHANNEL_NAME=mychannel  && ../bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME

 然后得到如下輸出

2018-05-11 14:46:57.861 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2018-05-11 14:46:57.869 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2018-05-11 14:46:57.974 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2018-05-11 14:46:57.996 CST [msp] getMspConfig -> INFO 004 Loading NodeOUs
2018-05-11 14:46:58.042 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 005 Writing new channel tx

 

指定Anchor節點

../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP

../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP

然后得到如下輸出

2018-05-11 14:49:52.061 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2018-05-11 14:49:52.079 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-05-11 14:49:52.079 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM