fabric-samples icon indicating copy to clipboard operation
fabric-samples copied to clipboard

Issue on how to invoke functions for asset-transfer-basic go version

Open msalimbene opened this issue 2 years ago • 0 comments

Hello all. When in invoking a chaincode, what is the correct way of selecting the method you wish to invoke, for example, the following commands works and produce same results:

peer chaincode invoke -n basic_go -C mychannel -c '{"function":"GetAllAssets","Args":[]}'

peer chaincode invoke -n basic_go -C mychannel -c '{"Args":["GetAllAssets"]}'

You notice the first one names the function within the function property, the second invocation, uses the first argument of the Args array to do so.

For GetAllAssets works, but for CreateAsset for instance, it doesn't. You can only invoke it using the latter approach. I'm testing with https://github.com/hyperledger/fabric-samples/tree/main/asset-transfer-basic/chaincode-go

I have not been able to find any clarification in the docs regarding this matter. Should the method be call separately as a property function, or as a first argument?

msalimbene avatar Sep 23 '22 21:09 msalimbene