4

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.

ajay datla
  • 703
  • 1
  • 5
  • 12
  • i see you are using node chaincode, but you have not mentioned "-l node" while instantiating. you have to mention that. refer https://hyperledger-fabric.readthedocs.io/en/release-1.4/build_network.html#install-instantiate-chaincode – Harshit Mar 28 '19 at 10:21
  • Sorry, I used it in command but forgot to mention here. I have edited it now. – ajay datla Mar 28 '19 at 10:59

1 Answers1

14

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.

Kent Bull
  • 341
  • 3
  • 11