0

I tried to deploy a custom chaincode to my hyperledger test network. Therefore, I used the tutorial from https://www.youtube.com/watch?v=KFf1qzYP-bA&t=1380s and https://hyperledger-fabric.readthedocs.io/en/release-2.3/deploy_chaincode.html. Following the tutorials, first I thought the process was successful, but in the end I was running into errors. Here are the steps I did:

peer lifecycle chaincode install newchaincode.tar.gz

And got:

2021-06-20 16:41:18.750 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nLnewchaincode:a52b26224459812b50d72da7fc0644ff2b2c540bd656bbf457a235bca15b3a57\022\013newchaincode" > 2021-06-20 16:41:18.750 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: newchaincode:a52b26224459812b50d72da7fc0644ff2b2c540bd656bbf457a235bca15b3a57

Also checking if the chaincode was installed worked out:

peer lifecycle chaincode queryinstalled

Package ID: newchaincode:a52b26224459812b50d72da7fc0644ff2b2c540bd656bbf457a235bca15b3a57, Label: newchaincode

After that I exported the CC_Package_ID and also set the approve formyorg for both organizations:

peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID newchannel --name newchaincode --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

ClientWait -> INFO 001 txid [e2dfcfc6b5218423878132af6f34ebbef25cd793b258581900b21e1fcca98b63] committed with status (VALID) at localhost:7051

Then checking for commitreadiness:

peer lifecycle chaincode checkcommitreadiness --channelID newchannel --name newchaincode --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 } }

Then I committed my chaincode:

peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID newchannel --name newchaincode --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

2021-06-20 16:48:24.990 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [9336b174e344fb5fd977778e7365da0841b3285eff8c0fa13f6d3f03248442e5] committed with status (VALID) at localhost:9051 2021-06-20 16:48:24.993 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [9336b174e344fb5fd977778e7365da0841b3285eff8c0fa13f6d3f03248442e5] committed with status (VALID) at localhost:7051

And finally, checked if I committed correctly:

peer lifecycle chaincode querycommitted --channelID newchannel --name newchaincode --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

Committed chaincode definition for chaincode 'newchaincode' on channel 'newchannel': Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]

So - I thought the chaincode installation was successful, but when I'm trying to invoke the CC I got this:

Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode newchaincode has been successfully defined on channel newchannel and try again: chaincode newchaincode not found"

Furthermore, when I'm calling docker ps there is no chaincode running.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Leon
  • 371
  • 4
  • 11
  • have you set correct package-id??,your package-id should be `newchaincode:a52b26224459812b50d72da7fc0644ff2b2c540bd656bbf457a235bca15b3a57` – Li Xian Jun 21 '21 at 06:06
  • Yes I did, also I upgraded the chaincode and re-did the process once again but the same occurs. – Leon Jun 21 '21 at 06:53
  • Just invoked the cc once again and had a look at the docker log. Got this: "chaincode registration failed: container exited with 1" – Leon Jun 21 '21 at 07:29
  • check the peer logs to see if the contract was installed with them. Its not clear from the above description whether or not the contract was installed on the peers (i.e whether these parameters are set correctly for installation purposes). You can use `--peerAddresses` with `peer lifecycle chaincode install` but I don't see it and don't know if you or the person in the video is using environment variables in place of this? – Rob Evans Jun 23 '21 at 08:41
  • I think you mean 'export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=localhost:7051' right? For both organizations ORG1MSP and ORG2MSP I did that – Leon Jun 23 '21 at 10:05

0 Answers0