node.js - 从 Hyperledger Fabric Node SDK 中的函数 InvokeChaincode() 获取链码调用者 ID

标签 node.js go hyperledger-fabric blockchain hyperledger

让我们假设以下网络架构:

A -> Chaincode1 -> fabcar

A 是应用程序,Chaincode1 是 Go 中的链代码,fabcar 是 Nodejs 中的链代码。 他们在同一个 channel :“我的 channel ”。

何时从 Chaincode1 执行操作 APIstub.InvokeChaincode 例如 APIstub.InvokeChaincode("fabcar", chainCodeArgs, "mychannel"),链码 fabcar(被调用的链码)是否有可能获得调用者链码的 id

fabcar 链代码中的 getCreator() 方法仅返回调用方组织;但所需的信息是链码 ID 或仅与 Chaincode1 相关的一些信息。


更新

我尝试了 hyperledger 官方文档中写的 getSignedProposal() 方法:https://fabric-shim.github.io/ChaincodeStub.html#getSignedProposal__anchor

getSignedProposal() 方法返回类型为SignedProposal 的签名交易提案的完全解码对象。 SignedProposal 对象表示客户端应用程序发送给链代码的请求对象。

执行以下代码:

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 类型的文档链接:https://fabric-shim.github.io/global.html#SignedProposal

最佳答案

不,目前不可能这样做,因为链码本身没有身份。

关于node.js - 从 Hyperledger Fabric Node SDK 中的函数 InvokeChaincode() 获取链码调用者 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51782788/

相关文章:

node.js - 从 drive.files.get 获取可读流

node.js - 关闭 Github Api 中的证书验证

go - 在 nack 卡住我的应用程序之前删除队列

javascript - 带有 vue-form-wizard 的 Vue CLI Webpack 模板未转换为 es5

javascript - express 4.x 将 http 重定向到 https

hyperledger-fabric - 限制用户仅访问 super 账本结构中的某些 channel

go - 未实现的 desc = 未知服务 protos.ChaincodeSupport

kubernetes - Hyperledger Fabric 与 Kubernetes : Not able to instantiate chaincode

json - 如何列出 Gorilla Mux 中的所有变量?

go - 如何在 macOS 上的 logrus/lumberjack 中自动重新创建日志文件