简体   繁体   中英

writing applcation using fabric client and fabric ca client SDK for Hyperledger

I am following the below link to learn how to build the Blockchain application using fabric client and fabric ca client.

http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html

When I follow the tutorial I am able to get the required output.

But my doubt is, in invoke.js we have the below line which is used to setup the fabric network.

My doubt is that the network would have setup already with peer, orderer and channels. So in code each and every time should we again setup the network to query or invoke the ledger?

We have already configured the network is there a way that we can get the channel and query/invoke ledger?

If below is the case then tomorrow if there is some change in the network like one more peer is added then should we include that peer in the code?

var channel = fabric_client.newChannel('mychannel');
var peer = fabric_client.newPeer('grpc://localhost:7051');
channel.addPeer(peer);
var order = fabric_client.newOrderer('grpc://localhost:7050')
channel.addOrderer(order);

should we again setup the network to query or invoke the ledger?

If you shutdwon your PC yes, instead, no.

We have already configured the network is there a way that we can get the channel and query/invoke ledger?

Yes, there are specific methods as invokeChaincode for it. You have the documentatio about the SDKs here .

If below is the case then tomorrow if there is some change in the network like one more peer is added then should we include that peer in the code?

Yes, you should add it to the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM