hyperledger / fabric-admin-sdk

Hyperledger Fabric admin SDK
Apache License 2.0
31 stars 19 forks source link

add org.hyperledger.fabric:GetMetadata into go API #175

Closed davidkhala closed 8 months ago

davidkhala commented 8 months ago

If developer is using the Contract API for your chaincode implementation

The chaincode should have a "org.hyperledger.fabric:GetMetadata" transaction function that will provide you with information on the smart contracts and transaction functions contained in the chaincode.

Ref: https://lists.hyperledger.org/g/fabric/topic/85103256?p=Created%2C%2C%2C20%2C2%2C0%2C0

Considering its nature I want to add this function in chaincode pkg. @SamYuan1990 @bestbeforetoday What do your think?

SamYuan1990 commented 8 months ago

I suppose we should not duplicate a feature if it already in fabric gateway sdk. If need a command line interface, then fabric-cli repo is the option as fabric community what to implement it. At implementation level, I am open for this repo invokes fabric gateway sdk for feature reuse or support.

bestbeforetoday commented 8 months ago

The metadata is retrieved using a regular transaction transaction function. This can done from application code by using the Fabric Gateway client API to evaluate the GetMetadata transaction function on the org.hyperledger.fabric smart contract within the chaincode, something like:

contract := network.GetContractWithName(chaincodeName, "org.hyperledger.fabric")
metadata := contract.Evaluate("GetMetadata")