当您运行以下命令来发起智能合约时:
ff deploy fabric devtest asset_transfer.zip firefly asset_transfer 1.0
我收到以下错误:
Error: docker run --platform linux/amd64 --rm --network=devtest_default -e
CORE_PEER_ADDRESS=fabric_peer:7051 -e
CORE_PEER_TLS_ENABLED=true -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/firefly/organizations/peerOrganizations/
org1.example.com/peers/fabric_peer.org1.example.com/tls/ca.crt -e
CORE_PEER_LOCALMSPID=Org1MSP -e CORE_PEER_MSPCONFIGPATH=/etc/firefly/organizations/peerOrganizations/
org1.example.com/users/[email protected]/msp -v
/home/ubuntu/fabric-samples/asset-transfer-basic/chaincode-go/asset_transfer.zip:/package.tar.gz -v
devtest_firefly_fabric:/etc/firefly hyperledger/fabric-tools:2.3 peer lifecycle chaincode install /package.tar.gz
[1] Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode':
could not build chaincode: docker build failed: docker image build failed:
docker build failed: Error returned from build: 2 "go: downloading github.com/hyperledger/fabric-contract-api-go v1.2.1
我的版本:
peer:
Version: v2.5.4
Commit SHA: e1e8e2e
Go version: go1.20.6
OS/Arch: linux/amd64
Chaincode:
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger
go version go1.20.6 linux/amd64
Docker version 24.0.6, build ed223bc
FireFly version: "Version": "1.2.2",
有什么办法可以解决这个问题吗?
首先我做了一个
go build
,然后执行以下命令:
ff deploy fabric devtest asset_transfer.zip firefly asset_transfer 1.0
你的问题是go版本与go.mod不匹配,你可以下载fabric-samples 2.2.9并将你的go降级到版本1.14