Can a World State variable be accessed by a chaincode different from the one that deployed it?

≡放荡痞女 提交于 2019-12-07 22:39:12

问题


If a chaincode A stores a variable V to the World State can this variable V be accessed by another chaincode B?

In other words, are variables in the World State access protected?

If it is not possible, how can I make chaincode B read the variables from chaincode A (I need it for my use case)?


回答1:


No, variables stored by some chaincode A can only be accessed by the same chaincode A. So if a chaincode B tries to access the variable V, access will be denied.

If you wanted to access such variables (because your use case requires interconnection between chaincodes) you can invoke/query chaincode A from chaincode B using this.



来源:https://stackoverflow.com/questions/37024955/can-a-world-state-variable-be-accessed-by-a-chaincode-different-from-the-one-tha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!