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 Generation configuration in Fabric2.0

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly shows you the "sample analysis of first-network generation configuration in Fabric2.0", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and study the "sample analysis of first-network generation configuration in Fabric2.0".

1.byfn.sh generate

First, you can observe from byfn.sh 's script that the first parameter of the script is the execution mode, where the mode includes up, down, generate, restart, and upgrade, representing startup, cleanup, generation, and upgrade of the network. Here we focus on generate, where two main function are executed in generate, namely, generateCerts: generate certificate, generateChannelArtifacts: generate creation block and channel file.

2. GenerateCerts

GenerateCerts: generate a certificate to see the script in detail

Two core scripts are mainly executed: 1.cryptogen generate-- config=./crypto-config.yaml

The implementation generates certificate files according to crypto-config.yaml.

2../ccp-generate.sh

Generate the relevant blockchain configuration file that invokes nodejs SDK. 2.1 generate certificate file

Open the crypto-config.yaml file under the first-network directory. Crypto-config.yaml mainly includes fabric sorting node certificate configuration and fabric organization certificate configuration.

Sorting node certificate configuration configures five sorting nodes with the domain name: Hostname + Domain eg:orderer.example.com

-Name: Orderer Domain: example.com Specs:-Hostname: orderer-Hostname: orderer2-Hostname: orderer3-Hostname: orderer4-Hostname: orderer5

Other configuration modes are supported as follows:

(1) rewrite fully qualified domain names

The default value of CommonName # is {{.Hostname}}. {{.Domain}}

OrdererOrgs:-Name: Orderer Domain: example.com Specs:-Hostname: orderer CommonName: myorderer.example.com

(2) replace Specs with Template configuration

# Template defines nodes using templates # Total number of Count nodes # Start Node subscript starting value # Hostname fully qualified Domain name format # Prefix default peer # Index take Start value No configuration self-increment from 1

OrdererOrgs:-Name: Orderer Domain: example.com Template: Count: 5 Start: 1 Prefix:order # Hostname: {{.prefix}} {{.Index}} # default

Organization certificate configuration configures two organizations, each with 2 sets of public and private keys and certificates, including a normal User (Admin is not included in the count) with a quantity of 1

PeerOrgs:-Name: Org1 Domain: org1.example.com EnableNodeOUs: true Template: Count: 2 Users: Count: 1-Name: Org2 Domain: org2.example.com EnableNodeOUs: true Template: Count: 2 Users: Count: 1

# Domain domain name # Template reference OrdererOrgs can be replaced with Specs configuration # Users-> number of user accounts added to the administrator # EnableNodeOUs allows nodes OUS-> out of service to distinguish between clients, admins and peers. If true generates the config.yaml in the msp directory as follows:

The certificate structure is not specified here. For more information, please see the Fabric2.0 official document.

2.2. / ccp-generate.sh

Generate the relevant blockchain configuration file that invokes nodejs SDK. No detailed configuration instructions are given here.

3. GenerateChannelArtifactsgenerateChannelArtifacts: generate creation blocks and channel files 3.1 generate creation blocks

Script:

Configtxgen-profile SampleMultiNodeEtcdRaft-channelID byfn-sys-channel-outputBlock. / channel-artifacts/genesis.block

Since my contact with Fabric has been in the 1.x era since 2018, and 2.x has no contact at all, when I see the shell above, it obviously has a taste of 2.0. according to the usual routine, take a look at the official documents of 2.0 to explain:

The use of configtxgen command parameters has changed in 2.0. For ease of comparison, I put the 1.4 official document:

The difference is that the definition of network consensus mode of creation block has changed, and TwoOrgsOrdererGenesis (original sorting node creation block configuration) and SampleDevModeKafka (kafka consensus configuration) have been deleted.

The rest is explained:

SampleMultiNodeEtcdRaft: used to generate the creation block, used together with-o, to support the consensus of etcdraft mode.

TwoOrgsChannel: used to generate the channel.

There is not much difference between the remaining scripts for generating channels and the original ones. Please refer to the official documentation for details.

3.2 Channel file generation

Channel configuration:

TwoOrgsChannel: # Channel federation name, now defaults to SampleConsortium Consortium: SampleConsortium # refers to the detailed configuration of ChannelDefaults tunnel

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