fabric-client vs fabric-network vs fabric-gateway - hyperledger-fabric

I'm trying develop my first Hyperledger fabric application. I'm really confused ,should one use fabric-client or fabric-network or fabric-gateway for developing client SDK in node?

If you are (or can be) using Fabric v2.4 or later, I would strongly recommend using fabric-gateway. If using an older version of Fabric (or if you require some capabilities not available in fabric-gateway) then fabric-network. I would suggest avoiding fabric-client, which is end-of-life after Fabric v1.4.
There is some information on the positioning of the different client API implementation in the Hyperledger Fabric documentation:
https://hyperledger-fabric.readthedocs.io/en/release-2.4/sdk_chaincode.html

Related

How can I integrate caliper benchmark tool with my hyperledger fabric network?

I have developed a system using Hyperledger Fabric peer version 2.2.2 hence I need to test the performance (i.e. latency, throughput etc.) of this system using Hyperledger Caliper. I'm new with Blockchain and found it hard to integrate my network with Caliper! Which version of caliper will be suitable for fabric 2.2.2? How can I carry out this whole integration procedure?
This linked tutorial series on youtube will guide you.
You should use caliper 0.4.2 as this supports 2.2.2. I would suggest you follow the tutorial first here https://hyperledger.github.io/caliper/v0.4.2/fabric-tutorial/tutorials-fabric-existing/
As you have created your own fabric network you should be able to construct your own appropriate connection profiles which caliper requires.
If you plan to run caliper on a different machine to the one that contains your network then be aware of the need to disable the localhost default of true as described in the runtime settings on this page https://hyperledger.github.io/caliper/v0.4.2/fabric-config/new/#introducing-the-new-fabric-connector.

How to install Hyperledger composer-playground?

I have been trying to install it using the below link:
https://composer-playground.mybluemix.net/
Can anyone help me out with this?
I have to submit a project using Hyperledger Fabric and Composer.
Just in case people find this question, it should be noted that Hyperledger Composer is no longer actively maintained or supported. Most of the base programming model functionality was added to the various SDKs via a higher level API abstraction.

Are all administration functions for the channel joining, chaincode installing/upgrading removed from fabric-network / fabric-common?

I'm preparing that my client server using the old v1.4 fabric-client SDK to the new v2.1 fabric-network and fabric-common SDK. In my old server, I built many administration functions such as;
creating channels
joining peers to channels
updating channel configs such as batchSize
instantiating/upgrading chaincodes
However, I cannot find any APIs from fabric-network or fabric-common to do these administration things. For example, there is no installChaincode function from Client class in fabric-common.
How can I implement these administration operations using the v2.1 fabric-network and fabric-common SDK? Or, should I think another way such as using peer CLI (which I never want to do) rather than implementing the administration server to control the Hyperledger Fabric network?
If SDKs of other languages such as Golang or Java have such APIs, then let me know please. I'm okay to develop the administration server using other languages than JavaScript, if possible.
I've checked about it and I got an answer that all admin APIs had been removed from all SDK including node, Java, etc. This is a confirmed decision, so, at this point, finding other options such as using CLI is a way to do some admin stuff.

Can I query Hyperledger Fabric directly from a WebApp?

I'm really new to Hyperledger and blockchain. From what I understand, the whole meaning of the blockchain is to build decentralized applications, not depending on a single server.
So my question is: Is there a way to query and work with a Fabric node directly from a web browser? I believe Ethereum solves this problem with web3.js.
Thank you very much for your help.
Short Answer: No.
Web3.js communicates with Ethereum over JSON RPC and is supported by browsers.
Hyperledger Fabric, on the other hand, uses Protobuf over grpc. Currently, there is no such implementation like web3.js that can communicate directly using a browser with Hyperledger Fabric.
However Hyperledger Burrow, that provides a permissioned version of Ethereum and supports Solidity Smart Contracts does not yet support web3.js, but it is something they have in their roadmap and shall support soon.
Check this for more updates: https://wiki.hyperledger.org/projects/burrow/roadmap_2018_q1
To mimic a network for testing you can use composer-playground.mybluemix.net and to test your assets/transactions once deployed on Fabric, you can use Composer's REST API to make calls to localhost.

Chaincode using GO or Composer

I understand that chaincode(smart contracts) on hyperledger-fabric can be written using golang. But the other thing I see as of fabric 1.0 is the composer - where I could write the 'transactions' part using JS.
Is the difference that go APIs give me more lower level controls like access to MSP and CA and others? Or is it that the newer version would want you to write all your code using JS?
I am looking for some clarification on specific uses of each approach.
This tutorial -> https://blog.selman.org/2017/07/08/getting-started-with-blockchain-development/ should help you with the side-by-side comparison and the approaches using either toolset.
Updated answer (as promised in previous post): Hyperledger Composer v0.19.0 (time of writing - Apr 1st 2018) is the default release for building your blockchain business networks using Composer. So when you pull HL/Composer eg via npm install etc) - this uses the current GA edition of Hyperledger Fabric v1.1, the underlying blockchain network infrastructure. This 0.19.0 release includes a fundamental change in the way that Composer business networks are deployed (vis-a-vis previous releases eg 0.16.x - 0.18.x). Business networks are now deployed within Hyperledger Fabric 'as chaincode' - meaning that the business network (rather than Composer runtime) can be agreed by all parties (to the blockchain network) and signed, using a similar management model to non-Composer chaincode. In a later edition, the plan is to add JS requires so that these can be exploited in NodeJS and include other JS functions you've developed - of course, you can already call native Fabric APIs/chaincode functions already, from Composer transaction processors - introduced prior to 0.19.x release). See more info here in the release notes -> https://github.com/hyperledger/composer/releases/tag/v0.19.0

Resources