Sudharasan D
Sudharasan D

Reputation: 149

Hyperledger fabric Chaincode Owner

Am working on hyperledger fabric, i have network setup of 2 org,1 channel and 1 orderer.

I installed chaincode(Say CH1) in Org1, with endoserment policy "AND(Org1.member,Org2,member)". Now i need to install same chaincode(CH1) in Org2 to validate and endorse transaction.

Since chaincode(CH1) installed in Org2(for endorsement purpose), also permitted to execute transaction using same chaincode(CH1), which will affect state, created by Org1. How to prevent this?

Upvotes: 0

Views: 249

Answers (1)

Gari Singh
Gari Singh

Reputation: 12033

You need to separate 3 concepts here:

  1. Installing chaincode
  2. Instantiating chaincode on a channel
  3. Endorsing chaincode

Installing chaincode simply makes the bytes of the chaincode available on the peer on which it is installed.

Instantiating chaincode on a channel makes that chaincode available for execution on the channel.

The endorsement policy determines which peers need to successfully execute and sign a transaction (technically peers sign the endorsement response).

In your case, installing the chaincode on the peers for both Org1 and Org2 makes the chaincode bytes available to the peers. Instantiating the chaincode on a channel will make it available for execution. The endorsement policy you set requires that a peer from Org1 AND a peer from Org2 must execute and endorse the transaction.

Once the client has collected the endorsements, the transaction will be send to the ordering service and then delivered to all peers in the channel. When the peers in the channel receive a transaction which involves CH1, they will check to make sure that the endorsement policy has been met (in this case that a peer from both Org1 and Org2 signed the transaction) and only then can it be committed (after the other validation checks)

Upvotes: 1

Related Questions