Can a World State variable be accessed by a chainc

2019-05-21 02:05发布

问题:

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.