Getting Chaincode Caller ID in Hyperledger Fabric Node SDK: Is It Possible?
Problem:
Consider the network architecture:
A -> Chaincode1 -> fabcar
When Chaincode1 invokes fabcar using APIstub.InvokeChaincode(), can fabcar retrieve the caller chaincode ID?
Question:
Is there any way for fabcar to obtain the caller chaincode ID or information specific to Chaincode1?
Answer:
No.
Currently, chaincodes do not have individual identities, so fabcar cannot directly obtain the caller chaincode ID. The getCreator() method only returns the caller organization, which is not specific enough.
Additional Attempts and Findings:
The getSignedProposal() method was investigated as a potential solution. However, its resulting SignedProposal object does not provide explicit access to the caller chaincode ID or related information.
Conclusion:
Retrieving the caller chaincode ID by the called chaincode (fabcar) is not feasible in Hyperledger Fabric Node SDK at this time.
The above is the detailed content of Can Chaincodes in Hyperledger Fabric Node SDK Identify their Callers?. For more information, please follow other related articles on the PHP Chinese website!