首页 文章

使用node.js SDK调用chaincode时的ENDORSEMENT_POLICY_FAILURE

提问于
浏览
0

遵循的步骤:

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

1 回答

  • 0

    您的认可政策要求Org1的同行和Org2的同行支持该交易 . 鉴于您只从Org1运行单个对等方,因此无法满足此认可政策 .

    尝试将认可政策设定为

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

    或者将Org2中的对等体添加到 Channels 并安装链代码 .

相关问题