In part 1 of this tutorial set, I was introducing the files in BYFN. In part 2, I am going to introduce the remaining files.
Recap the File List
Let’s recap our list of files:
- docker-compose-cli.yaml (Part 1)
- base/docker-compose-base.yaml (Part 2)
- base/peer-base.yaml (Part 2)
- channel-artifacts/ (Part 2)
- crypto-config.yaml (Part 2)
- configtx.yaml (Part 2)
- byfn.sh (Part 2)
- scripts/script.sh (Part 2)
- scripts/utils.sh (Part 2)
We will finish all the remaining files in this part.
In part 1, we have introduced
docker-compose-cli.yaml, which is to define our (virtual) Fabric network. We review a part of
The syntax of this file is more or less the same as
base/peer-base.yaml. Again, why do we need these base files? Because of reusability, though it is not mandatory.
Notice that this is an empty directory currently. This directory will be used to store some configuration transactions and a genesis block. More details later.
This is a file to define certifications and keys to be generated and used in the network.
In Hyperledger Fabric, we have a set of certifications and keys for users and nodes. For example, Peer needs to have a set of certificates and keys to perform endorsement, prove itself as a member in the Blockchain network, do signing, etc.
Line 4 OrdererOrgs is defining certificates and keys generation for organization related to Orderer nodes.
Line 22 Template > Count specifies how many nodes in Org1 (organization 1), while 29 Users > Count specifies how many users in Org1.
This is a file to define the configurations of the Blockchain network, though later they could be updated.
This is a long file, so I don’t embed into the blog post. You could refer to it here.
Let’s look at some parts of this file:
So, overall, there are three organizations, OrdererOrg, Org1, and Org2. You may refer to here for more details of configtx.yaml.
This is a convenient script file by Hyperledger Fabric to start the network.
We use it this way to bring up the network (we will run together later):
Basically, it does the followings:
- Generate certificates and keys based on
- Generate channel artifacts based on
configtx.yaml, outputs will be stored in channel-artifacts/
- Bring up the (virtual) Fabric network based on
- Create Hyperledger Fabric channel, mychannel
- Join Peer nodes into the channel
- Install the Smart Contract (Chaincode) in Peer nodes
- Instantiate the Smart Contract (Chaincode) in one of the Peer nodes
2.8 scripts/script.sh & scripts/utils.sh
scripts/script.shis a script used by
byfn.shfor steps 4 to 7 above.
scripts/utils.shis a script used by
scripts/script.sh. It contains some common utility functions, such as installing Smart Contract (Chaincode)
Starting from the next part, we will continue some practical steps.