hyperledger-archives / fabric

THIS IS A READ-ONLY historic repository. Current development is at https://gerrit.hyperledger.org/r/#/admin/projects/fabric . pull requests not accepted
https://gerrit.hyperledger.org/
Apache License 2.0
1.17k stars 1.01k forks source link

Deploy Chaincode get no response in dev mode #1084

Open yeasy opened 8 years ago

yeasy commented 8 years ago

Use dev mode for chaincode, following the devnet example.

There is no response chaincode name string:

$ ./peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'

09:47:35.302 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
09:47:35.302 [logging] LoggingInit -> DEBU 002 Setting default logging level to DEBUG for command 'chaincode'
09:47:35.308 [main] chaincodeDeploy -> INFO 003 Deploy result: type:GOLANG chaincodeID:<path:"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" > ctorMsg:<function:"init" args:"a" args:"100" args:"b" args:"200" >

But when look at the block, there creates new block in the list.

{"transactions":[{"type":1,"chaincodeID":"CkdnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy9leGFtcGxlcy9jaGFpbmNvZGUvZ28vY2hhaW5jb2RlX2V4YW1wbGUwMg==","payload":"CmUIARJJCkdnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy9leGFtcGxlcy9jaGFpbmNvZGUvZ28vY2hhaW5jb2RlX2V4YW1wbGUwMhoWCgRpbml0EgFhEgMxMDASAWISAzIwMA==","timestamp":{"seconds":1460540855,"nanos":304151718}}],"previousBlockHash":"v7cyxDb4dmbhlMd6iqr0NrUy2XeMpXNAoqDLXBgUvm7xdMZAy4ZI9l7Zt+/WMXj8XCyqET4fftzJy0C7dmoQpg==","nonHashData":{"localLedgerCommitTimestamp":{"seconds":1460540856,"nanos":309117989}}}

Where can I get the returned chaincode name?

Thanks for any comments!

muralisrini commented 8 years ago

@yeasy : deploy consists of two parts : create the image and start up and then call the Init method with supplied parameters. In "dev" mode, there is no image to create and start up as that part is done by the developer (in this case you probably issued ./chaincode_example02 from the command line on another window with CORE_CHAINCODE_ID_NAME env variable specifying the name). The deploy then would just do the "Init" part.

One thing. In "dev" mode, Deploy shoukd take "-n " instead of "-p" which is ignored.

The code should really check return error if we don't supply "-n" in "dev" mode. I can fix that .... or if you like, you can. Please let me know.

Thanks!

@joshhus , @nickgaski : this would be good to clarify in docs.

yeasy commented 8 years ago

@muralisrini Thanks a lot for your reply! Yes, feel free to fix it. Agree with your clarification. And, could you help provide some detailed step to validate in the dev mode? I find the steps given are too simple to follow in the dev mode (And cannot understand why the consensus is disabled in hard code under the dev mode).

juliancarrivick-ibm commented 8 years ago

I'll take a look at this!