我们假设以下网络架构:
A -> 链码1 -> fabcar
A是应用程序,链码1是 Go 中的链码fabcar是 Nodejs 中的链代码。
他们在同一频道:“mychannel”。
何时执行操作APIstub.InvokeChaincode
来自链码1例如APIstub.InvokeChaincode("fabcar", chainCodeArgs, "mychannel")
,链码是否有可能fabcar(调用的链码)以获得id调用者链码的?
The getCreator()
方法中的fabcar链码仅返回调用者组织;但需要的信息是链码 ID或一些仅与链码1.
UPDATE
我尝试过getSignedProposal()
hyperledger官方文档中写的方法:https://fabric-shim.github.io/ChaincodeStub.html#getSignedProposal__anchor
The getSignedProposal()
方法返回类型为已签名交易提案的完全解码对象SignedProposal
.
The SignedProposal
object 表示客户端应用程序发送到链码的请求对象。
执行以下代码:
const proposal = stub.getSignedProposal();
console.log("signed proposal: ", proposal);
结果如下:
signed proposal: { signature: <Buffer 30 45 02 21 00 c3 a7 91 4c 74 f9 c2 97 04 fc 84 91 6a 71 2d 69 ad 0e a9 22 f2 ed 53 a3 66 97 56 17 d7 d7 3a e6 02 20 13 26 8a 4f f6 3d 86 4e f9 35 ae ... >,
proposal:
{ header: { signature_header: [Object], channel_header: [Object] },
payload: { input: [Object], TransientMap: [Object] } } }
似乎真的很难理解哪些信息可以检索调用链码ID。
这是有关该文档的链接SignedProposal
type: https://fabric-shim.github.io/global.html#SignedProposal