Re: API to get local MSPID in chaincode? #fabric #fabric-chaincode #fabric-questions

Tsvetan Georgiev

If I get your questions right, you want to fetch the MSPID of the peer that starts/endorses the chaincode. For that purpose you can use the chaincode shim API. In case it is java based chaincode you can look at the method String getMspId(); of the shim:
You have similar method in NodeJS shim:

If you want to fetch the MSPID (as you mention above) of the user who requests for endorsement you can do that through the caller identity (CID) - see method getCreator() of the ChaincodeStub.

Join to automatically receive all group messages.