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

How to parse peer channel create commands

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to parse the peer channel create command, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

Analysis of peer channel create command

Let's take fabric/example/e2e_cli for example

In the script/script.sh file under the e2e_cli directory, in the createChannel function,

Create a channel statement as:

peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./ channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt

The command execution process:

Send message creating channel named $CHANNEL_NAME

Get the genesis block and serialize it with protobuf, locally generating a file $CHANNEL_NAME.block

Variable Name Meaning $CHANNEL_NAME Default, mychannel$CORE_PEER_TLS_ENABLED/e2e_cli/base/peer-base.yaml Environment variable defined, true

- CORE_PEER_TLS_ENABLED=true Certificate for $ORDERER_CAorder

ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

- ./ crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/

Directory under e2e_cli/crypto-config Parameters

View the fabric document Commands Reference section

Parameter name meaning-o address of connected order, hostname:port-cchannel name, default mychannel-f configured transaction information (not clear yet)--tls whether tls is enabled when communicating with order--cafile When tls is used, the certificate of order used How is orderer.example.com domain name resolved?

Docker-compose itself supports access via servicename.

Reference: Networking in Compose

channel.tx

Generate channel.tx by tool configtxgen

In the e2e_cli example, the file e2e_chl/generateArtifacts.sh

$CONFIGTXGEN -profile TwoOrgsChannel -outputCreateChannelTx ./ channel-artifacts/channel.tx -channelID $CHANNEL_NAME

configtxgen is generated according to configuration item **TwoOrgsChannel** in config file configtx.yaml

View channel.tx and genesis.block content

For channel.tx, you can view the json format data with the tool configtxgen

configtxgen -inspectChannelCreateTx channel.tx

For genesis.block, you can view json format data with the tool configtxgen

configtxgen -inspectBlock genesis.block Is it helpful to read the above? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

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