0

Is there any other way to generate a generic channel artifacts(channel.tx) for Hyperledger-Fabric channel creation, So that a channel name alone can be changed at runtime instead of issuing the below command with different channel name for every new channel.

./bin/configtxgen -profile OneOrgChannel -outputCreateChannelTx ./config/channel5.txt

Karthick V
  • 25
  • 8

2 Answers2

0

It's not exactly the answer you are looking for but we do this dynamically inside a java application with a ProcessBuilder. That way we can create new channels on demand - it's embedded ultimately in a REST service that allows you (one) to pass up a configtx file as required.

So long as the crypto is already generated (we do that in another service) you can do this on demand.

aatk
  • 160
  • 1
  • 7
0

So aatk's answer applies the sidecar pattern to solve the issue, by running the configtxgen on the side of the actual application. However you can do this from within the application itself.

A channel configuration transaction that is generated with configtxgen is a file containing a protobuf of the common.Envelope message. There is support for protobuf in Java, and the Envelope message has been compiled to Java thanks to the Fabric Java SDK. We can piggyback on the SDK to create the objects and get the ByteArray to create the ChannelConfiguration object that will be used to create a channel. This method doesn't require a configtx.yaml file at all, so you will need to keep track of organizations and their MSP IDs in the app.

Paul
  • 770
  • 1
  • 7
  • 12