Identifying the Caller Chaincode in Hyperledger Fabric Using InvokeChaincode
Consider the following network architecture:
A -> Chaincode1 -> fabcar
These components operate on the "mychannel" channel.
When invoking fabcar from Chaincode1 using APIstub.InvokeChaincode, fabcar does not inherently have the ability to determine the caller chaincode's ID. The getCreator() method in fabcar only provides the caller organization's details.
Alternative Approach using SignedProposal
Attempts to retrieve the caller chaincode ID using getSignedProposal() have also been unsuccessful. While this method returns a signed transaction proposal, it is challenging to extract the specific information needed.
Conclusion
As of now, there is no way for fabcar to obtain the caller chaincode's ID within the provided network architecture. This is because chaincodes lack a unique identity in the current Hyperledger Fabric architecture.
The above is the detailed content of Can Hyperledger Fabric Chaincodes Identify Their Callers?. For more information, please follow other related articles on the PHP Chinese website!