Assume that there exist 2 different chaincodes, say chaincodeA and chaincodeB.
chaincodeA implements a function that, before it is completed (e.g. put something in the state), it invokes a function from chaincodeB that asks the Admins from the other organizations to approve this action.
For example:
- chaincodeA is called - A function starts and after some steps invokes the corresponding function at chaincodeB that asks the admins of the other orgs to consent
- The invoked function at chaincodeB starts and asks each and every Admin at the other organizations for their approval. While this happens, the function at chaincodeA awaits for the delivery of the signed approvals.
- Every admin has answered - The result is returned to chaincodeA's invoked function and is checked for majority consent.
- If the majority of the admins approved the action, then the function can continue, else returns an error.
Is something like this (or close to this) possible? If no, even without manual intervention, how something like this can be achieved?
Should I reach consensus before the invocation of the function at chaincodeA, and save to the state the answers of the admins, so I can check them when its needed?