Adrian Coutsoftides
Adrian Coutsoftides

Reputation: 1293

Multi-Channel vs Multiple BNAs Hyperledger Composer

As per the official hyperledger composer documentation, composer can only work on a single channel:

https://hyperledger.github.io/composer/latest/reference/connectionprofile

In the design I intend to implement, I have multiple channels operating simultaneously. As such, would I have to create a BNA definition for each channel and 'launch' it every time I want to create a channel?

To save myself the potential agony and development time of redeveloping the entire system on the fabric level, can I equate having multiple channels to simply launching multiple composer BNAs?

Upvotes: 0

Views: 212

Answers (2)

T.Arthur
T.Arthur

Reputation: 135

I have the same confusion of yours too. But after read the issue ,I understood why composer connection profile doesn't support multi channel.
https://github.com/hyperledger/composer/issues/2103
Since different channels have its own speciality, it is horrible to define all of them in one connection profile If you use composer-rest-api it will always use the first element in channels

Upvotes: 0

Andrei Dragotoniu
Andrei Dragotoniu

Reputation: 6335

In the connection profile file, you can have multiple channels, here's an example of my version of it for one of my projects:

"channels": {
        "chan1": {
            "x-status": "membership_valid",
            "orderers": [
                "orderer"
            ],
            "peers": {
                "org1-peer0c64": {
                    "x-chaincode": {}
                }
            },
            "chaincodes": [],
            "x-members": [
                "org1",
                "org4"
            ]
        },
        "chan2": {
            "x-status": "membership_valid",
            "orderers": [
                "orderer"
            ],
            "peers": {
                "org1-peer0c64": {
                    "x-chaincode": {}
                }
            },
            "chaincodes": [],
            "x-members": [
                "org1"
            ]
        }
    },

the idea is that you can have a peer joined on multiple channels. you can have chaincode (bna) installed on the peer and then that chaincode needs to be instantiated on a channel. Nothing stops you from instantiating the same chaincode, on any number of channels.

Just keep in mind that each channel has its own ledger, they will be separate, but yes there are instances where such a design is required.

a good resource for a more complex scenario is this: https://hyperledger.github.io/composer/latest/tutorials/deploy-to-fabric-multi-org

Upvotes: 1

Related Questions