Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: could not send: EOF on instantiating chaincode

I am getting

Error: could not send: EOF

on instantiating chaincode in HF. I followed the correct steps for installing binaries, images etc.

After installation I used following command in the first-network directory to install and instantiate chaincode:

./byfn.sh generate
./byfn.sh up
docker exec -it cli bash
peer chaincode install -n fabcar -v 1.0 -p github.com/chaincode/fabcar/javascript -l node

On executing last command this is the output that I got:

2019-03-28 09:22:04.047 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-03-28 09:22:04.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-03-28 09:22:04.950 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >

then I used the command to instantiate chaincode which is:

peer chaincode instantiate -n fabcar -v 1.0 -C mychannel -c '{"Args":[]}' -l node

And the output was an error like this:

2019-03-28 09:23:25.743 UTC [chaincodeCmd] InitCmdFactory -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer.example.com:7050
2019-03-28 09:23:25.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default escc
2019-03-28 09:23:25.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default vscc
Error: could not send: EOF

I think I missed something but I am not sure. Can anyone tell where I went wrong. Thanks in advance.

like image 636
ajay datla Avatar asked Dec 10 '22 03:12

ajay datla


1 Answers

I found that adding the TLS certificate options to the instantiate command worked for me. I am using Golang for my chaincode language

Install: (for reference)

peer chaincode install \
  -n mycc \
  -v 1.0 \
  -p myorg/chaincode

Instantiate:

peer chaincode instantiate \
  -C mychannel \
  -n mycc \
  -v 1.0 \
  -c '{"Args":["wallet","123"]}' \
  --tls true \
  --cafile /myorg/hyperledger/fabric/peer/crypto-config/ordererOrganizations/myorg.org/orderers/orderer.myorg.org/msp/tlscacerts/tlsca.myorg.org-cert.pem

I didn't have to specify the following options though including them did not break anything:

-P "OR ('MYORGMSP.peer')" \
-l golang \

I changed the CLI container to mount my crypto material at /myorg/hyperledger/fabric/peer/crypto-config which differs from the default location used by other examples.

like image 52
Kent Bull Avatar answered Dec 14 '22 16:12

Kent Bull