Hyperledger Fabric : Error starting Simple chaincode: error sending chaincode REGISTER

On this post I have added solution of this problem : Error starting Simple chaincode: error sending chaincode REGISTER,f we are following this tutroial : https://github.com/hyperledger/fabric-samples/tree/release/chaincode-docker-devmode

Refer : https://github.com/IBM-Blockchain/marbles/issues/136

Refer : https://github.com/IBM-Blockchain/marbles

Refer : https://stackoverflow.com/questions/36869895/how-does-the-golang-chaincode-in-the-marbles-nodejs-example-works

Running chaincode 

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go# CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./go

2018-05-21 02:42:16.552 UTC [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO

2018-05-21 02:42:16.552 UTC [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up …

Error starting Simple chaincode: error sending chaincode REGISTER: EOFroot@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go#

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go#

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go# ls

chaincode_example02.go  go

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go# go build

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go# CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./go

2018-05-21 02:45:03.153 UTC [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO

2018-05-21 02:45:03.153 UTC [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up …

2018-05-21 02:45:03.156 UTC [shim] func1 -> ERRO 003 Received error from server, ending chaincode stream: rpc error: code = Unimplemented desc = unknown service protos.ChaincodeSupport

Error starting Simple chaincode: rpc error: code = Unimplemented desc = unknown service protos.ChaincodeSupportroot@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go#

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go#

Solution – Change the Port Number 

root@5f4560c2dd0f:/opt/gopath/src/chaincode/chaincode_example02/go# CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./go

2018-05-21 02:46:14.697 UTC [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO

2018-05-21 02:46:14.697 UTC [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up …

 

On another Terminal CLI Install the chaincode :

root@b2f1243317c9:/opt/gopath/src/chaincodedev/chaincode/chaincode_example02/go# peer chaincode install -p ./go -n mycc -v 0

2018-05-21 03:05:34.987 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP

2018-05-21 03:05:34.987 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity

2018-05-21 03:05:34.987 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc

2018-05-21 03:05:34.987 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc

2018-05-21 03:05:34.987 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled

Error: Error getting chaincode code chaincode: path to chaincode does not exist: /opt/gopath/src/go

Usage:

  peer chaincode install [flags]

Flags:

  -c, –ctor string      Constructor message for the chaincode in JSON format (default “{}”)

  -l, –lang string      Language the chaincode is written in (default “golang”)

  -n, –name string      Name of the chaincode

  -p, –path string      Path to chaincode

  -v, –version string   Version of the chaincode specified in install/instantiate/upgrade commands

Global Flags:

      –cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint

      –certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint

      –clientauth                          Use mutual TLS when communicating with the orderer endpoint

      –keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint

      –logging-level string                Default logging level and overrides, see core.yaml for full syntax

  -o, –orderer string                      Ordering service endpoint

      –ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.

      –tls                                 Use TLS when communicating with the orderer endpoint

      –transient string                    Transient map of arguments in JSON encoding

root@b2f1243317c9:/opt/gopath/src/chaincodedev/chaincode/chaincode_example02/go# peer chaincode install -p ./ -n mycc -v 0

2018-05-21 03:05:58.007 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP

2018-05-21 03:05:58.007 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity

2018-05-21 03:05:58.007 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc

2018-05-21 03:05:58.008 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc

2018-05-21 03:05:58.008 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled

2018-05-21 03:05:58.062 UTC [golang-platform] getCodeFromFS -> DEBU 006 getCodeFromFS ./

2018-05-21 03:05:58.457 UTC [golang-platform] func1 -> DEBU 007 Discarding GOROOT package fmt

2018-05-21 03:05:58.457 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim

2018-05-21 03:05:58.457 UTC [golang-platform] func1 -> DEBU 009 Discarding provided package github.com/hyperledger/fabric/protos/peer

2018-05-21 03:05:58.458 UTC [golang-platform] func1 -> DEBU 00a Discarding GOROOT package strconv

2018-05-21 03:05:58.458 UTC [golang-platform] func1 -> DEBU 00b skipping dir: /opt/gopath/src/chaincodedev

2018-05-21 03:05:58.458 UTC [golang-platform] func1 -> DEBU 00c skipping dir: /opt/gopath/src/github.com

2018-05-21 03:05:58.458 UTC [golang-platform] GetDeploymentPayload -> DEBU 00d done

2018-05-21 03:05:58.461 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC4070A5C08031A0C0896EF88D80510…8C5800080000FFFF2EAFB5EF00040000

2018-05-21 03:05:58.461 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 44C646C44D1BA87D708ECFBBE5545F27DC74F054A96174F5C82E3709A8D56C0C

2018-05-21 03:05:58.484 UTC [chaincodeCmd] install -> DEBU 010 Installed remotely response:<status:200 payload:”OK” >

2018-05-21 03:05:58.484 UTC [main] main -> INFO 011 Exiting…..

root@b2f1243317c9:/opt/gopath/src/chaincodedev/chaincode/chaincode_example02/go#

 

Other queries worked fine 

Run this command 

root@b2f1243317c9:/opt/gopath/src/chaincodedev/chaincode/marbles02/go# peer chaincode invoke -n mycc -c ‘{“Args”:[“invoke”,”a”,”b”,”10″]}’ -C myc

Output 

Aval = 100, Bval = 200

ex02 Invoke

Aval = 90, Bval = 210

ex02 Invoke

Query Response:{“Name”:”a”,”Amount”:”90″}

ex02 Invoke

Aval = 80, Bval = 220

ex02 Invoke

Aval = 70, Bval = 230

ex02 Invoke

Aval = 60, Bval = 240

ex02 Invoke

Aval = 50, Bval = 250

ex02 Invoke

Aval = 40, Bval = 260

ex02 Invoke

Aval = 30, Bval = 270

ex02 Invoke

Aval = 20, Bval = 280

ex02 Invoke

Aval = 10, Bval = 290

ex02 Invoke

Aval = 0, Bval = 300

ex02 Invoke

Aval = -10, Bval = 310

ex02 Invoke

Aval = -20, Bval = 320

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s