peer lifecycle chaincode commit error 500
Antoni Massó Mola <antonimassomola@...>
Hello,
Im stuck at the peer lifecycle chaincode commit command. I execute the following commands until I get an error on the above command. export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peerOrganizations/org2/users/Admin@org2/msp
export CORE_PEER_ADDRESS=peer0-org2-service:10051
export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peerOrganizations/org2/peers/org2-peer0.default.svc.cluster.local/tls/ca.crt
export CORE_PEER_LOCALMSPID=org2
peer lifecycle chaincode package o-test7.tar.gz --path /chainset/hyperledger-config/chaincode/src/o-test --label o-test7
peer lifecycle chaincode install o-test7.tar.gz
peer lifecycle chaincode approveformyorg --tls lifecycle chaincode approveformyorg -o orderer0-service:7050 --tls --cafile /etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem --channelID o-testing --name o-test7 --version 1 --init-required --sequence 1 --waitForEvent --signature-policy "OR ('org2.peer')" --package-id o-test7:757e5f9ddab38a34b8086649fce8a7de4be1567f2cb3249cbecad1c54f80e96d
peer lifecycle chaincode approveformyorg -o orderer0-service:7050 --tls --cafile /etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem --channelID o-testing --name o-test7 --version 1 --sequence 1 --waitForEvent --signature-policy "OR ('org2.peer')" --package-id o-test7:757e5f9ddab38a34b8086649fce8a7de4be1567f2cb3249cbecad1c54f80e96d
peer lifecycle chaincode checkcommitreadiness --channelID o-testing --name o-test7 --version 1 --sequence 1 --signature-policy "OR ('org2.peer')" --output json
{
"approvals": {
"org1": false,
"org2": true
}
}
peer lifecycle chaincode commit -o orderer0-service:7050 --tls --cafile /etc/hyperledger/orderers/msp/tlscacerts/ca-root-7054.pem --channelID o-testing --name o-test7 --version 1 --sequence 1 --init-required --signature-policy "OR ('org2.peer')" --peerAddresses peer0-org2-service:9051 --tlsRootCertFiles /etc/hyperledger/fabric/peerOrganizations/org2/peers/org2-peer0.default.svc.cluster.local/tls/ca.crt Error: proposal failed with status: 500 - failed to invoke backing implementation of 'CommitChaincodeDefinition': chaincode definition not agreed to by this org (org2) Any idea what I'm doing wrong? Thanks |
|
Will Lahti
Hey Antoni,
As pointed out by the output of CheckCommitReadiness, with your current network configuration, the peer is looking at both Org1 and Org2 for approvals before the chaincode definition can be committed. The signature policy you're setting in the definition is the endorsement policy for the chaincode itself. To commit a chaincode definition, the lifecycle endorsement policy must be satisfied. By default, that is set to a majority of the endorsement policies for each organization participating in the channel.
To get things working, you'll either need to
1) submit an approval using credentials for org1 (easiest given your current configuration)
2) update the LifecycleEndorsement policy for the channel from "MAJORITY Endorsement" to "ANY Endorsement" in configtx.yaml (assuming this is a network you don't mind spinning up fresh, otherwise you'll need to perform a config update to update the policy).
Feel free to reach out to me directly if you need further assistance!
Regards,
----- Original message ----- |
|
Saicharan Pogul
My policies are:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
LifecycleEndorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Endorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Capabilities:
<<: *ApplicationCapabilities peer lifecycle chaincode checkcommitreadiness -o localhost:9050 --channelID supplychain-channel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/orderers/orderer0.freight.example.com/msp/tlscacerts/tlsca.freight.example.com-cert.pem --name supplychain --version 1 --sequence 1 --output json --init-required --signature-policy "AND ('ShipperMSP.peer','FreightMSP.peer','CarrierMSP.peer','CustomMSP.peer','ConsigneeMSP.peer')"
{
"approvals": {
"CarrierMSP": true,
"ConsigneeMSP": true,
"CustomMSP": true,
"FreightMSP": true,
"ShipperMSP": true
}
}
Even after all the orgs approved the chaincode, I get this error for commit command: peer lifecycle chaincode commit -o orderer0.freight.example.com:9050 --ordererTLSHostnameOverride orderer0.freight.example.com --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/orderers/orderer0.freight.example.com/msp/tlscacerts/tlsca.freight.example.com-cert.pem --channelID supplychain-channel --name supplychain --peerAddresses peer0.shipper.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/shipper.example.com/peers/peer0.shipper.example.com/tls/ca.crt --peerAddresses peer0.freight.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/peers/peer0.freight.example.com/tls/ca.crt --peerAddresses peer0.carrier.example.com:11051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/carrier.example.com/peers/peer0.carrier.example.com/tls/ca.crt --peerAddresses peer0.custom.example.com:13051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/custom.example.com/peers/peer0.custom.example.com/tls/ca.crt --peerAddresses peer0.consignee.example.com:15051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/consignee.example.com/peers/peer0.consignee.example.com/tls/ca.crt --version 1 --sequence 1 --init-required
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'CommitChaincodeDefinition': chaincode definition not agreed to by this org (ShipperMSP) |
|
Saicharan Pogul
Its solved just needed to add --signature-policy also for commit: peer lifecycle chaincode commit -o orderer0.freight.example.com:9050 --ordererTLSHostnameOverride orderer0.freight.example.com --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/orderers/orderer0.freight.example.com/msp/tlscacerts/tlsca.freight.example.com-cert.pem --channelID supplychain-channel --name supplychain --peerAddresses peer0.shipper.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/shipper.example.com/peers/peer0.shipper.example.com/tls/ca.crt --peerAddresses peer0.freight.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/peers/peer0.freight.example.com/tls/ca.crt --peerAddresses peer0.carrier.example.com:11051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/carrier.example.com/peers/peer0.carrier.example.com/tls/ca.crt --peerAddresses peer0.custom.example.com:13051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/custom.example.com/peers/peer0.custom.example.com/tls/ca.crt --peerAddresses peer0.consignee.example.com:15051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/consignee.example.com/peers/peer0.consignee.example.com/tls/ca.crt --version 1 --sequence 1 --init-required --signature-policy "AND ('ShipperMSP.peer','FreightMSP.peer','CarrierMSP.peer','CustomMSP.peer','ConsigneeMSP.peer')" |
|