Chaincode installation has failed: chaincode type not supported
steven0301 opened this issue · 2 comments
Hi, I'm following the tutorial on Linux and struggling with installing asset-transfer-basic chaincode.
It works fine on M1 mac but I wasn't able to install chaincode on Linux which is offline.
When I execute $ peer lifecycle chaincode install basic.tar.gz
,
the message "chaincode type not supported: golang command=detect" appears.
Server info
OS : CentOS Linux 7
Architecture : x86_64
Go : go 1.21.4 linux/amd64
Here's what I have done:
1. Downloaded and modified install-fabric script.
(https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh)
Modified install-fabric.sh :
- Line 24: _arg_fabric_version: "2.5.4" → "2.5.5"
- Line 31: PLATFORM=linux-amd64
2. Downloaded samples and binary on M1 mac.
$ ./install-fabric.sh s b
3. Downloaded 2.5.5/1.5.7/3.3.2 docker image on M1 mac and move them to the server.
(1.5.7 for fabric-ca, 3.3.2 for couchdb)
$ docker pull --platform linux/amd64 hyperledger/${IMAGE}:${VERSION}
$ docker save -o hyperledger.${IMAGE)}.tar.gz -hyperledger/${IMAGE}:${VERSION}
4. Brought the hyperledger network up on Linux
$ /network.sh up createChannel -c mychannel -ca -s couchdb
result
Creating channel 'mychannel'.
If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'couchdb with crypto from 'Certificate Authorities Bringing up network
LOCAL_VERSION =v2.5.5
DOCKER IMAGE VERSION =v2.5.5
CA LOCAL VERSION =v1.5.7
CA_DOCKER_IMAGE_VERSION =v1.5.7
Generating certificates using Fabric CA
NFO [channelCd] InitCmdFactory -> Endorser and orderer connections initialized
INFO [channelmd] update -> Successfully submitted channel update
Anchor peer set for org 'Org2MSP' on channel 'mychannel'
Channel 'mychannel' joined
5. packge & install chaicode
$./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
result
Using docker and docker-compose /var/run/docker.sock
deploying chaincode on channel 'mychannel' executing with the following
- CHANNEL_NAME: mychannel
- CC_NAME: basic
- CC_SRC_PATH: /asset-transfer-basic/chaincode-go/
- CC_SRC_LANGUAGE: go
- CCIVERSION: 1.01
- CC_SEQUENCE: auto
- COLEND POLICY: NA
- CC_COLL_CONFIG: NA
- COLINIT_FON: NA
- DELAY: 3
- MAX RETRY: 5
- VERBOSE: false executing with the following
- CC_NAME: basic
- CC_SRC_ PATH:../asset-transfer-basic/chaincode-go/
- CC_SRC_LANGUAGE: go
- CC_VERSION: 1.0.1
Vendoring Go dependencies at /asset-transfer-basic/chaincode-go/ ~/fabric/asset-transfer-basic/chaincode-go ~/fabric/test-network ~/fabric/test-network
Finished vendoring Go dependencies
+ '[' false = true ']'
+ peer lifecycle chaincode package basic.tar.gz --path../asset-transfer-basic/chaincode-go/--lang golang --label basic_1.0.1
+ res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode queryinstalled --output json + jq-r 'try (installed_chaincodesi.package_id)*
+ grep '^ basic_1.0.1:cdd2db2045c093a6c584ac4c1f0c14abf5bed3e3/567be9796c0eeb32771cdIf$*
+ test 1 -ne 0
+ peer lifecycle chaincode install basic.tar.gz
-----
After few seconds
-----
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode: could not build chaincode: docker build failed: docke Chaincode installation on peer0.org has failed
Deploying chaincode failed
嗨,你好呀。
我的环境清单如下:
ubuntu18.04
go version go1.22.2 linux/amd64
按照官方文档进行了对等节点和排序节点的部署,参见:https://hyperledger-fabric.readthedocs.io/zh-cn/latest/test_network.html
./network.sh down
Using docker and docker-compose
Stopping network
[+] Running 11/11
✔ Container peer0.org1.example.com Removed 0.0s
✔ Container peer0.org2.example.com Removed 0.0s
✔ Container orderer.example.com Removed 0.0s
✔ Volume compose_peer0.org1.example.com Removed 0.0s
✔ Volume compose_orderer.example.com Removed 0.0s
✔ Volume compose_peer0.org2.example.com Removed 0.0s
✔ Volume compose_orderer2.example.com Removed 0.0s
✔ Volume compose_peer0.org3.example.com Removed 0.0s
✔ Volume compose_orderer4.example.com Removed 0.0s
✔ Volume compose_orderer3.example.com Removed 0.0s
✔ Network fabric_test Removed 0.1s
Error response from daemon: get docker_orderer.example.com: no such volume
Error response from daemon: get docker_peer0.org1.example.com: no such volume
Error response from daemon: get docker_peer0.org2.example.com: no such volume
Removing remaining containers
Removing generated chaincode docker images
使用了建立网络时创建通道,命令如下:
./network.sh up createChannel
```bash
Using docker and docker-compose
Creating channel 'mychannel'.
If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb with crypto from 'cryptogen'
Bringing up network
LOCAL_VERSION=v2.5.7
DOCKER_IMAGE_VERSION=v2.5.7
/opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/../bin/cryptogen
Generating certificates using cryptogen tool
Creating Org1 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
Creating Org2 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
Creating Orderer Org Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
Generating CCP files for Org1 and Org2
[+] Running 7/7
✔ Network fabric_test Creat... 0.1s
✔ Volume "compose_orderer.example.com" Created 0.0s
✔ Volume "compose_peer0.org1.example.com" Created 0.0s
✔ Volume "compose_peer0.org2.example.com" Created 0.0s
✔ Container peer0.org1.example.com Started 1.2s
✔ Container orderer.example.com Started 1.4s
✔ Container peer0.org2.example.com Started 1.3s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9f2627f6ebdf hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp peer0.org2.example.com
a4839b5475f9 hyperledger/fabric-orderer:latest "orderer" 1 second ago Up Less than a second 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp orderer.example.com
051191a51888 hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp peer0.org1.example.com
292aec8fdee7 hyperledger/fabric-tools:amd64-1.4.4 "/bin/bash" 7 weeks ago Exited (0) 3 days ago cli
f7cf93253803 hyperledger/fabric-peer:amd64-1.4.4 "peer node start" 7 weeks ago Exited (0) 3 days ago peer1.org1.example.com
948a1c3ef49e hyperledger/fabric-peer:amd64-1.4.4 "peer node start" 7 weeks ago Exited (0) 3 days ago peer1.org2.example.com
305e583ac695 hello-world "/hello" 3 months ago Exited (0) 3 months ago hopeful_knuth
813586581d77 hello-world "/hello" 3 months ago Exited (0) 3 months ago great_neumann
Using docker and docker-compose
Generating channel genesis block 'mychannel.block'
Using organization 1
/opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/../bin/configtxgen
+ '[' 0 -eq 1 ']'
+ configtxgen -profile ChannelUsingRaft -outputBlock ./channel-artifacts/mychannel.block -channelID mychannel
2024-05-03 11:22:09.971 CST 0001 INFO [common.tools.configtxgen] main -> Loading configuration
2024-05-03 11:22:09.986 CST 0002 INFO [common.tools.configtxgen.localconfig] completeInitialization -> orderer type: etcdraft
2024-05-03 11:22:09.986 CST 0003 INFO [common.tools.configtxgen.localconfig] completeInitialization -> Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2024-05-03 11:22:09.987 CST 0004 INFO [common.tools.configtxgen.localconfig] Load -> Loaded configuration: /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/configtx/configtx.yaml
2024-05-03 11:22:09.997 CST 0005 INFO [common.tools.configtxgen] doOutputBlock -> Generating genesis block
2024-05-03 11:22:09.998 CST 0006 INFO [common.tools.configtxgen] doOutputBlock -> Creating application channel genesis block
2024-05-03 11:22:09.999 CST 0007 INFO [common.tools.configtxgen] doOutputBlock -> Writing genesis block
+ res=0
Creating channel mychannel
Adding orderers
+ . scripts/orderer.sh mychannel
+ '[' 0 -eq 1 ']'
+ res=0
Status: 201
{
"name": "mychannel",
"url": "/participation/v1/channels/mychannel",
"consensusRelation": "consenter",
"status": "active",
"height": 1
}
Channel 'mychannel' created
Joining org1 peer to the channel...
Using organization 1
+ peer channel join -b ./channel-artifacts/mychannel.block
+ res=0
2024-05-03 11:22:16.384 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2024-05-03 11:22:16.434 CST 0002 INFO [channelCmd] executeJoin -> Successfully submitted proposal to join channel
Joining org2 peer to the channel...
Using organization 2
+ peer channel join -b ./channel-artifacts/mychannel.block
+ res=0
2024-05-03 11:22:19.530 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2024-05-03 11:22:19.588 CST 0002 INFO [channelCmd] executeJoin -> Successfully submitted proposal to join channel
Setting anchor peer for org1...
Using organization 1
Fetching channel config for channel mychannel
Using organization 1
Fetching the most recent configuration block for the channel
++ peer channel fetch config /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c mychannel --tls --cafile /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
2024-05-03 11:22:19.661 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2024-05-03 11:22:19.666 CST 0002 INFO [cli.common] readBlock -> Received block: 0
2024-05-03 11:22:19.668 CST 0003 INFO [channelCmd] fetch -> Retrieving last config block: 0
2024-05-03 11:22:19.671 CST 0004 INFO [cli.common] readBlock -> Received block: 0
Decoding config block to JSON and isolating config to /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPconfig.json
++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb --type common.Block --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json
++ jq '.data.data[0].payload.data.config' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json
++ res=0
Generating anchor peer update transaction for Org1 on channel mychannel
++ jq '.channel_group.groups.Application.groups.Org1MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org1.example.com","port": 7051}]},"version": "0"}}' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPconfig.json
++ res=0
++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPconfig.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb
++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPmodified_config.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb
++ configtxlator compute_update --channel_id mychannel --original /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb --updated /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb
++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb --type common.ConfigUpdate --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json
++ jq .
+++ cat /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json
++ echo '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"mychannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org1.example.com",' '"port":' 7051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update_in_envelope.json --type common.Envelope --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPanchors.tx
2024-05-03 11:22:20.135 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2024-05-03 11:22:20.149 CST 0002 INFO [channelCmd] update -> Successfully submitted channel update
Anchor peer set for org 'Org1MSP' on channel 'mychannel'
Setting anchor peer for org2...
Using organization 2
Fetching channel config for channel mychannel
Using organization 2
Fetching the most recent configuration block for the channel
++ peer channel fetch config /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c mychannel --tls --cafile /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
2024-05-03 11:22:20.280 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2024-05-03 11:22:20.288 CST 0002 INFO [cli.common] readBlock -> Received block: 1
2024-05-03 11:22:20.288 CST 0003 INFO [channelCmd] fetch -> Retrieving last config block: 1
2024-05-03 11:22:20.292 CST 0004 INFO [cli.common] readBlock -> Received block: 1
Decoding config block to JSON and isolating config to /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPconfig.json
++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb --type common.Block --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json
++ jq '.data.data[0].payload.data.config' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json
++ res=0
Generating anchor peer update transaction for Org2 on channel mychannel
++ jq '.channel_group.groups.Application.groups.Org2MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org2.example.com","port": 9051}]},"version": "0"}}' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPconfig.json
++ res=0
++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPconfig.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb
++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPmodified_config.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb
++ configtxlator compute_update --channel_id mychannel --original /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb --updated /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb
++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb --type common.ConfigUpdate --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json
++ jq .
+++ cat /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json
++ echo '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"mychannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org2.example.com",' '"port":' 9051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update_in_envelope.json --type common.Envelope --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPanchors.tx
2024-05-03 11:22:20.495 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2024-05-03 11:22:20.519 CST 0002 INFO [channelCmd] update -> Successfully submitted channel update
Anchor peer set for org 'Org2MSP' on channel 'mychannel'
Channel 'mychannel' joined
之后,按照文档的步骤进行在通道上启动链码。执行命令和结果如下:
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
我是**大陆内的使用者,设置了相关代理后,依然会出现如下问题,需要您们的帮助。
Using docker and docker-compose
deploying chaincode on channel 'mychannel'
executing with the following
- CHANNEL_NAME: mychannel
- CC_NAME: basic
- CC_SRC_PATH: ../asset-transfer-basic/chaincode-go/
- CC_SRC_LANGUAGE: go
- CC_VERSION: 1.0.1
- CC_SEQUENCE: auto
- CC_END_POLICY: NA
- CC_COLL_CONFIG: NA
- CC_INIT_FCN: NA
- DELAY: 3
- MAX_RETRY: 5
- VERBOSE: false
executing with the following
- CC_NAME: basic
- CC_SRC_PATH: ../asset-transfer-basic/chaincode-go/
- CC_SRC_LANGUAGE: go
- CC_VERSION: 1.0.1
Vendoring Go dependencies at ../asset-transfer-basic/chaincode-go/
/opt/gopath/src/github.com/fabric/scripts/fabric-samples/asset-transfer-basic/chaincode-go /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network
go: downloading github.com/hyperledger/fabric-contract-api-go v1.2.1
go: downloading github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
go: downloading github.com/hyperledger/fabric-protos-go v0.3.0
go: downloading google.golang.org/protobuf v1.28.1
go: downloading github.com/stretchr/testify v1.8.2
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go imports
github.com/hyperledger/fabric-contract-api-go/contractapi: github.com/hyperledger/fabric-contract-api-go@v1.2.1: Get "https://proxy.golang.org/github.com/hyperledger/fabric-contract-api-go/@v/v1.2.1.zip": dial tcp 172.217.163.49:443: connect: connection refused
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports
github.com/hyperledger/fabric-chaincode-go/pkg/cid: github.com/hyperledger/fabric-chaincode-go@v0.0.0-20230228194215-b84622ba6a7a: Get "https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20230228194215-b84622ba6a7a.zip": dial tcp 172.217.163.49:443: connect: connection refused
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports
github.com/hyperledger/fabric-chaincode-go/shim: github.com/hyperledger/fabric-chaincode-go@v0.0.0-20230228194215-b84622ba6a7a: Get "https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20230228194215-b84622ba6a7a.zip": dial tcp 172.217.163.49:443: connect: connection refused
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports
github.com/hyperledger/fabric-protos-go/ledger/queryresult: github.com/hyperledger/fabric-protos-go@v0.3.0: Get "https://proxy.golang.org/github.com/hyperledger/fabric-protos-go/@v/v0.3.0.zip": dial tcp 172.217.163.49:443: connect: connection refused
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports
github.com/hyperledger/fabric-protos-go/peer: github.com/hyperledger/fabric-protos-go@v0.3.0: Get "https://proxy.golang.org/github.com/hyperledger/fabric-protos-go/@v/v0.3.0.zip": dial tcp 172.217.163.49:443: connect: connection refused
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports
google.golang.org/protobuf/types/known/timestamppb: google.golang.org/protobuf@v1.28.1: Get "https://proxy.golang.org/google.golang.org/protobuf/@v/v1.28.1.zip": dial tcp 172.217.163.49:443: connect: connection refused
go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode tested by
github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode.test imports
github.com/stretchr/testify/require: github.com/stretchr/testify@v1.8.2: Get "https://proxy.golang.org/github.com/stretchr/testify/@v/v1.8.2.zip": dial tcp 172.217.163.49:443: connect: connection refused
/opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network
Finished vendoring Go dependencies
+ '[' false = true ']'
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go/ --lang golang --label basic_1.0.1
+ res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode queryinstalled --output json
+ jq -r 'try (.installed_chaincodes[].package_id)'
+ grep '^basic_1.0.1:59d67b930f882a14d6c8e39c0025bb659771e67c34586da9f956bd0491babf12$'
+ test 1 -ne 0
+ peer lifecycle chaincode install basic.tar.gz
+ res=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: 1 "go: downloading github.com/hyperledger/fabric-contract-api-go v1.2.1
assetTransfer.go:10:2: github.com/hyperledger/fabric-contract-api-go@v1.2.1: Get "https://proxy.golang.org/github.com/hyperledger/fabric-contract-api-go/@v/v1.2.1.zip": dial tcp 172.217.163.49:443: connect: connection refused
"
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
我需要大家的帮助。😭😭😭
嗨,你好呀。 我的环境清单如下: ubuntu18.04 go version go1.22.2 linux/amd64 按照官方文档进行了对等节点和排序节点的部署,参见:https://hyperledger-fabric.readthedocs.io/zh-cn/latest/test_network.html
./network.sh downUsing docker and docker-compose Stopping network [+] Running 11/11 ✔ Container peer0.org1.example.com Removed 0.0s ✔ Container peer0.org2.example.com Removed 0.0s ✔ Container orderer.example.com Removed 0.0s ✔ Volume compose_peer0.org1.example.com Removed 0.0s ✔ Volume compose_orderer.example.com Removed 0.0s ✔ Volume compose_peer0.org2.example.com Removed 0.0s ✔ Volume compose_orderer2.example.com Removed 0.0s ✔ Volume compose_peer0.org3.example.com Removed 0.0s ✔ Volume compose_orderer4.example.com Removed 0.0s ✔ Volume compose_orderer3.example.com Removed 0.0s ✔ Network fabric_test Removed 0.1s Error response from daemon: get docker_orderer.example.com: no such volume Error response from daemon: get docker_peer0.org1.example.com: no such volume Error response from daemon: get docker_peer0.org2.example.com: no such volume Removing remaining containers Removing generated chaincode docker images使用了建立网络时创建通道,命令如下:
./network.sh up createChannel ```bash Using docker and docker-compose Creating channel 'mychannel'. If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb with crypto from 'cryptogen' Bringing up network LOCAL_VERSION=v2.5.7 DOCKER_IMAGE_VERSION=v2.5.7 /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/../bin/cryptogen Generating certificates using cryptogen tool Creating Org1 Identities + cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations org1.example.com + res=0 Creating Org2 Identities + cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations org2.example.com + res=0 Creating Orderer Org Identities + cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations + res=0 Generating CCP files for Org1 and Org2 [+] Running 7/7 ✔ Network fabric_test Creat... 0.1s ✔ Volume "compose_orderer.example.com" Created 0.0s ✔ Volume "compose_peer0.org1.example.com" Created 0.0s ✔ Volume "compose_peer0.org2.example.com" Created 0.0s ✔ Container peer0.org1.example.com Started 1.2s ✔ Container orderer.example.com Started 1.4s ✔ Container peer0.org2.example.com Started 1.3s CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9f2627f6ebdf hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp peer0.org2.example.com a4839b5475f9 hyperledger/fabric-orderer:latest "orderer" 1 second ago Up Less than a second 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp orderer.example.com 051191a51888 hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp peer0.org1.example.com 292aec8fdee7 hyperledger/fabric-tools:amd64-1.4.4 "/bin/bash" 7 weeks ago Exited (0) 3 days ago cli f7cf93253803 hyperledger/fabric-peer:amd64-1.4.4 "peer node start" 7 weeks ago Exited (0) 3 days ago peer1.org1.example.com 948a1c3ef49e hyperledger/fabric-peer:amd64-1.4.4 "peer node start" 7 weeks ago Exited (0) 3 days ago peer1.org2.example.com 305e583ac695 hello-world "/hello" 3 months ago Exited (0) 3 months ago hopeful_knuth 813586581d77 hello-world "/hello" 3 months ago Exited (0) 3 months ago great_neumann Using docker and docker-compose Generating channel genesis block 'mychannel.block' Using organization 1 /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/../bin/configtxgen + '[' 0 -eq 1 ']' + configtxgen -profile ChannelUsingRaft -outputBlock ./channel-artifacts/mychannel.block -channelID mychannel 2024-05-03 11:22:09.971 CST 0001 INFO [common.tools.configtxgen] main -> Loading configuration 2024-05-03 11:22:09.986 CST 0002 INFO [common.tools.configtxgen.localconfig] completeInitialization -> orderer type: etcdraft 2024-05-03 11:22:09.986 CST 0003 INFO [common.tools.configtxgen.localconfig] completeInitialization -> Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216 2024-05-03 11:22:09.987 CST 0004 INFO [common.tools.configtxgen.localconfig] Load -> Loaded configuration: /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/configtx/configtx.yaml 2024-05-03 11:22:09.997 CST 0005 INFO [common.tools.configtxgen] doOutputBlock -> Generating genesis block 2024-05-03 11:22:09.998 CST 0006 INFO [common.tools.configtxgen] doOutputBlock -> Creating application channel genesis block 2024-05-03 11:22:09.999 CST 0007 INFO [common.tools.configtxgen] doOutputBlock -> Writing genesis block + res=0 Creating channel mychannel Adding orderers + . scripts/orderer.sh mychannel + '[' 0 -eq 1 ']' + res=0 Status: 201 { "name": "mychannel", "url": "/participation/v1/channels/mychannel", "consensusRelation": "consenter", "status": "active", "height": 1 } Channel 'mychannel' created Joining org1 peer to the channel... Using organization 1 + peer channel join -b ./channel-artifacts/mychannel.block + res=0 2024-05-03 11:22:16.384 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized 2024-05-03 11:22:16.434 CST 0002 INFO [channelCmd] executeJoin -> Successfully submitted proposal to join channel Joining org2 peer to the channel... Using organization 2 + peer channel join -b ./channel-artifacts/mychannel.block + res=0 2024-05-03 11:22:19.530 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized 2024-05-03 11:22:19.588 CST 0002 INFO [channelCmd] executeJoin -> Successfully submitted proposal to join channel Setting anchor peer for org1... Using organization 1 Fetching channel config for channel mychannel Using organization 1 Fetching the most recent configuration block for the channel ++ peer channel fetch config /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c mychannel --tls --cafile /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem 2024-05-03 11:22:19.661 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized 2024-05-03 11:22:19.666 CST 0002 INFO [cli.common] readBlock -> Received block: 0 2024-05-03 11:22:19.668 CST 0003 INFO [channelCmd] fetch -> Retrieving last config block: 0 2024-05-03 11:22:19.671 CST 0004 INFO [cli.common] readBlock -> Received block: 0 Decoding config block to JSON and isolating config to /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPconfig.json ++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb --type common.Block --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json ++ jq '.data.data[0].payload.data.config' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json ++ res=0 Generating anchor peer update transaction for Org1 on channel mychannel ++ jq '.channel_group.groups.Application.groups.Org1MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org1.example.com","port": 7051}]},"version": "0"}}' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPconfig.json ++ res=0 ++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPconfig.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb ++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPmodified_config.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb ++ configtxlator compute_update --channel_id mychannel --original /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb --updated /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb ++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb --type common.ConfigUpdate --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json ++ jq . +++ cat /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json ++ echo '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"mychannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org1.example.com",' '"port":' 7051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}' ++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update_in_envelope.json --type common.Envelope --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org1MSPanchors.tx 2024-05-03 11:22:20.135 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized 2024-05-03 11:22:20.149 CST 0002 INFO [channelCmd] update -> Successfully submitted channel update Anchor peer set for org 'Org1MSP' on channel 'mychannel' Setting anchor peer for org2... Using organization 2 Fetching channel config for channel mychannel Using organization 2 Fetching the most recent configuration block for the channel ++ peer channel fetch config /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c mychannel --tls --cafile /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem 2024-05-03 11:22:20.280 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized 2024-05-03 11:22:20.288 CST 0002 INFO [cli.common] readBlock -> Received block: 1 2024-05-03 11:22:20.288 CST 0003 INFO [channelCmd] fetch -> Retrieving last config block: 1 2024-05-03 11:22:20.292 CST 0004 INFO [cli.common] readBlock -> Received block: 1 Decoding config block to JSON and isolating config to /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPconfig.json ++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.pb --type common.Block --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json ++ jq '.data.data[0].payload.data.config' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_block.json ++ res=0 Generating anchor peer update transaction for Org2 on channel mychannel ++ jq '.channel_group.groups.Application.groups.Org2MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org2.example.com","port": 9051}]},"version": "0"}}' /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPconfig.json ++ res=0 ++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPconfig.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb ++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPmodified_config.json --type common.Config --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb ++ configtxlator compute_update --channel_id mychannel --original /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/original_config.pb --updated /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/modified_config.pb --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb ++ configtxlator proto_decode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.pb --type common.ConfigUpdate --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json ++ jq . +++ cat /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update.json ++ echo '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"mychannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org2.example.com",' '"port":' 9051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}' ++ configtxlator proto_encode --input /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/config_update_in_envelope.json --type common.Envelope --output /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network/channel-artifacts/Org2MSPanchors.tx 2024-05-03 11:22:20.495 CST 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized 2024-05-03 11:22:20.519 CST 0002 INFO [channelCmd] update -> Successfully submitted channel update Anchor peer set for org 'Org2MSP' on channel 'mychannel' Channel 'mychannel' joined之后,按照文档的步骤进行在通道上启动链码。执行命令和结果如下:
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go我是**大陆内的使用者,设置了相关代理后,依然会出现如下问题,需要您们的帮助。
Using docker and docker-compose deploying chaincode on channel 'mychannel' executing with the following - CHANNEL_NAME: mychannel - CC_NAME: basic - CC_SRC_PATH: ../asset-transfer-basic/chaincode-go/ - CC_SRC_LANGUAGE: go - CC_VERSION: 1.0.1 - CC_SEQUENCE: auto - CC_END_POLICY: NA - CC_COLL_CONFIG: NA - CC_INIT_FCN: NA - DELAY: 3 - MAX_RETRY: 5 - VERBOSE: false executing with the following - CC_NAME: basic - CC_SRC_PATH: ../asset-transfer-basic/chaincode-go/ - CC_SRC_LANGUAGE: go - CC_VERSION: 1.0.1 Vendoring Go dependencies at ../asset-transfer-basic/chaincode-go/ /opt/gopath/src/github.com/fabric/scripts/fabric-samples/asset-transfer-basic/chaincode-go /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network go: downloading github.com/hyperledger/fabric-contract-api-go v1.2.1 go: downloading github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a go: downloading github.com/hyperledger/fabric-protos-go v0.3.0 go: downloading google.golang.org/protobuf v1.28.1 go: downloading github.com/stretchr/testify v1.8.2 go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go imports github.com/hyperledger/fabric-contract-api-go/contractapi: github.com/hyperledger/fabric-contract-api-go@v1.2.1: Get "https://proxy.golang.org/github.com/hyperledger/fabric-contract-api-go/@v/v1.2.1.zip": dial tcp 172.217.163.49:443: connect: connection refused go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports github.com/hyperledger/fabric-chaincode-go/pkg/cid: github.com/hyperledger/fabric-chaincode-go@v0.0.0-20230228194215-b84622ba6a7a: Get "https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20230228194215-b84622ba6a7a.zip": dial tcp 172.217.163.49:443: connect: connection refused go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports github.com/hyperledger/fabric-chaincode-go/shim: github.com/hyperledger/fabric-chaincode-go@v0.0.0-20230228194215-b84622ba6a7a: Get "https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20230228194215-b84622ba6a7a.zip": dial tcp 172.217.163.49:443: connect: connection refused go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports github.com/hyperledger/fabric-protos-go/ledger/queryresult: github.com/hyperledger/fabric-protos-go@v0.3.0: Get "https://proxy.golang.org/github.com/hyperledger/fabric-protos-go/@v/v0.3.0.zip": dial tcp 172.217.163.49:443: connect: connection refused go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports github.com/hyperledger/fabric-protos-go/peer: github.com/hyperledger/fabric-protos-go@v0.3.0: Get "https://proxy.golang.org/github.com/hyperledger/fabric-protos-go/@v/v0.3.0.zip": dial tcp 172.217.163.49:443: connect: connection refused go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks imports google.golang.org/protobuf/types/known/timestamppb: google.golang.org/protobuf@v1.28.1: Get "https://proxy.golang.org/google.golang.org/protobuf/@v/v1.28.1.zip": dial tcp 172.217.163.49:443: connect: connection refused go: github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode tested by github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode.test imports github.com/stretchr/testify/require: github.com/stretchr/testify@v1.8.2: Get "https://proxy.golang.org/github.com/stretchr/testify/@v/v1.8.2.zip": dial tcp 172.217.163.49:443: connect: connection refused /opt/gopath/src/github.com/fabric/scripts/fabric-samples/test-network Finished vendoring Go dependencies + '[' false = true ']' + peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go/ --lang golang --label basic_1.0.1 + res=0 Chaincode is packaged Installing chaincode on peer0.org1... Using organization 1 + peer lifecycle chaincode queryinstalled --output json + jq -r 'try (.installed_chaincodes[].package_id)' + grep '^basic_1.0.1:59d67b930f882a14d6c8e39c0025bb659771e67c34586da9f956bd0491babf12$' + test 1 -ne 0 + peer lifecycle chaincode install basic.tar.gz + res=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: 1 "go: downloading github.com/hyperledger/fabric-contract-api-go v1.2.1 assetTransfer.go:10:2: github.com/hyperledger/fabric-contract-api-go@v1.2.1: Get "https://proxy.golang.org/github.com/hyperledger/fabric-contract-api-go/@v/v1.2.1.zip": dial tcp 172.217.163.49:443: connect: connection refused " Chaincode installation on peer0.org1 has failed Deploying chaincode failed我需要大家的帮助。😭😭😭
对go设置代理
vim ~/.bashrc
export GOPROXY=https://goproxy.io,direct
source ~/.bashrc
就可以解决上述问题了。