Chaincode ID is generated as hash code for multiple parameters (path to chaincode + arguments + source code )
if you see in the response for “deploy” command something like this:
{“jsonrpc":"2.0","result":{"status":"OK","message":"8d803651564981858842409c6a5c3bf3f6ea69f90a6a7bfb672c2c8c3b6eb4c48105c5807e52f1a5ffdce0e86966688019a6c4013ffca524d5896e0b9ae201c6"}
It means that your request to deploy transaction is accepted. From this moment Fabric will try to create a container for your chaincode and start it in docker. In case something goes wrong and the container is not started, you will receive the following response:
“LedgerError - ResourceNotFound: ledger: resource not found“ for all your commands.
In your example you are trying to deploy Java chaincode in a GO container and as a result the response is:
(INFO 002 Deploy result: type GOLANG chaincodeID:...)
That is happening because Fabric does not use a “language” variable to detect platform type (valid for version which was available 09/09/2016)
I managed to deploy a Java chaincode using the following REST request:
curl -XPOST -d ‘{"jsonrpc": "2.0", "method": "deploy", "params": {"type": 4,"chaincodeID": {"path": "/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/java/SimpleSample","language": "java"}, "ctorMsg": { "args": ["init", "a", "100", "b", "1000"] }},"id": 0}' http://localhost:7050/chaincode
type:4
means that this chaincode is Java and appropriate container should be used. (for GO we should use type:1
)
Keep in mind that Java currently works with security.enabled=false
only and with security.enabled=true
you will see the following error message:
[dockercontroller] deployImage -> ERRO 095 Error building images: API error (500): {"message":"The Dockerfile (Dockerfile) cannot be empty"}
dev
mode or normal mode ? how did you run the peer ? what name are you providing when you are querying ? - Sufiyan Ghori-l java
if you are deploying it using java code - Sufiyan Ghori