Hyperledger Fabric Network Setup | Understand configtx.yaml file – Part 2

Hyperledger Fabric Network Setup | Understand configtx.yaml file – Part 2

This blog is part of series that we are writing to explain the different files involved in setting up Hyperledger Fabric network.

  1. Understand crypto-config.yaml file : Used to create cryptography material.
  2. Configtx.yaml file: Used to create genesis block and channel.
    1. Understand the structure of configtx.yaml file.
    2. Run configtxgen command to create genesis and channel artifacts.
  3. Understand docker-compose.yaml file: Used to create docker container.

 

This is part 2 of configtx.yaml file explanation, where we will show you what all commands you need to run to generate genesis block and channel artifacts using configtx.yaml file.

 

What is genesis block ?

Genesis block is very first block in the blockchain, all other blocks comes after it. Genesis block does not have any reference to previous block as this is very first block.

Whenever you setup any network, first you need to create genesis block from your end and then other blocks gets appended to it.

 

What is Channel ?

Channel is one of concept that you see in Hyperledger Fabric that make it unique. Channel is the private communication between the parties included in that channel.

E.g. If you have 4 organizations in one blockchain network, one channel is created between all 4 organization so the information is visible to all 4 organizations. You can also create other channel where only 2 or 3 of the organizations deal with each other.

 

Which command need to be used for configtx.yaml file ?

configtxgen is the command that we will use for configtx.yaml file to generate channel and genesis block. You can read details documentation about that command using this link.

 

Which command need to run to create genesis block ?

./configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ../first-network/channel-artifacts/genesis.block

 

This generate genesis block under channel-artifacts folder.

 

Which command need to run to create channel ?

./configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ../first-network/channel-artifacts/channel.tx -channelID samplechannel

 

This command generate the channel involving the organizations defined in TwoOrgsChannel profile. Here the channel name will be "samplechannel".

 

How to generate Anchor peer configuration for organization ?

./configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ../first-network/channel -artifacts/Org1MSPanchors.tx -channelID samplechannel -asOrg Org1MSP

 

Above command is just for one organization, you can repeat the same step for other organizations.

 

Inquire Now
close slider