Take fabric-samples/balance-transfer Example:
1. Specific process
The FABRIC/EXAMPLES/E2E_CLI directory contains files network_setup.sh for one-click Deployment environments and test Chaincode sample code. This includes two sections, one that uses generateartifacts.sh script files to configure organizational relationships and issuing certificates, and the other is docker-compose-cli.yaml to start the cluster based on configuration and test the Chaincode sample code. 2. generateartifacts.sh script file
Contains three functions: Generatecerts: Use the Cryptogen tool to generate certificates based on Crypto-config.yaml. Replaceprivatekey: Replaces the CA private key in the Docker-compose-e2e-template.yaml document with the specific private key. (not used in this case) Generatechannelartifacts: Use the Configtxgen tool to generate Orderer Genesis block, channel configuration based on Configtx.yaml files Transaction, Anchor peer update.
The specific contents of Crypto-config.yaml are as follows:
#---------------------------------------------------------------------------# "Ordererorgs"-Definition of
Organizations managing Orderer Nodes #--------------------------------------------------------------------------- Ordererorgs: #---------------------------------------------------------------------------# orderer------------- ---------------------------------------------------------------name:orderer Domain:example.com #----------- ----------------------------------------------------------------# "Specs"-Peerorgs below for complete descripti
On #---------------------------------------------------------------------------Specs:-Hostname:orderer #---------------------------------------------------------------------------# "Peerorgs"-Definition of
Organizations managing peer Nodes #--------------------------------------------------------------------------- Peerorgs: #---------------------------------------------------------------------------# Org1 #----------------------------------------------------------------------------Name:o Rg1 Domain:org1.example.com #---------------------------------------------------------------------------# " Specs "#---------------------------------------------------------------------------# Uncomment this section to E Nable the explicit definition of hosts in your # configuration. Most users would want to use Template, below # Specs be an array of Spec entries.
Each Spec entry consists of two fields: #-Hostname: (Required) The desired Hostname, sans the domain. #-CommonName: (Optional) specifies the template or explicit override for # the CN. By default, this is the template: # # ' {{. Hostname}}. {{. Domain}} "# # which obtains its values from the Spec.hostname and # Org.domain
, respectively. # ---------------------------------------------------------------------------# Specs: #-Hostname:foo # implicitly ' foo.org 1.example.com "# CommonName:foo27.org5.example.com # overrides hostname-based FQDN set above #-Hostname: Bar #-Hostname:baz #---------------------------------------------------------------------------# "Templ Ate "#---------------------------------------------------------------------------# allows for the definition of 1 or more hosts that are created sequentially # template.
By default, this is looks like "peer%d" from 0 to Count-1. # You may override the number of nodes (Count), the starting index (Start) # or the template used to construct the NAM
E (Hostname). # # Note:template and Specs are not mutually exclusive. You may define both # sections and the aggregate nodes'll be created for you. Take Care with # name collisions #---------------------------------------------------------------------------Template:count:2 # start:5 # Hostname: {{. prefix}}{{. Index} # Default #---------------------------------------------------------------------------# "Users" #- -------------------------------------------------------------------------# count:the Number of user accounts _in add Ition_ to Admin #---------------------------------------------------------------------------Users:count: 1 #---------------------------------------------------------------------------# org2:see "Org1" for full specificat Ion #----------------------------------------------------------------------------name:org2 Domain:org2.exampl E.com Template:count:2 users:count:1
The specific contents of the
Configtx.yaml are as follows:
################################################################################ # profile # #-Different Configura tion profiles may be encoded this is specified # as parameters to the Configtxgen tool # ############################ #################################################### Profiles:TwoOrgsOrdererGenesis:Orderer: &L T;<: *ordererdefaults organizations:-*ordererorg Consortiums:samplec
Onsortium:organizations:-*org1-*org2 Twoorgschannel: Consortium:sampleconsortium application: <<: *applicationdefaults Organizations :-*org1-*org2 ####################################################################### ######### # # Section:organizations # #-This section defines the different organizational identities the'll # Be referenced later inThe configuration. # ################################################################################ Organizations: # SAMPLEORG Defines an MSP using the sampleconfig.
It should never is used # in production but May is used as a template for other definitions-&ordererorg # defaultorg defines the organization which are used in the Sampleconfig # of the Fabric.git development Nment name:ordererorg # ID to load the MSP definition as Id:orderermsp # Mspdir is the
FileSystem path which contains the MSP configuration Mspdir:crypto-config/ordererorganizations/example.com/msp -&org1 # defaultorg defines the organization which is used in the Sampleconfig # of the Fabric.gi T development Environment Name:org1msp # ID to load the MSP definition as Id:org1msp M
Spdir:crypto-config/peerorganizations/org1.example.com/msp anchorpeers:# Anchorpeers defines the location of peers which can be used # for cross org gossip communication. Note, this value are only # encoded in the Genesis blocks in the application section Context-host: Peer0.org1.example.com port:7051-&org2 # defaultorg defines the organization which is U Sed in the Sampleconfig # of the Fabric.git development environment Name:org2msp # ID to load th e MSP definition as Id:org2msp mspdir:crypto-config/peerorganizations/org2.example.com/msp Anc Horpeers: # Anchorpeers defines the location of peers which can be used # for cross org gossip com Munication. Note, this value are only # encoded in the Genesis blocks in the application section Context-host: Peer0.org2.example.com port:7051 ######################################################################## ######## # # SectiOn:orderer #-This section defines the ' values to encode into a config transaction or # Genesis blocks for Orderer R Elated parameters # ################################################################################ Orderer: &
Ordererdefaults # Orderer Type:the orderer implementation to start # Available types are ' solo ' and ' Kafka ' Orderertype:solo Addresses:-orderer.example.com:7050 # Batch timeout:the amount of time to wait befo Re creating a Batch Batchtimeout:2s # batch Size:controls the number of messages batched into a block batch
Size: # Max message count:the Maximum number of messages to permit in a batch Maxmessagecount:10
# absolute Max bytes:the Absolute Maximum number of Bytes allowed for # The serialized in a messages.
absolutemaxbytes:98 MB # Preferred Max bytes:the preferred maximum number of Bytes allowed for