Topics

chaincode instantiation successful but chaincode not found

Abhijeet Bhowmik
 

Dear All,

I was able to successfully install and instantiate chaincode but when I try to invoke it, it says that chaincode is not found. I ran chaincode list command but the output is empty, I retried instantiating cc again several times but still the same result. PFA peer and cc container logs

Thanks a lot
Abhijeet Bhowmik

Matthew White
 

Hello;
 
I can't say for certain, but it looks like the metadata that is being generated (see line 17 of the cc-output.txt) doesn't seem quite correct.
Can you double check the structure of the contract, specifically around the requirements for `index.js`.
 
 
 
Or if you can share a link to the whole contract?
 
 
Regards, Matthew.
Matthew B White  IBM Blockchain Solutions Architect
 
Email me at WHITEMAT@...
Find me on StackOverflow, and generally at  calanais.me.uk
 
Note: restricted availability for meetings 14:30 to 17:00 UK Tuesday 
IBM United Kingdom Limited, Hursley Park, Winchester, Hampshire, SO21 2JN

"The wrong answers are the ones you go looking for when the right answers stare you in the face"
 
 
 
----- Original message -----
From: "Abhijeet Bhowmik" <abhijeet@...>
Sent by: fabric@...
To: fabric@...
Cc:
Subject: [EXTERNAL] [Hyperledger Fabric] chaincode instantiation successful but chaincode not found
Date: Mon, Jul 13, 2020 5:44 AM
 
Dear All,
 
I was able to successfully install and instantiate chaincode but when I try to invoke it, it says that chaincode is not found. I ran chaincode list command but the output is empty, I retried instantiating cc again several times but still the same result. PFA peer and cc container logs
 
Thanks a lot
Abhijeet Bhowmik
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Matthew White
 

Thanks for the code; really helpful to see the whole thing.

Just now I've used the VSCode extension to package and install/instantiate your exact contract.  This was completed successfully, and I was able to run the instantiate transaction. (I did have to change the package.json to use _ though... the name of the contract is taken from the package name and it can't have .)

Not completely sure, why in your case you would have trouble to be honest. 

  • Typescript - great to see this being used. It really helps 
  • Would strongly suggest using the Contract annotations if you're using typescript. Makes a lot of things so much easier.
  • If you do use annotations, then Return types or Arguments that are 'complex' objects (i.e. not String, number or other primitive) need to be a class that has the @DataType associated with it.

Take a look at the example project you can create in the VSCode extension - that has all these annotations included. 

Matthew

(for reference the extension is https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform




 

[14/07/2020 09:21:05] [INFO] submitting transaction instantiate with no args on channel mychannel

[14/07/2020 09:21:07] [SUCCESS] Returned value from instantiate: {"msg":"success","status":200,"payload":{"msg":"ALL OK","msp":"Org1MSP","id":"x509::/C=US/ST=North Carolina/O=Hyperledger/OU=client/CN=admin::/C=US/ST=California/L=San Francisco/O=Internet Widgets, Inc./OU=WWW/CN=example.com","companyID":null}}