Alexander Fedyukov
Alexander Fedyukov

Reputation: 974

No chaincode found on peer after installation through peer lifecycle

I follow by instruction from the fabric-sample/test-network, but trying to reproduce steps of control in docker container. All steps of chaincode installation went good except one of the final - peer chaincode invoke.

On this step I got an error: 2020-07-09 10:40:00.755 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 05a ESCC invoke result: response:<status:500 message:"make sure the chaincode fabcar has been successfully defined on channel appchannel and try again: chaincode definition for 'fabcar' exists, but chaincode is not installed" > Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode fabcar has been successfully defined on channel appchannel and try again: chaincode definition for 'fabcar' exists, but chaincode is not installed"

When I check chaincode with peer lifecycle chaincode queryinstalled I receive a normal response: Installed chaincodes on peer: Package ID: fabcar_1:644530ed4e097a65073d6e0fc8a7aaa9282945e55aa1ec7d2014746fd598f631, Label: fabcar_1

But when I check chaincode with peer chaincode list --installed I receive empty set: Get installed chaincodes on peer:

configtx.yaml from test-example is used.

Where is my mistake?

Here is my Dockerfile. The main idea is to make a self-sufficient docker environment of hyperledger with outscripting needs.

Upvotes: 1

Views: 1313

Answers (3)

Badr Bellaj
Badr Bellaj

Reputation: 12821

In the new lifecycle we have to use :

peer lifecycle chaincode queryinstalled

In the old lifecycle we use

peer chaincode list --installed

Upvotes: 0

metadata
metadata

Reputation: 1189

As mentioned by @HoaiNam that you have to use fabricv2.x api's since you are using test-network. Also you can try previous command by adding v1.4.x capabilities(not sure). for understanding latest CC lifecycle process, you can refer here. for commands, you can refer to test-network/scripts/deployCC.sh. I hope this helps.

Upvotes: 0

Hnampk
Hnampk

Reputation: 517

The command peer chaincode ... use the LSCC - Lifecycle System Chaincode, which is used for the 1.x Fabric network. The 2.x docs about this here

You can try using the old-style command to install chaincode peer chaincode install ..., then you can query the installed chaincode with peer chaincode list --installed. But from version 2.0, it's recommended using the new lifecycle chaincode.

I also found the in-practice chaincode comparison of version 1.4 and 2.0 here. Hope this can give you some ideas.

Upvotes: 1

Related Questions