Error committing chaincode to network with 4 orgs #fabric-chaincode


LC
 

Hi all, 

We're trying to deploy our chaincode to the test-network with 4 orgs in it. Following the "Deploy a smart contract to channel" tutorial, we got each org to approve the chaincode definition as confirmed in the following:

$ peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name material_prov --version 1.0 --sequence 1 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --output json

{
        "approvals": {
                "Org1MSP": true,
                "Org2MSP": true,
                "Org3MSP": true,
                "Org4MSP": true
        }
}

However, when we try committing the chaincode to the channel, we get an error showing that the chaincode definition is not approved by the org that's currently running the command:

$ peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name material_prov_0 --version 1.0 --sequence 1 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" --peerAddresses localhost:11051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt" --peerAddresses localhost:13051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org4.example.com/peers/peer0.org4.example.com/tls/ca.crt"
 
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'CommitChaincodeDefinition': chaincode definition not agreed to by this org (Org1MSP)

We tried adding a signature policy as mentioned in this post but got the same result. We're running peer version 2.4.2 on macOS11.1 through docker. We added the 3rd and 4th org following the "Adding an org to a channel" tutorial. Any insight would be appreciated. Thanks!



David Faulstich Diniz Reis
 

It appears that you are trying to commit an not approved definition.

Check the crafted --name parameter on both commands. The checkcommitreadness is using another name definition:

  1. --name material_prov;
  2. --name material_prov_0;
All parameters must be equals on approveformyorg, checkcommitreadiness and commit lifecycle commands.



Best regards.

David



Em qui., 24 de mar. de 2022 às 16:35, LC <lanting@...> escreveu:

Hi all, 

We're trying to deploy our chaincode to the test-network with 4 orgs in it. Following the "Deploy a smart contract to channel" tutorial, we got each org to approve the chaincode definition as confirmed in the following:

$ peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name material_prov --version 1.0 --sequence 1 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --output json

{
        "approvals": {
                "Org1MSP": true,
                "Org2MSP": true,
                "Org3MSP": true,
                "Org4MSP": true
        }
}

However, when we try committing the chaincode to the channel, we get an error showing that the chaincode definition is not approved by the org that's currently running the command:

$ peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --name material_prov_0 --version 1.0 --sequence 1 --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" --peerAddresses localhost:11051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt" --peerAddresses localhost:13051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org4.example.com/peers/peer0.org4.example.com/tls/ca.crt"
 
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'CommitChaincodeDefinition': chaincode definition not agreed to by this org (Org1MSP)

We tried adding a signature policy as mentioned in this post but got the same result. We're running peer version 2.4.2 on macOS11.1 through docker. We added the 3rd and 4th org following the "Adding an org to a channel" tutorial. Any insight would be appreciated. Thanks!