Support for --isInit in chaincode invoke using Fabric Node SDK #externalbuilders #fabric-questions #hyperledger-fabric


Hi Team,

I was searching for a command line equivalent support for `--isInit` flag in Fabric Node SDK v2.2.x. However, I could not find the same in the documentation. The other lifecycle commands can be performed using peer CLI, but as a part of supporting old SDK functionalities, as per peer CLI, I was hoping that this feature could be made available in Fabric Node SDK too. Please let me know your thoughts, or if I have missed it to be part of SDK already, it would be helpful if you can point me to the documentation on the same.


More deeply, the question goes as:
1. Should we implement chaincodes from v2.2.x onwards such that we do not use `Init` and `Invoke` function in the source code. In this case to initialize ledger with some values, the users might have to take responsibility in calling the function that initializes the ledger and then call any other function.
2. Use --init-required to restrict users from calling any other functions before the ledger is initialized (irrespective of whether "Init" and "Invoke" is used in the chaincode source code) using --isInit in peer chaincode invoke command.

I wanted to understand what is best practice guide, let's for Golang chaincodes for now.