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.