Reputation: 717
AS per Fabric documentation, peer endorsements for a specific chaincode is specified during chaincode instantiations.
i.e 'peer chaincode instantiate' .... with endorsements specified with '-P '
Now I can specify which peer to instantiate the chaincode with and the endorsement policy. Like for example if you take the first-network example in Hyperledger Fabric (https://medium.com/@kctheservant/understanding-first-network-example-in-hyperledger-fabric-part-1-c03391af798), chaincode instantiation is done for a specific peer (instantiateChaincode 0 2), which means that chaincode is instantiated for peer0 in org2.
Now can I instantiate the same for different peers in the same first-network example (instantiateChaincode 1 2, instantiateChaincode 0 1, instantiateChaincode 1 1 ..) each with a different endorsement policy for the same chaincode installed on all the peers ?
**'peer chaincode instantiate [MSP for peer0.org1] -C [channel] -c [chaincode] -P [policy1]'
'peer chaincode instantiate [MSP for peer1.org1] -C [channel] -c [chaincode] -P [policy2]'** . . .
each instantiation of the same chaincode but with different endorsements for each
Thanks
Edit: The Hyperledger Fabric docs specify that instantiation of chaincode can be done only once and for one peer after installation. So is there a way to introduce endorsements for each peer or at a method level in Fabric as such ?
Upvotes: 0
Views: 54
Reputation: 474
From Hyperledger Fabric version >= 2, you have to use commit chaincode instead of instantiation.
Instantiation is related to channel, not related with peer. So you have to Instantiate into a channel from any of channel peer which will work for every peer of that channel.
For your use cases, you may use different channel, you may use private data collection, you may use chaincode level access control like attribute based access control(ABAC), Affiliation based access control etc
Upvotes: 1