Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of First Network in Hyperledger Fabric

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the example analysis of First Network in Hyperledger Fabric. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

First Network detailed analysis

Generate files such as fabric certificate and configuration

. / byfn.sh generate

Log analysis and manual construction of details

1. To obtain the certificate that will be generated for the network configuration defined in the crypto-config.yaml file, corresponding to the manual configuration:

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

Corresponding output log:

Org1.example.comorg2.example.com

The certificate and key (that is, the MSP material) are exported to the crypto-config folder in the first-network directory.

2. Where does the configtxgen tool find the configuration file configtx.yaml and call the configtxgen tool to create the orderer creation block, and configure it manually:

Export FABRIC_CFG_PATH=$PWD & &.. / bin/configtxgen-profile TwoOrgsOrdererGenesis-outputBlock. / channel-artifacts/genesis.block

The corresponding output is similar to the log:

2018-08-23 10 main 3613.825 CST [common/tools/configtxgen] main-> WARN 001 Omitting the channel ID for configtxgen is deprecated. Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.2018-08-23 10 CST 13.825 CST [common/tools/configtxgen] main-> INFO 002 Loading configuration2018-08-23 10 testchainid'.2018 36 WARN 13.831 CST [common/tools/configtxgen/encoder] NewChannelGroup-> WARN 003 Default policy emission is deprecated, please include policy specificiations for the channel group in configtx.yaml2018-08-23 10 Swiss 3613.832 CST [common/tools/configtxgen/encoder] NewOrdererGroup-> WARN 004 Default policy emission is deprecated Please include policy specificiations for the orderer group in configtx.yaml2018-08-23 10 Loading NodeOUs2018 3613 13. 832 CST [common/tools/configtxgen/encoder] NewOrdererOrgGroup-> WARN 005 Default policy emission is deprecated, please include policy specificiations for the orderer org group OrdererOrg in configtx.yaml2018-08-23 10 common/tools/configtxgen/encoder 36 13. 832 CST [msp] getMspConfig-> INFO 006 Loading NodeOUs2018-08-23 10 Ride 36 13. 832 CST [common/tools/configtxgen/encoder] NewOrdererOrgGroup-> WARN 007 Default policy emission is deprecated Please include policy specificiations for the orderer org group Org1MSP in configtx.yaml2018-08-23 10 msp 36 CST 13.832 CST [msp] getMspConfig-> INFO 008 Loading NodeOUs2018-08-23 10 msp 36 13 832 CST [common/tools/configtxgen/encoder] NewOrdererOrgGroup-> WARN 009 Default policy emission is deprecated Please include policy specificiations for the orderer org group Org2MSP in configtx.yaml2018-08-23 10 common/tools/configtxgen 36 please include policy specificiations for the orderer org group Org2MSP in configtx.yaml2018 13.832 CST [common/tools/configtxgen] doOutputBlock-> INFO 00a Generating genesis block2018-08-23 10 common/tools/configtxgen 36 13 833 CST [common/tools/configtxgen] doOutputBlock-> INFO 00b Writing genesis block

The Genesis Block genesis.block will be exported to the channel-artifacts folder in the first-network directory.

3. Create a channel profile and configure it manually:

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

The corresponding output is similar to the log:

2018-08-23 10 main 55 main [common/tools/configtxgen] main-> INFO 001 Loading configuration2018-08-23 10 main 5533.399 CST [common/tools/configtxgen] doOutputChannelCreateTx-> INFO 002 Generating new channel configtx2018-08-23 10 CST 5533.399 CST [common/tools/configtxgen/encoder] NewApplicationGroup-> WARN 003 Default policy emission is deprecated Please include policy specificiations for the application group in configtx.yaml2018-08-23 10 msp 55 msp 33.399 CST [msp] getMspConfig-> INFO 004 Loading NodeOUs2018-08-23 10 msp 55 msp 33.399 CST [common/tools/configtxgen/encoder] NewApplicationOrgGroup-> WARN 005 Default policy emission is deprecated Please include policy specificiations for the application org group Org1MSP in configtx.yaml2018-08-23 10 msp 55 msp 33.400 CST [common/tools/configtxgen] getMspConfig-> INFO 006 Loading NodeOUs2018-08-23 10 msp 5533.400 CST [common/tools/configtxgen/encoder] NewApplicationOrgGroup-> WARN 007 Default policy emission is deprecated, please include policy specificiations for the application org group Org2MSP in configtx.yaml2018-08-23 10 msp 55 please include policy specificiations for the application org group Org2MSP in configtx.yaml2018 33.401 CST [common/tools/configtxgen] doOutputChannelCreateTx-> INFO 008 Writing new channel tx

The channel configuration file channel.tx is output to the channel-artifacts folder in the first-network directory.

4. Organize the anchor node configuration file for Org1 on the constructed channel, and configure it manually:

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

The corresponding output is similar to the log:

2018-08-23 11 CST [common/tools/configtxgen] main-> INFO 001 Loading configuration2018-08-23 11 V 07V 49.823 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate-> INFO 002 Generating anchor peer update2018-08-23 11 V 07V 49.823 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate-> INFO 003 Writing anchor peer update

The Org1 definition anchor peer node profile Org1MSPanchors.tx on the channel is output to the channel-artifacts folder in the first-network directory.

5. Organize the anchor node configuration file for Org2 on the constructed channel, and configure it manually:

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

The corresponding output is similar to the log:

02.486 CST [common/tools/configtxgen] main-> INFO 001 Loading configuration2018-08-23 11 main-> INFO 0001 Loading configuration2018-08-23 11 Ride 02.493 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate-> INFO 002 Generating anchor peer update2018-08-23 11 main 10 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate-> INFO 003 Writing anchor peer upda

The Org2 definition anchor peer node profile Org2MSPanchors.tx on the channel is output to the channel-artifacts folder in the first-network directory.

Network startup

. / byfn.sh up

Log analysis can be divided into two parts and build details manually

The first log section

Creating network "net_byfn" with the default driverCreating volume "net_orderer.example.com" with default driverCreating volume "net_peer0.org1.example.com" with default driverCreating volume "net_peer1.org1.example.com" with default driverCreating volume "with default driverCreating volume" net_peer1.org2.example.com "with default driverCreating peer0.org2.example.com. DoneCreating orderer.example.com... DoneCreating peer1.org1.example.com... DoneCreating peer1.org2.example.com... DoneCreating peer0.org1.example.com... DoneCreating cli... Done

This part actually starts container orchestration with docker-compose. The specific commands are as follows:

Docker-compose- f docker-compose-cli.yaml up-d

The second log section

_ | | _ _ | / _ | _ _ | _ _ |\ _ | | / _ _ | | _ | _ | / _ | _

< | | |____/ |_| /_/ \_\ |_| \_\ |_| Build your first network (BYFN) end-to-end testChannel name : mychannelCreating channel...+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem+ res=0+ set +x2018-08-23 04:18:50.971 UTC [channelCmd] InitCmdFactory ->

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report