Can we define multiple orderers and ca in connection.json? - hyperledger-composer

Can we define multiple orderers and ca in connection.json, so that if one orderer is down then client application will automatically connect with the another available orderer? And same with the case of CA server.

The node sdk for hyperledger fabric v1.0 has always supported adding multiple orderers in it's various pre-releases of v1.0 so the hyperledger composer connection profile has always supported being able to add multiple orderers. However with the release of rc1 the comments to the methods have been updated to say that only the first orderer in the list is used (which implies that for 1.0 the node sdk won't support multiple orderers for the v1.0 release) and as an implication of that hyperledger composer only supports a single orderer in it's connection profile (although multiple ones could be defined).
The connection profile also only supports defining a single CA. Hyperledger Composer doesn't provide any sort of concept of HA for the CA.

Related

Custom REST API in spring boot for creating Peers, Orderer, Channels etc in Hyperledger Fabric

I have created a basic network in HLF
Single Orderer
2 Organization, has 2 peers each
Channel: finance
Now, If I wanted to add one more peer or create any other channel. I have to add the configuration in the crypto-config.yaml and configtxgen.yaml and execute peer and channel-related commands in the cli as per my understanding.
QUESTION
Is there any way that, I can create any REST API in spring boot to create the above process?
SDK's available for adding peer's organization
Check this golang : link
Also there are different SDK for java, node.js.
Yes, but if you want to add a new organization or a new peer, you must use the fabric-SDK for those operations; this channel configuration updates will be the responsibility of an organization admin.
The SDK also provides a client for Hyperledger's certificate authority.
FABRIC SDK:
fabric-sdk-node doc: https://hyperledger.github.io/fabric-sdk-node/
fabric-sdk-node: https://github.com/hyperledger/fabric-sdk-node/
fabric-sdk-java: https://github.com/hyperledger/fabric-sdk-java
fabric-sdk-go: https://github.com/hyperledger/fabric-sdk-go

How to connect a Go client application to the IBM VS Code Fabric Extension?

I am working on some projects with Hyperledger Fabric, currently using the IBM VS Code Extension. The chaincode is written in Go, as is the client application which provides a RESTful API, using the Go Fabric SDK. However, I am having trouble connecting the client application to the chaincode. Most of the tutorials and examples I have seen use Node.js as the client and it seems the Node SDK needs less configuration.
As far as I understand it, the steps should be similar to the following but more detailed information seems to be a little bit lacking when it comes to the Golang Fabric SDK.
The client application needs the following information to be able to communicate with the blockchain network:
The enroll ID and secret of the application identity (used to generate a cert and private key), or the certificate and private key directly
The connection profile
The smart contract name
The name of the channel the smart contract was instantiated on
Use the certificate and private key of the application identity, along with CA endpoint information inside your connection profile
In the VSCode plugin
Register an 'application' identity in the 'Fabric Wallets' section
Export the connection profile from the 'Fabric Gateway' section
Export the application identity's wallet
Update code to point to the exported connection profile
Update code to point to the exported wallet
As far as I can tell, the connection profile and other steps needed to connect the SDK to the VS Code Network should be pretty 'standard' so I wonder if someone knows of a working example?
Thanks for the collective help!
Unfortunately you are going to struggle with this at the moment. Wallets are not compatible with the Go SDK currently. Also the Go SDK doesn't quite conform (or at least it didn't the last time I tried it) to the connection profile specification so the connection profile from the VS Code extension won't work without some minor modification and didn't work with a CA not using TLS (IIRC I patched the Go SDK to make it work).
There is work underway to bring the Gateway/Wallet programming model to the Go SDK which will then make working with the VS Code extension a lot easier, but I don't know when a version of the Go SDK with a working implementation will be available.

Option to create channel from Composer

Is there any option to create a channel dynamically via Composer ??
This is similar to creating channels via SDK code. I am unable to find the documents in the composer tutorial site.
(Edited rsp:) I fully endorse what david_k above has written firstly. The methodgetNativeAPI() in Composer client, enables access to the Fabric client API from composer-client after connecting to an existing business network. That is, Composer client APIs (admin connection and business network connection specifically) offer access to the underlying Fabric client API: eg. calling client API method to read channel info : getChannel :
const bnc = new BusinessNetworkConnection();
await bnc.connect('admin #sample-network');
const fc = bnc.getNativeAPI();
const channel = fc.getChannel('defaultchannel');
const info = await channel.queryInfo();
console.log('block height', info.height);
Composer is not about creating and managing a hyperledger fabric network. It is a business network framework that utilises a pre-defined fabric network and requires an already created channel, so will not provide these kinds of hyperledger fabric admin capabilities. As you correctly state the fabric node sdk provides the ability to provide that kind of administrative capability and so that is the API you should use to perform those kind of activities, such as creating channels, joining peers to channels or configuration updates.
As Paul states, it is possible to gain access to the underlying fabric node sdk client instance which it is currently using to interact with the fabric network, but that does require an already existing business network and as such interacting with the node sdk via this route may not be applicable.

Could Hyperledger composer handle more than one CA (MSP)?

I have a fabric network with two organizations with its individual MSP hence 2 MSP. Each organization manages 1 peer, I want to create a channel and have the peer of each Org to join this channel, would composer be able to handle two MSP? The createComposerProfile.sh is able to create multiple peers but not multiple MSP. How do I create a composer profile to associate the different MSP for the individual peer?
With hyperledger composer, a connection profile represents a connection from one organisation to a specific channel where a business network has been deployed. Each organisation in a multi-organisation fabric topology will have connection profiles representive of their individual MSP. An organisation may also have more than one connection profile as well, for example one to perform composer runtime installations, one to transact on a business network and even one to query a business network.
createComposerProfile.sh creates a connection profile for the developer server provided by hyperledger composer and only creates a reference to the single peer defined by that developer server.

How do you install Fabric Composer for a multi-user development and production environment

Can you install Fabric Composer for a multi-user development and production environment. Seems like you can using the --connectionProfileName, -p option on the CLI but I could not find where that is defined.
Yes, you can. Connection Profiles are described here:
https://fabric-composer.github.io/reference/connectionprofile.html
You should create a connection profile for your remote Fabric, and then deploy your business network archive to it. This will add a "networks" section to your connection profile, which can then be shared with team members that need access to the remote Fabric.
Note: I just noticed that this page needs to be updated, all references to "concerto" should be replaced with "composer".

Resources