7

Lets say that we have two different chaincodes: cc1 and cc2.

If cc1 invokes cc2 is there a way for cc2 to check if the invocation is coming from cc1.

Ilia Vatahov
  • 141
  • 3

1 Answers1

2

I think there is no current official support for that. But it seems possible to get first called chaincode from SignedProposal (More on this here)

Another possible generic solution can be something like temporary token verification, it goes like this: - chaincode1(cc1) gets called, and it wants to call chaincode2 (cc2) - cc1 random generates token and appends it to message with its name. - cc1 invokes cc2 - cc2 takes token and with help of given name invoked cc1 with same token in msg. - cc1 verifies that token is correct. - cc2 continues to do its thing. There is overhead in communication but it is, within my knowledge, only way to know for sure if your code is called from another specific chaincode.
edit: this way is not working

draganrakita
  • 188
  • 2
  • 8