Is there any way to know the invoking peer and organisation inside golang chaincode for Hyperledger Fabric V1.0?
4条回答 默认 最新
- dongyao5186 2017-09-24 11:00关注
Currently all API's available for chaincode is described in
interface.go
file. At the moment there is no API which will allow you to identify invoking peer and organization inside the chaincode. I think the main reason for that is that chaincode has to be agnostic to that type of information, since all ACL's managed by the peer and chaincode should stay agnostic to it, preserve deterministic behavior regardless of whoever invoking it and be stateless.If need you probably could try to leverage the identity of the client who created transaction proposal request, by using
GetCreator
API:// GetCreator returns `SignatureHeader.Creator` (e.g. an identity) // of the `SignedProposal`. This is the identity of the agent (or user) // submitting the transaction. GetCreator() ([]byte, error)
And then to parse client certificate to learn about the client, also you can also consider to use transient fields to make client to put there relevant information which could be read by chaincode later:
// GetTransient returns the `ChaincodeProposalPayload.Transient` field. // It is a map that contains data (e.g. cryptographic material) // that might be used to implement some form of application-level // confidentiality. The contents of this field, as prescribed by // `ChaincodeProposalPayload`, are supposed to always // be omitted from the transaction and excluded from the ledger. GetTransient() (map[string][]byte, error)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 关于#ubuntu#的问题,如何解决?(相关搜索:移动硬盘)
- ¥15 scikit安装之后import不了
- ¥15 Ros2编译一个使用opencv的c++节点的时候,报了这个错误,请问怎么解决啊
- ¥15 人脸识别相关算法 YOLO,AI等
- ¥15 spark问题方便加V17675797079
- ¥15 Python代码不打印的原因
- ¥20 微软SEAL库的安装和使用,VS2022环境配置问题
- ¥15 数学问题也不知道那种类型的问题
- ¥15 R作图的时候,文本框重叠了怎么办?
- ¥15 用python重建流场