2

I had 2 organization in Hyperledger Fabric blockchain network initially. Recently I added one more organization on a different host using swarm. When I try to invoke chaincode from 1st or 2nd organization then it's working fine and I can see the updated transaction from org3. But when I invoke a transaction from org3, I am getting the following error.

"[2019-02-06 06:44:21.895] [ERROR] invoke - The transaction was invalid, code = ENDORSEMENT_POLICY_FAILURE"

Initially, chaincode was initiated using the following policy. -P "OR ('Org1MSP.peer','Org2MSP.peer')"

So I think I will have to update existing endorsement policy to include org3.

Could anyone help to modify existing endorsement policy or to resolve the issue?

Dan Anderson
  • 2,265
  • 1
  • 9
  • 20
Anurag
  • 33
  • 4

2 Answers2

1

The way to upgrade the chaincode is as followed:

  • Increment the version of ccRequest containing ccPackage
  • Re-Install the ccRequest on all orgs in the channel.

    Ex: peer chaincode install -n mycc -v 2.0 -p github.com/chaincode/chaincode_example02/go/

  • Create new ccPolicy with correct rules containing required orgs as endorsers.
  • Upgrade the chaincode by running upgradeCC command

    Ex: peer chaincode upgrade -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -v 2.0 -c '{"Args":["init","a","90","b","210"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')"

    • Test with a query on chaincode with peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'

For more details refer docs or ask on rockerchat

Captain Levi
  • 804
  • 7
  • 18
0

Yes, you can do that using peer chaincode upgrade command.

peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')"

refer : peer chaincode upgrade

Harshit
  • 886
  • 7
  • 18