Information on where is the code for channel creation and chaincode
nkaramolegos opened this issue · 7 comments
Hello, where is the code for creating a new channel or deploying a new chaincode?
Create new channel:
-
First you need to build a channel config (JSON), the consoles starts by using this template file
-
Next send the JSON through a configtxlator to get a protobuf
-
Next sign the proposal:
-
To create a new channel you need to submit a config update to the ordering service
-
Last you wait for the tx to take. you can monitor block height, or look for your transaction id in a cut block.
Chaincode
Depends on if you want lifecycle 2.0 or the older stuff.
- lifecycle 1 functions are here - https://github.com/hyperledger-labs/fabric-operations-console/tree/main/packages/stitch/docs#c---fabric-lscc-methods-fabric-v1x
- steps are: install -> instantiate
- life cycle 2 functions are here - https://github.com/hyperledger-labs/fabric-operations-console/tree/main/packages/stitch/docs#d---fabric-_lifecycle-methods-fabric-v2x
- steps are: install -> approve -> (repeat approve as needed) -> commit
Thank you for your support. I will study your proposals. One more question can I skip the browser UI and make all these operations by calling the appropriate functions from an other utility (like a proxy)?
@nkaramolegos np! so the UI does not offer APIs to create/edit channels or chaincode. But Fabric itself has grpc APIs to do these things directly (this is how the UI works). There are also "fat" SDKs that can help you do fabric operations. Here is the node.js fabric sdk docs and here's the node sdk repo.
Hello, maybe my question was not very clear. I would like to use fabric-console without the UI (no access from the browser). I just want to replace the browser with an other utility that can use the functionality of the fabric console to setup the network.
I believe somehow there is an API that the browser uses in order to interact with the console.
going to put your request in another issue and close this one! #80
Thank you. So based your experience can I use fabric operation console and the aforementioned API in order to manage my fabric network (without the UI) just by using a custom service which makes REST calls to create new channels, deploy a new chaincode etc, add orgs to new channels etc? While for interacting with the BC network to use the SDK based client application as mentioned here?
@nkaramolegos afraid not, in short I don't think this repo offers what you are after. I'll add a list of APIs that the console offers and highlight fabric operations it cannot do via apis (i'll add it to the readme. I'm sure it will be a common question).
As is, the console does not offer APIs that would duplicate Fabric apis. meaning it does not offer APIs to create/update channels/chaincode. For those things you would use a Fabric SDK.
Technically the console does offer APIs to create/update peers, cas, and orderers. However you need to use the IBM Support offering. The code in this repo expects to talk to a Kubernetes operator to actually build and edit components. This operator is not available (outside the IBM support offering). So the APIs in this repo that create/update peers, cas, and orderers are effectively broken.
tldr: The code base in this repo is really about providing a visual way to monitor/inspect running Fabric components. It has missing pieces if you want to build/edit the Fabric components.