问题描述
如果链码A将变量V存储到世界状态,那么另一个链码B可以访问该变量V吗?
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?
如果不可能,如何使链码B从链码A中读取变量(我的用例需要它)?
If it is not possible, how can I make chaincode B read the variables from chaincode A (I need it for my use case)?
推荐答案
不,某些链码A所存储的变量只能由相同的链码A访问.因此,如果链码B尝试访问变量V,则访问权限为否认.
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.
这篇关于可以使用与部署它不同的链码访问世界状态变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!