Hyperledger Fabric: How to Setup Application from Scratch using Nodejs Series— Part 2
In my previous article we started with introduction & how to setup Hyperledger Fabric server. We also discussed quick story on real time use case & how blockchain supports the industry. This article covers little deep on the following binary files & also those 4 components I mentioned(ORDERER,CA(CERTIFICATE AUTHORITY),PEERS & COUCHDB) before.
Let’s get started..
So when you setup “Build your first network(byfn)” from fabric-samples, you would see these binary files in bin folder
What each binary does is special in fabric server. When you develop your own network, you must declare or define who is going to do what?. for example, let’s take a real time example. A typical supermarket story here, sales boy / girl do help the customer in finding the products, house keeping person will ensure the environment is clean, person at billing section does only the billing job. So similarly, while deploying network you must define who is going to do what?. ( Read this transaction flow in Hyperledger official document to get better understanding : Click here of what’s happening when a transaction is invoked) ..So in a network, we have 4 components(Orderer, Peer, CouchDB, CA) and who is going to perform these roles, will be decided and respective identity/access will be generated.
For instance, when new joinee is joining the organization(company), we provide him/her access card/identity card right?, similarly in fabric network we must define identity, which will be provided by MSP(membership service provider). To do that job, we use the binary file cryptogen.
Now, let’s talk about configtxgen .. again a real time example of super market, the moment the day starts they create one dummy billing ID in order to ensure billing application runs fine & also for goodwill. This dummy billing ID doesn’t add any value in fact, but they starts the day with dummy billing ID to start the billing number for the day. Similarly in blockchain, we have something called “Genesis” block(The configuration block that initializes a blockchain network or channel, and also serves as the first block on a chain).. I will not say this as Dummy, but very crucial block in a chain, which actually indicates “Starting” point of block chain. Configtxgen actually does this job, it creates genesis block for the network.
Now it’s time for
configtxlator (Read this Click here) , I can relate this with “Optimizer or Upgrader”. For instance, you have the network setup with channels, when you want to modify the channels or update genesis block, then you need to edit the same, configtxlator file helps you to first convert the block into human readable form & once you make necessary changes, it commits & upgrade the same.
configtxlator: standard usage is expected to be:
- SDK retrieves latest config
configtxlatorproduces human readable version of config
- User or application edits the config
configtxlatorused to compute config update representation of changes to the config
- SDK submits signs and submits config
Peer (straight forward) , it helps to perform set of actions. For instance, using Peer Channel subcommand, you can add the peer to specific channel, Peer Chaincode helps you to deploy chaincode to the peer & so on.
The fabric-ca-client command allows you to manage identities (including attribute management) and certificates (including renewal and revocation).
Orderer using this binary, we can start the orderer. It will use the generated “Genesis block”. If it’s not available, it generates new genesis block using SOLO orderer profile.
Having all these six binaries covered, it is very important to understand in which situation we use each. Let’s begin with fresh network, absolutely fresh network & we are going to setup using above binaries..and define those 4 components.
Let’s meet in my next article.. If you have any questions/comments, please post to discuss.
if you like reading this series, please don’t forget to CLAP & share with others. Any concerns/comments or any different thoughts on how above binaries work, please feel free to share in comments section..
See you in next article, shortly..