interfacehyperledger-fabrichyperledger-chaincodefunction-definitionchaincode

Hyperledger Fabric: How to get names of all the functions along with their arguments and return-types contained in a deployed chain-code


I was wondering if there is any possible way, to get the names of all the functions, which a deployed Chaincode contains, along with the arguments each of them expects, as well as their return-types.

So that the client application can utilize it to minimize inconsistencies while calling them.


Solution

  • You can use one of the Fabric SDKs (e.g Node SDK) to submit a transaction with the argument 'org.hyperledger.fabric:GetMetadata'. This will return a buffer containing your smart contract metadata, which will have information about your transactions, their arguments, etc.