1

Within my CLI container, I'm able to install the chaincode with no problems, but when I try to instantiate it, it returns the following error.

My GOPATH is set to /opt/gopath in the cli container.
The directory of my chaincode folder in the cli container: /opt/gopath/src/github.com/chaincode.
The instantiate command:
peer chaincode instantiate -o orderer1.iaorderer.com:7050 -C default -n chaincode -l "golang" -v 1.0 -c '{"Args":["InitLedger"]}' --tls --cafile/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/iaorderer/msp/tlscacerts/orderer-tlsca-server.crt

I've run go mod init, go mod tidy and go mod vendor on the chaincode folder already before the cli container mounts the chaincode folder as a volume I've also tried using init,tidy and vendor within the cli container and no difference was made.
I'm wondering if this is a problem with my GO versions being different. I'm running version 1.18 On the host which is what I'm running go mod init, go mod tidy and go mod vendor, and the CLI peer is running version 1.12.12. I cant upgrade it as far as I know since the CLI image comes pre-packaged with 1.12.12 and doesn't have snap. Here is how the go.mod looks after running go mod init after the chaincode code is written and here is how go.mod looks after running go mod tidy

Ewan Duff
  • 31
  • 5
  • You don't provide any information about the version of fabric you are trying to use. I am guessing you are trying to use fabric 1.4 ? If you are then I think for starters you should move to fabric 2.2 at least because fabric 1.4 is not supported anymore. Also as you are using the contract-api you will need to be using fabric 2.1 or higher according to the readme for the contract-api, but 2.1 isn't supported either now so 2.2 is the minimum version – david_k Apr 19 '22 at 15:20

1 Answers1

0

Fabric currently does not support Go 1.18. Try downgrading the host's version to 1.17. If there are still issues, attempt to close the gap between the major Go versions of the host and the CLI peer.