确定调用Hyperledger面料V1.0内情/组织chaincode
答
目前所有可用于chaincode的API都在interface.go
文件中描述。目前没有API可以让你识别在链码内调用对等和组织。我认为主要的原因是链代码必须对这种类型的信息不可知,因为所有由对等方和链代码管理的ACL都应该保持不可知论的状态,保持确定性的行为,而不管谁调用它并且是无状态的。
如果需要,你也许可以尝试使用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)
然后解析客户端证书,了解客户,你也可以也可以考虑使用transient fields使客户把有可能通过chaincode后读取相关信息:
// 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)
这个信息似乎是有帮助的,因为我不知道这些。但仍然无法达到我的要求。为了明确我脑海中的事情,我只是更新了这篇文章。你可以通过它,并建议达到这个要求。 – Girish007
看起来,更新后,你问同样的问题作为从这里的第一个项目符号:https://stackoverflow.com/questions/46352182/implement-inter-channel-security-among-the-peers-within-the-same-渠道炒作,我是否正确? –
是否介意将更新后的部分解压到单独的问题中? –