1

Steps followed:

1. Started a Hyperledger Fabric network with 1 organization,1 Peer,1 couch db and 1 CA

2. Created channel

docker exec command -e"CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c mychannel -f /etc/hyperledger/configtx/channel.tx 

3. Joined peer to the channel using docker exec command

docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel join -b mychannel.block

4. Installed chaincode

docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n fabcar -v 1.0 -c '{"Args":[""]}' -P "AND ('Org1MSP.member','Org2MSP.member')"

5. Started the client

6. Used node SDK to enroll and register a user

7. Ran invoke.js [from fabcar example] to initledger with 10 cars

8. The invoke query throws ENDORSEMENT_POLICY_FAILURE error.Please note that endorsement policy is set as "AND" Image

anjy
  • 331
  • 3
  • 16

1 Answers1

3

Your endorsement policy requires a peer from Org1 and a peer from Org2 to endorse the transaction. Given you are only running a single peer from Org1, there is no way to satisfy this endorsement policy.

Try setting the endorsement policy to

-P "AND ('Org1MSP.member')"

or adding a peer from Org2 to the channel and install the chaincode.

Gari Singh
  • 11,418
  • 2
  • 18
  • 41