duan00529 2017-09-23 19:58 采纳率: 100%
浏览 116
已采纳

识别Hyperledger Fabric V1.0链码中的调用同级/组织

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)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题
  • ¥15 海湾GST-DJ-N500
  • ¥15 氧化掩蔽层与注入条件关系
  • ¥15 Django DRF 如何反序列化得到Python对象类型数据
  • ¥15 多数据源与Hystrix的冲突
  • ¥15 如何在线硕士了解,广告太多,希望有真实接触过的人回答下?(标签-学习|关键词-在线硕士)
  • ¥15 zabbix6.4与frp如何进行联动