dtlhy0771 2018-08-10 09:03
浏览 413
已采纳

从Hyperledger Fabric Node SDK中的函数InvokeChaincode()获取链码调用方ID

Let's suppose the following network architecture:

A -> Chaincode1 -> fabcar

A is the application, Chaincode1 is a chaincode in Go and fabcar is a chaincode in Nodejs. They are on the same channel: "mychannel".

When is performed the operation APIstub.InvokeChaincode from the Chaincode1 such as APIstub.InvokeChaincode("fabcar", chainCodeArgs, "mychannel"), is there a possibility for the chaincode fabcar (the chaincode called) to get the id of the the caller chaincode?

The getCreator() method in the fabcar chaincode just returns the caller organization; but the information needed is the chaincode id or some info only connected to the Chaincode1.


UPDATE

I tryed the getSignedProposal() method as written in the official documentation of hyperledger: https://fabric-shim.github.io/ChaincodeStub.html#getSignedProposal__anchor

The getSignedProposal() method returns a fully decoded object of the signed transaction proposal of type SignedProposal. The SignedProposal object represents the request object sent by the client application to the chaincode.

Executing the following code:

const proposal = stub.getSignedProposal();
console.log("signed proposal: ", proposal);

the result is the following:

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] } } }

Seems really difficult to understand which is the info where is possible to retrieve the calling chaincode ID. Here is the link of the doc concerning the SignedProposal type: https://fabric-shim.github.io/global.html#SignedProposal

  • 写回答

2条回答 默认 最新

  • douyiji3919 2018-08-10 13:58
    关注

    No, it is not currently possible to do this because the chaincode itself does not have an identity, per se.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同