Hyperledger Fabric comes up with a script namely byfn.sh which can be used to Build Your First Network (byfn). Hyperledger Fabric script, byfn.sh (found in folder fabric-samples/first-network), can be used to build your first Hyperledger Fabric permissioned blockchain network.
As I went about writing the post, it got much longer. Thus, I have split the post into two parts. In the first part, you will learn about some of the following:
In the second part, you will learn about how to plan around conducting transactions in blockchain network vis-a-vis byfn.sh script.
Download Hyperledger Fabric platform-specific components/binaries before getting started with your first network using byfn.sh script. The instructions can be found on this page. Hyperledger Fabric Samples. The platform binaries get installed bin sub-directory of the current working directory. My current working directory is “/home/support/hyperledger”.
First and foremost, the “hyperledger/bin” path needs to be set into PATH. Otherwise, you would hit with error such as cryptogen tool not found. exiting.
You may open up file such as ~/.bashrc and put the “hyperledger/bin” folder in the path. My hyperledger files such as cryptogen etc are found within the folder “/home/support/hyperledger/bin”
export PATH=$PATH:/home/support/hyperledger/bin
You could find related details on this page, Cryptogen Tool Not Found…Exiting.
./byfn.sh -m up sudo ./byfn.sh -m up
Let’s do a deep dive into what happens as a result of executing byfn.sh script. The information given below can be used as a guidelines/best practice for designing and developing your desired permission blockchain network. It is crucial to understand this as it would help in giving you a strong sense on how blockchain network can be created/operated using Hyperledger Fabric. The following diagram represents workflow related to creation of blockchain network using Hyperledger Fabric:
As byfn.sh starts executing, a channel with default name as “mychannel” is created. Although trivial, this would be required for the network you build, the initial name of the channel. Any blockchain network created with Hyperledger Fabric is, basically, a channel. There can be additional channels (sub blockchain network), which two or more participants can join in conducting transactions in private. At any point, a blockchain network participant can be memeber of multiple channels. Each channel maintains its own ledger. And, ledgers of different channels are not shared although a member can maintain multiple ledgers belonging to different channels it joined.
The first step in building your blockchain network is determining/identifying the member organizations and the related nodes (peer/orderer nodes hosted by each org) which would comprise the network. The same can be observed as byfn.sh starts executing. During the start of execution, you could find the details such as following being displayed in console.log. The details can also be found in the file, “fabric-samples/first-network/configtx.yaml” which is used to create a channel and related artifacts (genesis block, channel creation transaction, anchor peers etc).
Once the blockchain network design including ordered and member organizations get frozen, the next step is to start preparing for creating the permissioned blockchain network. This is achieved by assigning identity certificates to the member orgs and their nodes which will be used to identify themselves and conduct transactions in the network. A library of X509 certificates (commonly termed as cryptographic material) gets created for organizations and associated orderer/peer nodes using the cryptogen tool. A unique root certificate (ca-certs) is created for organization which binds peers and orderers to that organization. Note that this is where cryptogen tool not found..exiting error occurs if cryptogen tool is not found in the path. The cryptogen tool is passed the file namely crypto-config.yaml which consists of network topology information for orderer and peer organization (name, domain, hostname) along with peer nodes information (count of peer nodes etc). Take a look at the “fabric-samples/first-network/crypto-config.yaml” file.
After the fact that certificates are created for member organizations and their nodes (orderer/peers), the next step is to create the blockchain artifacts. The utility configtxgen is used to create the blockchain (channel) artifacts. In case, the hyperledger/bin is not set in the path, one would run across the error, the configtxgn tool not found. exiting. As part of blockchain creation, the following artifacts get created in folder, channel-artifacts:
Finally, its time to create the blockchain network. The blockchain network is created in following order. You would in the console log such as Channel “mychannel” created successfully, or PeerX joined on the channel, “mychannel”
In this post, you learned about some of the following:
In the next post, we will learn about another aspect related with byfn.sh script such as conducting transactions on blockchain network.
Did you find this article useful? Do you have any questions about this article or creating your first permissioned blockchain network using byfn.sh? Leave a comment and ask your questions and I shall do my best to address your queries.
In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…
Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…
With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…
Anxiety is a common mental health condition that affects millions of people around the world.…
In machine learning, confounder features or variables can significantly affect the accuracy and validity of…
Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…